Identity crisis: bending Spring Security to your advanced use cases
summary
Live code shows Spring Security 6 with OAuth2/OIDC and Keycloak, using PKCE for public clients and a working demo app (code via QR). Config changes include an expression-based JWT authentication converter that maps nested Keycloak roles into granted authorities with SpEL, and a custom converter that reads an “impersonate” cookie/header to swap claims and return a new JWT-backed Authentication token so the backend acts as the impersonated user. Frontend stays unaware so a whoami endpoint is recommended. Spring Security 6 and Keycloak are used end-to-end.
AI-written summary · about
