Class JwtAuthenticationConverter
java.lang.Object
com.codename1.backend.security.oauth2.server.resource.JwtAuthenticationConverter
- All Implemented Interfaces:
Converter<Jwt, AbstractAuthenticationToken>
public final class JwtAuthenticationConverter
extends Object
implements Converter<Jwt, AbstractAuthenticationToken>
Makes the JwtAuthenticationToken of a verified token: its authorities,
through a JwtGrantedAuthoritiesConverter unless another is set, and its
name, from the sub claim unless another is named.
JwtAuthenticationConverter converter = new JwtAuthenticationConverter();
converter.setPrincipalClaimName("preferred_username");
http.oauth2ResourceServer(o -> o.jwt(jwt -> jwt.jwtAuthenticationConverter(converter)));
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWhatsourcebecomes; null when it becomes nothing.voidsetJwtGrantedAuthoritiesConverter(Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter) What reads the authorities out of a token.voidsetPrincipalClaimName(String principalClaimName) The claimAuthentication.getName()answers with;subunless set.
-
Constructor Details
-
JwtAuthenticationConverter
public JwtAuthenticationConverter()
-
-
Method Details
-
setJwtGrantedAuthoritiesConverter
public void setJwtGrantedAuthoritiesConverter(Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter) What reads the authorities out of a token. -
setPrincipalClaimName
The claimAuthentication.getName()answers with;subunless set. -
convert
Description copied from interface:ConverterWhatsourcebecomes; null when it becomes nothing.- Specified by:
convertin interfaceConverter<Jwt, AbstractAuthenticationToken>
-