spring-security icon indicating copy to clipboard operation
spring-security copied to clipboard

Support custom `OAuth2AuthenticatedPrincipal` in Jwt-based authentication flow

Open therepanic opened this issue 7 months ago • 1 comments

This PR implements a simpler approach, as suggested by @jzheaux, to support OAuth2AuthenticatedPrincipal injection into JwtAuthenticationToken

Resolves: #6237

therepanic avatar Jun 01 '25 14:06 therepanic

I think the current solution can't be merged now since at the very least we don't have tests. I would like to hear feedback if I have understood the solution to the current problem correctly.

Also I guess we can't add a constructor to (Jwt jwt, Object principal, Collection<GrantedAuthority> authorities) as written in #32 because we already have a constructor with 3 arguments (Jwt jwt, Collection<? extends GrantedAuthority> authorities, String name). Because of this we have a build failing now.

therepanic avatar Jun 01 '25 14:06 therepanic