adding more claims attributes to Keycloak validation

This commit is contained in:
Dario Ghunney Ware 2025-02-21 17:02:29 +00:00
parent 086e4e0e15
commit d25429748e
2 changed files with 3 additions and 2 deletions

View File

@ -9,6 +9,7 @@ import java.util.stream.Collectors;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import stirling.software.SPDF.model.UsernameAttribute; import stirling.software.SPDF.model.UsernameAttribute;
import stirling.software.SPDF.model.exception.UnsupportedUsernameAttribute; import stirling.software.SPDF.model.exception.UnsupportedUsernameAttribute;
@ -83,7 +84,7 @@ public class Provider {
private UsernameAttribute validateKeycloakUsernameAttribute( private UsernameAttribute validateKeycloakUsernameAttribute(
UsernameAttribute usernameAttribute) { UsernameAttribute usernameAttribute) {
switch (usernameAttribute) { switch (usernameAttribute) {
case EMAIL, PREFERRED_USERNAME -> { case EMAIL, NAME, GIVEN_NAME, FAMILY_NAME, PREFERRED_USERNAME -> {
return usernameAttribute; return usernameAttribute;
} }
default -> default ->

View File

@ -28,7 +28,7 @@ security:
clientId: '' # client ID for Keycloak OAuth2 clientId: '' # client ID for Keycloak OAuth2
clientSecret: '' # client secret for Keycloak OAuth2 clientSecret: '' # client secret for Keycloak OAuth2
scopes: openid, profile, email # scopes for Keycloak OAuth2 scopes: openid, profile, email # scopes for Keycloak OAuth2
useAsUsername: preferred_username # field to use as the username for Keycloak OAuth2. Available options are: [email | preferred_name] useAsUsername: preferred_username # field to use as the username for Keycloak OAuth2. Available options are: [email | name | given_name | family_name | preferred_name]
google: google:
clientId: '' # client ID for Google OAuth2 clientId: '' # client ID for Google OAuth2
clientSecret: '' # client secret for Google OAuth2 clientSecret: '' # client secret for Google OAuth2