This is an example project to show different capabilities of OpenID Connect standards.
Watch the Network console with filtering for only Fetch/XHR and Doc type requests.
-
Loading information about the server: .well-known/openid-configuration` based on the issuer
http://localhost:8080/realms/test
plus/.well-known/openid-configuration
-
Check if a user is logged in
.../auth?redirect_uri=...&prompt=none...
⇒...?error=login_required...
-
Log in the user
.../auth?redirect_uri=...&prompt=login...
⇒...session_state=...code=...
-
Use PAR instead of the URI (can be enforced von Keycloak side)
POST query parameters toext/par/request
, =…&prompt=login…` => `…session_state=…code=…+` -
Get tokens
POST with everything to server endpoint, then open `+…/auth?request_uri=…
→ ID-Token, Access Token, Refresh Token, … -
OpenID Connect Session Management to check if the user is still logged in
IFrame.../login-status-iframe.html
+session_state
+ JavaScriptsendMessage()
/receiveMessage()
⇒ Check if the user is still logged in using a cookie -
Inspect the ID token
-
Use the access token to retrieve information from the user info endpoint (as an example of a protected resource)
-
Refresh the access token when necessary
-
Logout
.../logout?post_logout_redirect_uri=...&id_token_hint=...&client_id=...
⇒ Redirect to client URL -
Re-authenticate when already logged in
.../auth?redirect_uri=...&prompt=login...
⇒...session_state=...code=...
-
Enforce second factor authentication (can also be enforced in Keycloak client configuration)
.../auth?...acr_values=2...
⇒ level shown in the token -
Application Initiated Actions (non-standard)
-
Update Profile
.../auth?redirect_uri=...&kc_action=UPDATE_PROFILE...
⇒...session_state=...code=...
-
Update Password
.../auth?redirect_uri=...&kc_action=UPDATE_PASSWORD...
⇒...session_state=...code=...
-
-
Account Console (non-standard)
.../account?referrer=...&referrer_uri=...
-
Add extra scope address to get address data
.../auth?...&scope=openid+email+address...
⇒ scopes in token -
Create additional fields for scope address
Go to realmtest
Client scopes →address
→ Mappers →street
,locality
,region
,postal_code
,country
,formatted
Realm settings → User profile → Create attributeformatted
Enabled and required when scopeaddress
is requested
Who can edit: Admins and Users
Input Type: text area -
Register a new user
Go to realmtest
→ Realm settings → Login → enable User registration
See server info change with newprompt
valuecreate
.../auth?redirect_uri=...&prompt=create...
⇒...session_state=...code=...