-
-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Describe the bug
When logging in via OIDC with an identity provider that doesn't return the given_name claim (like Dex), Reitti crashes with a NullPointerException at CustomOidcUserService.java:64. However, according to Reitti's documentation, user matching relies on preferred_username and name claims — given_name is not mentioned as a required or used claim. This suggests either a documentation/implementation mismatch, or the code is accessing a claim that shouldn't be part of the authentication flow.
To Reproduce
Steps to reproduce the behavior:
- Configure Reitti to use OIDC authentication with Dex (or any provider that omits
given_name) - Navigate to the Reitti login page
- Click "Login" and authenticate through the OIDC provider
- After successful authentication at the provider, the callback to
/login/oauth2/code/oauthfails with HTTP 500
Expected behavior
Per the documentation, Reitti should successfully authenticate using preferred_username and name claims. The code should either:
- Not access
given_nameat all (if it's not needed), or - Handle its absence gracefully if it is used for something undocumented
Screenshots
N/A
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
Stack trace:
java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because the return value of "org.springframework.security.oauth2.core.oidc.user.OidcUser.getGivenName()" is null
at com.dedicatedcode.reitti.config.CustomOidcUserService.loadUser(CustomOidcUserService.java:64)
Documentation discrepancy: The OIDC documentation states that Reitti uses:
preferred_usernamefor username assignmentnamefor display name
But the crash indicates the code is attempting to use given_name, which is an optional OIDC claim that Dex (and other minimal providers) don't include. Could you clarify:
- Is
given_nameactually used for something, or should the code be usingpreferred_username/nameinstead? - Should the documentation be updated to list
given_nameas required? - Or should the code be changed to stop using
given_nameentirely?