Package org.forgerock.openig.tools.jwt
Class JwtValidator.Builder
- java.lang.Object
-
- org.forgerock.openig.tools.jwt.JwtValidator.Builder
-
- Enclosing class:
- JwtValidator
public static class JwtValidator.Builder extends Object
Builder for the JwtValidator.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JwtValidator
build()
Builds theJwtValidator
.JwtValidator.Builder
claim(String key, JwtClaimConstraint<JsonValue> jwtClaimConstraint)
Adds aJwtClaimConstraint
on a claim.<T,E extends Exception>
JwtValidator.Builderclaim(String key, Function<JsonValue,? extends T,E> transformer, JwtClaimConstraint<T> jwtClaimConstraint)
Adds aJwtClaimConstraint
on a claim.JwtValidator.Builder
claims(String key, JwtClaimConstraint<String> jwtClaimConstraint)
Adds aJwtClaimConstraint
on a claim.<T> JwtValidator.Builder
claimSet(String key, Function<Optional<JwtClaimsSet>,Optional<T>> adapter, JwtClaimConstraint<T> jwtClaimConstraint)
Adds aJwtClaimConstraint
on the claimSet.JwtValidator.Builder
jwt(JwtConstraint jwtConstraint)
Adds aJwtConstraint
on the JWT.JwtValidator.Builder
withSkewAllowance(TemporalAmount skewAllowance)
Specifies the skew allowance to use for temporal constraints validations.
-
-
-
Method Detail
-
withSkewAllowance
public JwtValidator.Builder withSkewAllowance(TemporalAmount skewAllowance)
Specifies the skew allowance to use for temporal constraints validations.- Parameters:
skewAllowance
- The skew allowance to use for temporal constraints validations- Returns:
- This builder.
-
claim
public <T,E extends Exception> JwtValidator.Builder claim(String key, Function<JsonValue,? extends T,E> transformer, JwtClaimConstraint<T> jwtClaimConstraint)
Adds aJwtClaimConstraint
on a claim.- Type Parameters:
T
- The type of the jwtClaimConstraint.E
- The exception type.- Parameters:
key
- The claim's key.transformer
- The transformer function to apply to the claim.jwtClaimConstraint
- The constraint to apply.- Returns:
- This builder.
-
claim
public JwtValidator.Builder claim(String key, JwtClaimConstraint<JsonValue> jwtClaimConstraint)
Adds aJwtClaimConstraint
on a claim.- Parameters:
key
- The claim's key or a pointer such forgerock/ssoToken, notnull
.jwtClaimConstraint
- The constraint to apply on the claim.- Returns:
- This builder.
-
claims
public JwtValidator.Builder claims(String key, JwtClaimConstraint<String> jwtClaimConstraint)
Adds aJwtClaimConstraint
on a claim.- Parameters:
key
- The claim's key.jwtClaimConstraint
- The constraint to apply on the claim.- Returns:
- This builder.
-
claimSet
public <T> JwtValidator.Builder claimSet(String key, Function<Optional<JwtClaimsSet>,Optional<T>> adapter, JwtClaimConstraint<T> jwtClaimConstraint)
Adds aJwtClaimConstraint
on the claimSet.- Type Parameters:
T
- The type of result of the function.- Parameters:
key
- The name of the claim's key.adapter
- The adapter function to apply.jwtClaimConstraint
- The constraint to apply on the claimSet.- Returns:
- This builder.
-
jwt
public JwtValidator.Builder jwt(JwtConstraint jwtConstraint)
Adds aJwtConstraint
on the JWT.- Parameters:
jwtConstraint
- The constraint to apply on the JWT.- Returns:
- This builder.
-
build
public JwtValidator build()
Builds theJwtValidator
.- Returns:
- a new JwtValidator.
-
-