Polish gh-12281
This commit is contained in:
parent
488901dd4e
commit
9751636735
|
@ -521,9 +521,10 @@ class OAuth2LoginSecurityConfig {
|
|||
// 3) Create a copy of oidcUser but use the mappedAuthorities instead
|
||||
val providerDetails = userRequest.getClientRegistration().getProviderDetails()
|
||||
val userNameAttributeName = providerDetails.getUserInfoEndpoint().getUserNameAttributeName()
|
||||
val mappedOidcUser = when (StringUtils.hasText(userNameAttributeName)) {
|
||||
true -> DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo, userNameAttributeName)
|
||||
false -> DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo)
|
||||
val mappedOidcUser = if (StringUtils.hasText(userNameAttributeName)) {
|
||||
DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo, userNameAttributeName)
|
||||
} else {
|
||||
DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo)
|
||||
}
|
||||
|
||||
Mono.just(mappedOidcUser)
|
||||
|
|
|
@ -700,7 +700,7 @@ class OAuth2LoginSecurityConfig {
|
|||
|
||||
return OAuth2UserService { userRequest ->
|
||||
// Delegate to the default implementation for loading a user
|
||||
var oidcUser = delegate.loadUser(userRequest)
|
||||
val oidcUser = delegate.loadUser(userRequest)
|
||||
|
||||
val accessToken = userRequest.accessToken
|
||||
val mappedAuthorities = HashSet<GrantedAuthority>()
|
||||
|
@ -712,12 +712,10 @@ class OAuth2LoginSecurityConfig {
|
|||
val providerDetails = userRequest.getClientRegistration().getProviderDetails()
|
||||
val userNameAttributeName = providerDetails.getUserInfoEndpoint().getUserNameAttributeName()
|
||||
if (StringUtils.hasText(userNameAttributeName)) {
|
||||
oidcUser = DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo, userNameAttributeName)
|
||||
else {
|
||||
oidcUser = DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo)
|
||||
DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo, userNameAttributeName)
|
||||
} else {
|
||||
DefaultOidcUser(mappedAuthorities, oidcUser.idToken, oidcUser.userInfo)
|
||||
}
|
||||
|
||||
oidcUser
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue