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 java.lang.Object implements org.springframework.core.convert.converter.Converter<Jwt,AbstractAuthenticationToken>
- Since:
- 5.1
-
-
Constructor Summary
Constructors Constructor Description JwtAuthenticationConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AbstractAuthenticationTokenconvert(Jwt jwt)protected java.util.Collection<GrantedAuthority>extractAuthorities(Jwt jwt)Deprecated.Since 5.2.voidsetJwtGrantedAuthoritiesConverter(org.springframework.core.convert.converter.Converter<Jwt,java.util.Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter)Sets theConverter<Jwt, Collection<GrantedAuthority>>to use.voidsetPrincipalClaimName(java.lang.String principalClaimName)Sets the principal claim name.
-
-
-
Method Detail
-
convert
public final AbstractAuthenticationToken convert(Jwt jwt)
- Specified by:
convertin interfaceorg.springframework.core.convert.converter.Converter<Jwt,AbstractAuthenticationToken>
-
extractAuthorities
@Deprecated protected java.util.Collection<GrantedAuthority> extractAuthorities(Jwt jwt)
Deprecated.Since 5.2. Use your own custom converter insteadExtracts theGrantedAuthoritys from scope attributes typically found in aJwt- Parameters:
jwt- The token- Returns:
- The collection of
GrantedAuthoritys found on the token - See Also:
JwtGrantedAuthoritiesConverter,setJwtGrantedAuthoritiesConverter(Converter)
-
setJwtGrantedAuthoritiesConverter
public void setJwtGrantedAuthoritiesConverter(org.springframework.core.convert.converter.Converter<Jwt,java.util.Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter)
Sets theConverter<Jwt, Collection<GrantedAuthority>>to use. Defaults toJwtGrantedAuthoritiesConverter.- Parameters:
jwtGrantedAuthoritiesConverter- The converter- Since:
- 5.2
- See Also:
JwtGrantedAuthoritiesConverter
-
setPrincipalClaimName
public void setPrincipalClaimName(java.lang.String principalClaimName)
Sets the principal claim name. Defaults toJwtClaimNames.SUB.- Parameters:
principalClaimName- The principal claim name- Since:
- 5.4
-
-