I have a Keycloak server running. and a spring boot application as a resource server. I can authenticate and get token and the spring boot app will accept the token. but when I want to get the username from the Principal I will get a UUID instead of my email or username. I also added a mapper to my keycloak that maps preferred_username to username. and it's working.
JWT info
...
"scope": "openid profile email",
"email_verified": true,
"username": "test@test.com",
"DOB": "12345",
"name": "test test",
"preferred_username": "test@test.com",
"given_name": "test",
"family_name": "test",
"email": "test@test.com"
}
my spring app properties:
spring:
security:
oauth2:
resourceserver:
jwt:
issuer-uri: http://localhost:8080/auth/realms/test