Skip to content

Allow custom settings in ClientRegistration.ClientSettings#18933

Open
pranavmanglik wants to merge 1 commit intospring-projects:mainfrom
pranavmanglik:feature/extensible-client-settings
Open

Allow custom settings in ClientRegistration.ClientSettings#18933
pranavmanglik wants to merge 1 commit intospring-projects:mainfrom
pranavmanglik:feature/extensible-client-settings

Conversation

@pranavmanglik
Copy link
Copy Markdown

@pranavmanglik pranavmanglik commented Mar 18, 2026

Description

This pull request introduces an extensible ClientSettings configuration within ClientRegistration. Currently, ClientRegistration handles core OAuth2 properties, but adding provider-specific or advanced settings (such as custom PKCE requirements or extended client metadata) often requires modifying the core class or maintaining complex external maps.

By encapsulating these configurations in a dedicated, immutable ClientSettings object, we provide a cleaner API for future extensions without bloating the ClientRegistration root. This aligns with the framework's goals of modularity and extensibility for modern OAuth2/OIDC flows.

Key Changes

  • Introduced ClientSettings: A new configuration class held by ClientRegistration to store specialized client behavior settings.
  • Updated ClientRegistration.Builder: Added the .clientSettings(ClientSettings) method to the builder pattern to allow for fluent configuration.
  • Enhanced Validation: Integrated logic within ClientRegistration.Builder to ensure that provided ClientSettings (e.g., requireProofKey) are compatible with the selected AuthorizationGrantType.
  • Testing: Added comprehensive unit tests in ClientRegistrationTests covering valid configurations, edge cases, and validation failures.

Related Issues

Ref: #18863 Checklist

  • Fixed checkstyle issues using ./gradlew checkstyleMain
  • Added unit tests in ClientRegistrationTests
  • All tests passed via ./gradlew :spring-security-oauth2-client:test
  • Documentation updated

@pranavmanglik pranavmanglik force-pushed the feature/extensible-client-settings branch from 3caa493 to 8a68648 Compare March 18, 2026 19:04
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 18, 2026
@jgrandja jgrandja added type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 25, 2026
Copy link
Copy Markdown
Contributor

@jgrandja jgrandja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @pranavmanglik. Please see review comments.

Also, please rebase to latest on main. Thank you.

@jgrandja jgrandja changed the title Fix #18863: Add extensible ClientSettings to ClientRegistration Allow custom settings in ClientRegistration.ClientSettings Apr 1, 2026
@jgrandja jgrandja self-assigned this Apr 1, 2026
@pranavmanglik pranavmanglik force-pushed the feature/extensible-client-settings branch from 8a68648 to fc3e093 Compare April 3, 2026 17:45
Signed-off-by: Pranav Manglik <pranav@undreamt.in>
@pranavmanglik pranavmanglik force-pushed the feature/extensible-client-settings branch from fc3e093 to c57ea55 Compare April 3, 2026 17:46
@pranavmanglik
Copy link
Copy Markdown
Author

@jgrandja I think i have made the changes suggested by you, though i am not sure about these test cases, is there anything you suggest for that?

@pranavmanglik pranavmanglik requested a review from jgrandja April 3, 2026 17:51
@jgrandja
Copy link
Copy Markdown
Contributor

jgrandja commented Apr 6, 2026

@pranavmanglik

is there anything you suggest for that?

Please take a look at these tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants