Skip to content

Allow multiple spaces in bearer authorization header - #19633

Open
avsan wants to merge 1 commit into
spring-projects:mainfrom
avsan:fix/gh-19500-bearer-multiple-spaces
Open

Allow multiple spaces in bearer authorization header#19633
avsan wants to merge 1 commit into
spring-projects:mainfrom
avsan:fix/gh-19500-bearer-multiple-spaces

Conversation

@avsan

@avsan avsan commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Allow DefaultBearerTokenResolver to accept one or more spaces between
the Bearer authentication scheme and the token.

RFC 6750 permits one or more SP characters between Bearer and the
credentials, while the current pattern only accepts exactly one space.

Changes

  • Update the bearer token pattern to accept one or more spaces.
  • Add regression coverage for an Authorization header containing multiple
    spaces before the token.
  • Preserve the existing behavior for valid single-space bearer headers.

Testing

  • Added a focused regression test for multiple spaces.
  • Existing DefaultBearerTokenResolverTests pass.
  • git diff --check is clean.

Closes gh-19500

Accept one or more spaces between the Bearer authentication scheme and
token as allowed by RFC 6750.

Add regression coverage for authorization headers containing multiple
spaces before the token.

Closes spring-projectsgh-19500

Signed-off-by: avsan <abhishekrajabca@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultBearerTokenResolver rejects RFC-legal multi-space Authorization header

2 participants