Sample project to test authentication using Keycloak with Spring Boot 2.0 OAuth2 Client.
See also Spring Security: Mapping User Authorities
Works fine except that user always get ROLE_USER authority instead of the one defined in keycloak :-(
- Import realm config
realm-export.jsonto Keycloak - Edit
spring-boot-testclient to add a newadminrole - Create a user with
adminrole withinspring-boot-testclient
- Update
src/main/resources/application.ymlwith keycloak url - Run application:
./mvnw spring-boot:run - Go to http://localhost:8080 and login
- User will have
ROLE_USERauthority instead ofadmin:-(