Skip to content

Commit

Permalink
- added user attribute configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
temi committed Nov 22, 2023
1 parent c3a0421 commit 5ca3c29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ grails:
taglib: none
staticparts: none

userProfile:
userIdAttribute: "username"

environments:
test:
server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class UserInfoService {
def optUserProfile = alaOidcClient.getUserProfile(credentials, context, config.sessionStore)
if (optUserProfile.isPresent()) {
def userProfile = optUserProfile.get()
String userId = userProfile.userId ?: userProfile.getAttribute('username')
String userId = userProfile?.userId ?: userProfile?.getAttribute(grailsApplication.config.getProperty('userProfile.userIdAttribute'))
if (userId) {
return authService.getUserForUserId(userId)
}
Expand Down

0 comments on commit 5ca3c29

Please sign in to comment.