Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class JwtAuthenticationProvider
- Object
- JwtAuthenticationProvider
ImplementsAuthenticationProvider
Authenticates a bearer token by verifying it as a JWT.
A token the decoder refuses is an InvalidBearerTokenException carrying
the decoder’s reason, which the entry point sends back as invalid_token.
A token the decoder could not judge – the issuer’s keys could not be
fetched – is an AuthenticationServiceException: the server’s failure, and
not reported to the caller as a bad token.
Constructors
public JwtAuthenticationProvider(JwtDecoder jwtDecoder) |
Methods
public void setJwtAuthenticationConverter(Converter<Jwt, ? extends AbstractAuthenticationToken> jwtAuthenticationConverter) | What makes an authentication of a verified token; a JwtAuthenticationConverter unless set. |
public Authentication authenticate(Authentication authentication) | The accepted authentication, or null when this provider cannot decide and the next one should be asked. |
public boolean supports(Class<?> authentication) | Whether this provider checks tokens of this class. |
Inherited methods
Constructor details
JwtAuthenticationProvider
public JwtAuthenticationProvider(JwtDecoder jwtDecoder)Method details
setJwtAuthenticationConverter
public void setJwtAuthenticationConverter(Converter<Jwt, ? extends AbstractAuthenticationToken> jwtAuthenticationConverter)What makes an authentication of a verified token; a
JwtAuthenticationConverter unless set.authenticate
public Authentication authenticate(Authentication authentication)The accepted authentication, or null when this provider cannot decide and
the next one should be asked.
Throws
AuthenticationException- when the token is refused
supports
public boolean supports(Class<?> authentication)Whether this provider checks tokens of this class.