Skip to content

Conversation

znight1020
Copy link

@znight1020 znight1020 commented Sep 17, 2025

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
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
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
2 participants