Skip to content

Sample project to test authentication using Keycloak with Spring Boot 2.0 OAuth2 Client.

Notifications You must be signed in to change notification settings

cthiebault/keycloak-spring-boot-2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keycloak & Spring Boot 2 OAuth2 client

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 :-(

Run application

Keycloak

  1. Import realm config realm-export.json to Keycloak
  2. Edit spring-boot-test client to add a new admin role
  3. Create a user with admin role within spring-boot-test client

Application

  1. Update src/main/resources/application.yml with keycloak url
  2. Run application: ./mvnw spring-boot:run
  3. Go to http://localhost:8080 and login
  4. User will have ROLE_USER authority instead of admin :-(

About

Sample project to test authentication using Keycloak with Spring Boot 2.0 OAuth2 Client.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published