Authentication Flow
This document provides an overview of the authentication setup and login flow in TUMApply, using Keycloak and OAuth 2.0 / OIDC.
π Overviewβ
TUMApply uses Keycloak as an identity provider. The client authenticates via OAuth 2.0 and obtains a JWT token. This token is sent with each request and validated by the Spring Boot server.
-
A TUM login realm called
tumidpldap -
An external login realm called
external-login -
A public client called
tumapply-client -
Test users with password login:
Realm Username Password Role tumidpldapadmin1adminADMINtumidpldapprofessor1professorPROFESSORtumidpldapprofessor2professorPROFESSORtumidpldapemployee1employeeEMPLOYEEtumidpldapemployee2employeeEMPLOYEEexternal-loginapplicant1applicantAPPLICANTexternal-loginapplicant2applicantAPPLICANTexternal-loginapplicant3applicantAPPLICANT
These users can authenticate with a password and receive a valid access token (JWT).
π Starting Keycloakβ
To start Keycloak, please follow the instructions in the Keycloak Setup document.
π§ What's in the Token?β
Use jwt.io to inspect the decoded token.
Example decoded JWT:
{
"preferred_username": "admin1",
"given_name": "Admin",
"family_name": "One",
...
}
π Authorization Flow in Applicationβ
- Client sends
Authorization: Bearer <token>in every request - Server extracts and validates the token, retrieves user info like
preferred_username,given_name,family_name, ...
The user's role is not synced from Keycloak, but instead assigned and managed inside the TUMApply database.
β Summaryβ
- Keycloak manages authentication, but not roles.
- User data is stored and managed in the TUMApply database.
- On first login, a new user is created with default role.