This project demonstrates integration with Keycloak for authentication and authorization using Rust and Actix-web framework.
- URL:
/login - Method:
GET - Description: Initiates the authentication flow by redirecting to Keycloak login page
- Response: Redirects to Keycloak authentication page
- URL:
/callback - Method:
GET - Query Parameters:
code: Authorization code from Keycloaksession_state: Session stateiss: (Optional) Issuer
- Description: Handles the OAuth2 callback from Keycloak
- Response:
- Sets
access_tokencookie - Returns HTML page with token information
- Sets
All protected routes are under /api/v1 and require Bearer token authentication.
- URL:
/api/v1/protected - Method:
GET - Headers Required:
Authorization: Bearer <access_token>
- Description: Example of a protected resource
- Response:
- Success (200): Returns "Access to protected resource granted!"
- Unauthorized (401): When token is invalid or missing
- URL:
/api/v1/logout - Method:
POST - Headers Required:
Authorization: Bearer <access_token>
- Description: Ends the user session
- Response:
- Success (302): Redirects to
/login - Error (400): When token is missing
- Error (500): When logout fails
- Success (302): Redirects to