-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement
Description
Thank you for your continuous efforts in maintaining and improving spring security.
I would like to discuss a potential enhancement that could benefit many users.
Expected Behavior
Allow users to receive a more descriptive custom error message or be redirected to a specific error URL when an invalid client registration is provided during the OIDC process.
Current Behavior
- A user enters the Client Registration ID and initiates the OIDC login process on our SPA page.
- The SPA frontend constructs an OIDC initiation URL as https://{domain}/oauth2/authorization/{ClientRegistrationId}.
- The user's browser redirects to the URL mentioned and reaches DefaultOAuth2AuthorizationRequestResolver via OAuth2AuthorizationRequestRedirectFilter.
- If the ClientRegistrationId is invalid, DefaultOAuth2AuthorizationRequestResolver throws either an IllegalArgumentException (5.7.x) or an InvalidClientRegistrationIdException (5.8.x).
- OAuth2AuthorizationRequestRedirectFilter interrupts the filter chain and returns HttpStatus.INTERNAL_SERVER_ERROR. (code)
- The user is redirected to https://{domain}/error, triggering a white-label page.
Context
- Pre-validating the ClientRegistrationId cannot prevent this situation.
- In step (5), because OAuth2AuthorizationRequestRedirectFilter interrupts the filter chain, any additional error-handling filters become ineffective.
- Overriding OAuth2AuthorizationRequestRedirectFilter offers no benefit due to the private accessor of unsuccessfulRedirectForAuthorization.
- To the best of my knowledge, checking the ClientRegistrationId is not part of the OIDC process, so the framework might allow individual applications to set their own policies on this matter.
Metadata
Metadata
Assignees
Labels
in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)status: duplicateA duplicate of another issueA duplicate of another issuetype: enhancementA general enhancementA general enhancement