Class JwtBearerTokenAuthenticationConverter
java.lang.Object
org.springframework.security.oauth2.server.resource.authentication.JwtBearerTokenAuthenticationConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<Jwt, AbstractAuthenticationToken>
public final class JwtBearerTokenAuthenticationConverter
extends Object
implements org.springframework.core.convert.converter.Converter<Jwt, AbstractAuthenticationToken>
A
Converter that takes a Jwt and converts it into a
BearerTokenAuthentication.
In the process, it will attempt to parse either the "scope" or "scp" attribute,
whichever it finds first.
It's not intended that this implementation be configured since it is simply an adapter.
If you are using, for example, a custom JwtGrantedAuthoritiesConverter, then
it's recommended that you simply create your own Converter that delegates to
your custom JwtGrantedAuthoritiesConverter and instantiates the appropriate
BearerTokenAuthentication.- Since:
- 5.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetJwtPrincipalConverter(org.springframework.core.convert.converter.Converter<Jwt, OAuth2AuthenticatedPrincipal> jwtPrincipalConverter) Sets theConverter<Jwt, OAuth2AuthenticatedPrincipal>to use.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Constructor Details
-
JwtBearerTokenAuthenticationConverter
public JwtBearerTokenAuthenticationConverter()
-
-
Method Details
-
convert
- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<Jwt, AbstractAuthenticationToken>
-
setJwtPrincipalConverter
public void setJwtPrincipalConverter(org.springframework.core.convert.converter.Converter<Jwt, OAuth2AuthenticatedPrincipal> jwtPrincipalConverter) Sets theConverter<Jwt, OAuth2AuthenticatedPrincipal>to use.By default, constructs a
DefaultOAuth2AuthenticatedPrincipalbased on the claims and authorities derived from theJwt.- Parameters:
jwtPrincipalConverter- The converter- Since:
- 7.1
-