Class JwtAuthenticationConverter
java.lang.Object
org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter
- All Implemented Interfaces:
org.springframework.core.convert.converter.Converter<Jwt,
AbstractAuthenticationToken>
public class JwtAuthenticationConverter
extends Object
implements org.springframework.core.convert.converter.Converter<Jwt,AbstractAuthenticationToken>
- Since:
- 5.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<GrantedAuthority>
extractAuthorities
(Jwt jwt) Deprecated.Since 5.2.void
setJwtGrantedAuthoritiesConverter
(org.springframework.core.convert.converter.Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter) Sets theConverter<Jwt, Collection<GrantedAuthority>>
to use.void
setPrincipalClaimName
(String principalClaimName) Sets the principal claim name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.core.convert.converter.Converter
andThen
-
Constructor Details
-
JwtAuthenticationConverter
public JwtAuthenticationConverter()
-
-
Method Details
-
convert
- Specified by:
convert
in interfaceorg.springframework.core.convert.converter.Converter<Jwt,
AbstractAuthenticationToken>
-
extractAuthorities
Deprecated.Since 5.2. Use your own custom converter insteadExtracts theGrantedAuthority
s from scope attributes typically found in aJwt
- Parameters:
jwt
- The token- Returns:
- The collection of
GrantedAuthority
s found on the token - See Also:
-
setJwtGrantedAuthoritiesConverter
public void setJwtGrantedAuthoritiesConverter(org.springframework.core.convert.converter.Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter) Sets theConverter<Jwt, Collection<GrantedAuthority>>
to use. Defaults toJwtGrantedAuthoritiesConverter
.- Parameters:
jwtGrantedAuthoritiesConverter
- The converter- Since:
- 5.2
- See Also:
-
setPrincipalClaimName
Sets the principal claim name. Defaults toJwtClaimNames.SUB
.- Parameters:
principalClaimName
- The principal claim name- Since:
- 5.4
-