Skip to content

Fix TokenType comparison logic#19379

Open
ngocnhan-tran1996 wants to merge 3 commits into
spring-projects:mainfrom
ngocnhan-tran1996:gh-19377
Open

Fix TokenType comparison logic#19379
ngocnhan-tran1996 wants to merge 3 commits into
spring-projects:mainfrom
ngocnhan-tran1996:gh-19377

Conversation

@ngocnhan-tran1996

Copy link
Copy Markdown
Contributor

Closes gh-19377

Closes spring-projectsgh-19377

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 25, 2026
Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
@DragonFSKY

Copy link
Copy Markdown

Thanks for working on this. One small gap: BearerTokenAuthentication.Builder#token still uses the same reference comparison against OAuth2AccessToken.TokenType.BEARER, so authentication.toBuilder().token(new OAuth2AccessToken(new OAuth2AccessToken.TokenType("Bearer"), ...)).build() would still fail even after the constructor path is fixed.

I think this PR should update that builder check to OAuth2AccessToken.TokenType.BEARER.equals(token.getTokenType()) as well, with a small builder-path regression test.

…token`

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
@DragonFSKY

Copy link
Copy Markdown

Thanks for updating it.

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.

TokenType reference comparison is used in BearerTokenAuthentication

3 participants