Skip to content

Conversation

rwinch
Copy link
Member

@rwinch rwinch commented Jun 19, 2019

ServerBearerTokenAuthenticationConverter Handles Empty Tokens

Previously ServerBearerTokenAuthenticationConverter would throw an
IllegalArgumentException when the access token in a URI was empty String.
It also incorrectly provided HttpStatus.BAD_REQUEST for an empty String
access token in the headers.

This changes ServerBearerTokenAuthenticationConverter to consistently
throw a OAuth2AuthenticationException with an HttpStatus.UNAUTHORIZED

Fixes gh-7011

Previously ServerBearerTokenAuthenticationConverter would throw an
IllegalArgumentException when the access token in a URI was empty String.
It also incorrectly provided HttpStatus.BAD_REQUEST for an empty String
access token in the headers.

This changes ServerBearerTokenAuthenticationConverter to consistently
throw a OAuth2AuthenticationException with an HttpStatus.UNAUTHORIZED

Fixes spring-projectsgh-7011
@rwinch rwinch force-pushed the gh-7011-empty-bearer-token branch from d105f15 to fe97325 Compare June 19, 2019 14:16
@rwinch rwinch changed the title <!-- For Security Vulnerabilities, please use https://pivotal.io/security#reporting --> ServerBearerTokenAuthenticationConverter Handles Empty Tokens Jun 19, 2019
@rwinch rwinch requested a review from jzheaux June 19, 2019 14:18
@rwinch rwinch added in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue type: bug A general bug labels Jun 19, 2019
@rwinch rwinch added this to the 5.2.0.RC1 milestone Jun 19, 2019
@rwinch
Copy link
Member Author

rwinch commented Jun 19, 2019

@jzheaux Can you please review this? Once this is ready for merge, can you also backport to 5.1.x to resolve gh-7021?

Copy link
Contributor

@jzheaux jzheaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - thanks, @rwinch, this is now merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: duplicate A duplicate of another issue type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reactive OAuth2 using query parameters for access_token can cause HTTP 500s
2 participants