spring-projects / spring-projects/spring-security

Align Reactive BearerTokenServerAuthenticationEntryPoint with Servlet RFC 9728 WWW-Authenticate behavior

Open
#19,446 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: enhancement
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Expected Behavior

The Reactive OAuth2 Resource Server should produce the same default WWW-Authenticate header as the Servlet implementation.

Since Spring Security 7 / Spring Boot 4.1, the Servlet implementation includes RFC 9728 Bearer challenge metadata in the WWW-Authenticate header by default. The Reactive implementation should provide the same behavior for consistency across both stacks.

Current Behavior

The Servlet stack returns a WWW-Authenticate header containing the additional Bearer challenge metadata defined by RFC 9728.

For example:

WWW-Authenticate: Bearer resource_metadata="https://example.com/.well-known/oauth-protected-resource"

However, the Reactive stack still returns only:

WWW-Authenticate: Bearer

As a result, equivalent applications built on the Servlet and Reactive stacks produce different default authentication challenge responses.

Context

This appears to be an inconsistency between the Servlet and Reactive implementations.

Relevant references:

Would it make sense to align the Reactive implementation with the Servlet implementation so that both produce the same default WWW-Authenticate header?

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 BearerTokenServerAuthenticationEntryPoint and compare its default WWW-Authenticate behavior with the referenced BearerTokenAuthenticationEntryPoint. Use RFC 9728 Section 5.1 and the example header as the acceptance criteria. Done means equivalent Servlet and Reactive applications produce the same default Bearer challenge metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
authentication, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.