spring-projects / spring-projects/spring-security

Adopt RFC7523bis for OAuth2 JWT Client Authentication

Open
#18,226 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: oauth2 type: enhancement
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

The Updates to OAuth 2.0 JSON Web Token (JWT) Client Authentication and Assertion-Based Authorization Grants (RFC7523bis) updated the recommendations for "audience values in OAuth 2.0 Client Assertion Authentication and Assertion-based Authorization Grants to address a security vulnerability identified in the previous requirements for those audience values in multiple OAuth 2.0 specifications". The previous recommendations were part of RFC7523.

In particular, there are two aspects encoded in the NimbusJwtClientAuthenticationParametersConverter that could be considered changing to adopt the new recommendations. They are both easily addressable through a Customizer, so there's no problem from that point of view. I'm raising this issue more to consider the default behaviour.

Audience

The aud claim is currently set to the Token URI. According to the new recommendations, it must be set to the Issuer URI instead (paragraph 4).

See https://github.com/spring-projects/spring-security/blob/main/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/NimbusJwtClientAuthenticationParametersConverter.java#L144

Client Assertion Type

The typ header param is not currently set. According to the new recommendations, it must be set to client-authentication+jwt or "another more specific explicit type value defined by a specification profiling this specification".

I wonder if it would make sense to set client-authentication+jwt as the default value.

Context

I'm working with the OAuth2 Client Credentials flow, integrating with OAuth2 Authorization Providers using JWT bearers as the client authentication strategy.

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 NimbusJwtClientAuthenticationParametersConverter.java at the referenced audience handling near line 144, then read RFC7523bis paragraph 4 and the surrounding converter behavior. Determine the appropriate defaults for the aud claim and typ header, and verify that both OAuth2 client authentication scenarios described in the issue follow the updated recommendations.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.