mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
fix: NPE when email_verified claim is missing in OIDC request
Closes: #1054
This commit is contained in:
parent
781d839702
commit
72e5fd9c9a
3 changed files with 8 additions and 2 deletions
|
|
@ -30,3 +30,5 @@ ERR_1023 | Book already present in ReadingList
|
|||
ERR_1024 | OAuth2 login error: no email attribute
|
||||
ERR_1025 | OAuth2 login error: no local user exist with that email
|
||||
ERR_1026 | OpenIDConnect login error: email not verified
|
||||
ERR_1027 | OpenIDConnect login error: no email_verified attribute
|
||||
ERR_1028 | OpenIDConnect login error: no email attribute
|
||||
|
|
|
|||
|
|
@ -655,7 +655,9 @@
|
|||
"ERR_1023": "Book already present in ReadingList",
|
||||
"ERR_1024": "OAuth2 login error: no email attribute",
|
||||
"ERR_1025": "OAuth2 login error: no local user exist with that email",
|
||||
"ERR_1026": "OpenID Connect login error: email not verified"
|
||||
"ERR_1026": "OpenID Connect login error: email not verified",
|
||||
"ERR_1027": "OpenID Connect login error: no email_verified attribute",
|
||||
"ERR_1028": "OpenID Connect login error: no email attribute"
|
||||
},
|
||||
"filter": {
|
||||
"age_rating": "age rating",
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ class KomgaOAuth2UserServiceConfiguration(
|
|||
return OAuth2UserService { userRequest: OidcUserRequest ->
|
||||
val oidcUser = delegate.loadUser(userRequest)
|
||||
|
||||
if (!oidcUser.emailVerified) throw OAuth2AuthenticationException("ERR_1026")
|
||||
if (oidcUser.email == null) throw OAuth2AuthenticationException("ERR_1028")
|
||||
if (oidcUser.emailVerified == null) throw OAuth2AuthenticationException("ERR_1027")
|
||||
if (oidcUser.emailVerified == false) throw OAuth2AuthenticationException("ERR_1026")
|
||||
|
||||
val existingUser = userRepository.findByEmailIgnoreCaseOrNull(oidcUser.email)
|
||||
?: tryCreateNewUser(oidcUser.email)
|
||||
|
|
|
|||
Loading…
Reference in a new issue