When I create a JwtAuthenticationToken through its constructor, I can pass my own custom principal class (which is not required to implement any interface or extend any class).
If I create a JwtAuthenticationToken through its builder, the principal must be of type Jwt.
Why are the requirements on the principal type different? Can the types be aligned?
Also, why does BearerTokenAuthentication force the principal to implement OAuth2AuthenticatedPrincipal, it would be great if I could use my own custom princpal class (without any type requirement) like I do with JwtAuthenticationToken.
When I create a
JwtAuthenticationTokenthrough its constructor, I can pass my own custom principal class (which is not required to implement any interface or extend any class).If I create a
JwtAuthenticationTokenthrough its builder, the principal must be of typeJwt.Why are the requirements on the principal type different? Can the types be aligned?
Also, why does
BearerTokenAuthenticationforce the principal to implementOAuth2AuthenticatedPrincipal, it would be great if I could use my own custom princpal class (without any type requirement) like I do withJwtAuthenticationToken.