spring-projects / spring-projects/spring-boot

Allow disabling OAuth2 / OIDC provider discovery explicitly

Open
#42,172 8 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

I think it would be useful to disable the OAuth2 / OIDC discovery explicitly. At this moment this is possible implicitly by configuring every necessary detail of the client's registration and provider but skipping the provider's issuerUri. This disables the discovery via OAuth2ClientPropertiesMapper.

Why

  • Someone wants the service to not require the IdP to be available at startup.

  • Some code may need the issuerUri to function properly.

    In fact, there already is such code: Spring Securitys OIDC back channel logout validates the providers issuerUri in OidcBackChannelLogoutTokenValidator and ends up with a NPE if you did not set an issuerUri.

    So setting the issuerUri means you are forced to use discovery.
    Leaving it null means no working back channel logout, at least not with auto configuration.

How?

I'm not quite sure. Maybe a new property:

# default (fallback) value: true
spring.security.oauth2.client.provider.MY_PROVIDER.discovery=false

Setting this to false would opt-out the discovery. The current behaviour should be kept as default.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OAuth2ClientPropertiesMapper.java, especially the provider registration mapping around the issuerUri handling, then review the referenced OidcBackChannelLogoutTokenValidator.java behavior. Determine how an explicit opt-out could coexist with the current default discovery behavior; done means discovery can be disabled without requiring the identity provider at startup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
authentication, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.