Skip to content

Encode OAuth 2 client credentials by default - #2161

Merged
acogoluegnes merged 1 commit into
mainfrom
oauth2-encode-client-credentials-by-default
Nov 9, 2026
Merged

acogoluegnes merged 1 commit into
mainfrom
oauth2-encode-client-credentials-by-default

Conversation

@acogoluegnes

Copy link
Copy Markdown
Contributor

Form-encode the client ID and secret before HTTP Basic authentication by default, as required by RFC 6749, section 2.3.1. The urlEncodeClientCredentials(false) builder option allows to opt out for OAuth 2 servers that do not decode the credentials.

The encoding now happens in the provider instead of the builder, so the constructors use it as well. A new constructor overload accepts the flag; existing constructors encode by default.

The Basic authentication header now uses UTF-8 instead of ISO-8859-1, and null client ID or secret is rejected at creation time.

References #2160

Form-encode the client ID and secret before HTTP Basic authentication
by default, as required by RFC 6749, section 2.3.1. The
urlEncodeClientCredentials(false) builder option allows to opt out for
OAuth 2 servers that do not decode the credentials.

The encoding now happens in the provider instead of the builder, so
the constructors use it as well. A new constructor overload accepts
the flag; existing constructors encode by default.

The Basic authentication header now uses UTF-8 instead of ISO-8859-1,
and null client ID or secret is rejected with an
IllegalArgumentException at creation time.

References #2160
@acogoluegnes
acogoluegnes force-pushed the oauth2-encode-client-credentials-by-default branch from 97069c1 to 1601860 Compare November 9, 2026 09:08
@acogoluegnes
acogoluegnes marked this pull request as ready for review November 9, 2026 10:08
@acogoluegnes
acogoluegnes merged commit f69e34a into main Nov 9, 2026
7 checks passed
@acogoluegnes
acogoluegnes deleted the oauth2-encode-client-credentials-by-default branch November 9, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant