Class JwtValidator
- java.lang.Object
-
- org.forgerock.openig.tools.jwt.validation.JwtValidator
-
public final class JwtValidator extends Object
TheJwtValidator
is responsible for the JWT validation. Constraints could be applied using theBuilder
to several claims in order to verify the claim's value (expiration, presence, etc.). TheJwtValidator
is stateless and immutable therefore, it can be reused to apply the same set of constraints to anotherJwt
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JwtValidator.Builder
Builder for the JwtValidator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JwtValidator.Builder
builder(Clock clock)
Builder for the JwtValidator with a clock to use for temporal constraints.Promise<JwtValidatorResult,NeverThrowsException>
report(Jwt jwt)
Returns the result of the JWT validation and a list of any violations.Promise<JwtValidatorResult,NeverThrowsException>
report(Jwt jwt, Map<String,?> attributes)
Returns the result of the JWT validation and a list of any violations.
-
-
-
Method Detail
-
report
public Promise<JwtValidatorResult,NeverThrowsException> report(Jwt jwt)
Returns the result of the JWT validation and a list of any violations.- Parameters:
jwt
- The given JWT to analyze.- Returns:
- Promise of a
JwtValidatorResult
containing the list of anyViolation
s.
-
report
public Promise<JwtValidatorResult,NeverThrowsException> report(Jwt jwt, Map<String,?> attributes)
Returns the result of the JWT validation and a list of any violations.- Parameters:
jwt
- The given JWT to analyze.attributes
-Map
of additional context attributes.- Returns:
- Promise of a
JwtValidatorResult
containing the list of anyViolation
s.
-
builder
public static JwtValidator.Builder builder(Clock clock)
Builder for the JwtValidator with a clock to use for temporal constraints.- Parameters:
clock
- The clock to use for temporal constraints- Returns:
- a builder.
-
-