Package org.atmosphere.auth
Interface TokenValidator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
SPI for validating authentication tokens on Atmosphere connections.
Implementations are responsible for verifying tokens (JWT, opaque, session-based, etc.)
and returning structured results that the
AuthInterceptor
uses to allow, deny, or trigger refresh flows.
Usage
framework.interceptor(new AuthInterceptor(token -> {
var claims = myJwtLib.verify(token);
return new TokenValidator.Valid(claims.getSubject(), claims);
}));
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe token has expired but was otherwise valid.static final recordThe token is invalid (bad signature, malformed, revoked, etc.).static interfaceThe result of token validation.static final recordThe token is valid. -
Method Summary
Modifier and TypeMethodDescriptionValidate the given token string.
-
Method Details
-
validate
Validate the given token string.- Parameters:
token- the raw token extracted from the request (header or query param)- Returns:
- a
TokenValidator.Resultindicating the outcome
-