Add JWT client authentication for OAuth token requests - #2202
Open
sdelamo wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds JWT-based client authentication (RFC 7523) for OAuth2/OpenID token requests, including configuration binding, request shaping, fail-closed behavior, and documentation updates.
Changes:
- Add
client_secret_jwt/private_key_jwttoken endpoint auth support with per-request JWT assertions. - Introduce
token.client-assertion.*andopenid.token.client-assertion.*configuration (lifetime, aud/iss/sub, alg, signer). - Add tests covering request shaping, misconfiguration failures, signer selection, and embedded token endpoint handling.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/docs/guide/oauth/flows/authorization-code/openid-authorization-code/openid-configuration.adoc | Documents OpenID token endpoint JWT client assertion configuration and includes generated config properties docs. |
| src/main/docs/guide/oauth/flows/authorization-code/oauth2-authorization-code/oauth2-configuration.adoc | Documents OAuth2 token endpoint JWT client assertion configuration and adds config properties include. |
| security-oauth2/src/main/java/io/micronaut/security/oauth2/endpoint/token/request/DefaultTokenEndpointClient.java | Adds client-assertion authentication handling and optional generator integration into token request securing. |
| security-oauth2/src/main/java/io/micronaut/security/oauth2/endpoint/token/request/JwtClientAssertionGenerator.java | Implements JWT client assertion creation/signing for client_secret_jwt and private_key_jwt. |
| security-oauth2/src/main/java/io/micronaut/security/oauth2/configuration/endpoints/TokenEndpointConfiguration.java | Extends token endpoint configuration interface with optional client assertion configuration. |
| security-oauth2/src/main/java/io/micronaut/security/oauth2/configuration/endpoints/ClientAssertionConfiguration.java | Adds a dedicated configuration interface for JWT client assertions. |
| security-oauth2/src/main/java/io/micronaut/security/oauth2/configuration/OauthClientConfigurationProperties.java | Binds client-assertion configuration under both OAuth2 and OpenID token endpoint config properties. |
| security-oauth2/src/test/java/io/micronaut/security/oauth2/endpoint/token/request/DefaultTokenEndpointClientClientAssertionTest.java | Adds tests for JWT client assertion behavior across auth methods and failure modes, including an embedded server test. |
| security-oauth2/src/test/java/io/micronaut/security/oauth2/configuration/OauthClientConfigurationTest.java | Adds config binding test coverage for token.client-assertion.*. |
sdelamo
force-pushed
the
paperclip/mng-263-jwt-client-auth
branch
from
May 23, 2026 05:45
df2b490 to
66d2254
Compare
sdelamo
force-pushed
the
paperclip/mng-263-jwt-client-auth
branch
from
May 25, 2026 15:02
66d2254 to
97e662c
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
client_secret_jwtandprivate_key_jwt.token.client-assertion.*andopenid.token.client-assertion.*configuration for lifetime, audience, issuer, subject, signing algorithm, and signer selection.jti, embedded token endpoint handling, and docs for OAuth/OpenID configuration.Release Target
5.1.x5.1.05.1.0 Releasetype: enhancementTests
git diff --check origin/5.1.x...HEAD./gradlew :micronaut-security-oauth2:test --tests 'io.micronaut.security.oauth2.endpoint.token.request.DefaultTokenEndpointClientClientAssertionTest' --rerun-tasksPR Assets
None. This change updates source, tests, and AsciiDoc documentation only; no rendered screenshots, PDFs, logs, archives, or generated binary artifacts are required.
Closes #1511
✨ This message was AI-generated using gpt-5