This project is a REST API that integrates Keycloak with Swagger to manage user, group, and permission authentication and authorization. The API is built using Flask and exposes endpoints for Keycloak administration operations, such as creating users, managing groups, and assigning users to groups.
- Authentication via Keycloak to protect the API endpoints.
- User Management:
- Create, list, update, and delete users.
- Group Management:
- List all groups and their respective IDs.
- Add users to groups.
- Swagger UI integration for API documentation and testing.
GET /userinfo
: Returns authenticated user information.POST /users
: Creates a new user.PUT /users/{user_id}
: Updates user information.DELETE /users/{user_id}
: Deletes a user.GET /list-groups
: Lists all groups with their IDs.PUT /users/{user_id}/groups/{group_id}
: Adds a user to a group.
- Flask: Python web framework.
- Keycloak: Identity and access management system.
- Swagger UI: Interface for API documentation and testing.
- PostgreSQL: Database used by Keycloak.
-
Clone the repository:
git clone <REPOSITORY_URL>
-
Start Keycloak and PostgreSQL Docker containers:
docker-compose up -d
-
Run the Flask API:
python app.py
-
Access the API documentation via Swagger:
Open your browser and go to:
http://localhost:5000/swagger