Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix OIDC discovery to fallback on text/html responses #17927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
znight1020 wants to merge 1 commit into spring-projects:main
base: main
Choose a base branch
Loading
from znight1020:fix/gh-17036-oidc-fallback

Conversation

Copy link

@znight1020 znight1020 commented Sep 17, 2025
edited
Loading

Summary

Some providers return 200 with text/html for /.well-known/openid-configuration. Previously, discovery stopped at the
first endpoint. This PR makes discovery continue to the next candidate so it can fall back to the OAuth 2.0 Authorization Server metadata endpoint.

Motivation

What Changed

  • oauth2/oauth2-client
    • ClientRegistrations#getBuilder: record UnknownContentTypeException
      and try the next discovery endpoint
  • Tests
    • issuerWhenOidcHtmlThenFallbackToOAuth2ThenSuccess
    • issuerWhenFirstEndpoint5xxThenThrowsIllegalArgumentException

Behavior

  • Before: Non-JSON at OIDC discovery → exception surfaced, no fallback.
  • After: Non-JSON at OIDC discovery → error recorded → try next endpoint →
    succeeds via OAuth 2.0 AS metadata when available.

Closes gh-17036

Some providers return 200 OK with text/html for
/.well-known/openid-configuration.
Previously, discovery stopped at the first endpoint.
This commit records UnknownContentTypeException and moves to
the next candidate, enabling fallback to the OAuth 2.0 AS
metadata endpoint.
Closes spring-projectsgh-17036
Signed-off-by: 이현수 <znight1020@naver.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Oauth2: Lookup from oauth2 well-known endpoint fails, if lookup of the oidc well-known endpoint errors

AltStyle によって変換されたページ (->オリジナル) /