Class JwtValidator.Builder
java.lang.Object
org.forgerock.openig.tools.jwt.validation.JwtValidator.Builder
- Enclosing class:
- JwtValidator
Builder for the JwtValidator.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theJwtValidator
.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.claims
(String key, JwtClaimConstraint<String> jwtClaimConstraint) Adds aJwtClaimConstraint
on a claim.claimSet
(String key, Function<Optional<JwtClaimsSet>, Optional<T>> adapter, JwtClaimConstraint<T> jwtClaimConstraint) Deprecated.since 2024.3.0, with OPENIG-8029.claimSet
(String key, Function<Optional<JwtClaimsSet>, Optional<T>> adapter, JwtClaimConstraint<T> jwtClaimConstraint, boolean optional) Adds aJwtClaimConstraint
on the claimSet.jwt
(JwtConstraint jwtConstraint) Adds aJwtConstraint
on the JWT.optionalClaim
(String key, JwtClaimConstraint<JsonValue> jwtClaimConstraint) Adds aJsonValue
basedJwtClaimConstraint
on an optional claim.<T,
E extends Exception>
JwtValidator.BuilderoptionalClaim
(String key, Function<JsonValue, ? extends T, E> transformer, JwtClaimConstraint<T> jwtClaimConstraint) Adds aJwtClaimConstraint
on an optional claim.optionalClaims
(String key, JwtClaimConstraint<String> jwtClaimConstraint) Adds aString
basedJwtClaimConstraint
on an optional claim.withSkewAllowance
(TemporalAmount skewAllowance) Specifies the skew allowance to use for temporal constraints validations.
-
Method Details
-
withSkewAllowance
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.
-
optionalClaim
public <T,E extends Exception> JwtValidator.Builder optionalClaim(String key, Function<JsonValue, ? extends T, E> transformer, JwtClaimConstraint<T> jwtClaimConstraint) Adds aJwtClaimConstraint
on an optional 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 optional claim.jwtClaimConstraint
- The constraint to apply.- Returns:
- This builder.
-
claim
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.
-
optionalClaim
public JwtValidator.Builder optionalClaim(String key, JwtClaimConstraint<JsonValue> jwtClaimConstraint) Adds aJsonValue
basedJwtClaimConstraint
on an optional claim.- Parameters:
key
- The claim's key or a pointer such forgerock/ssoToken, notnull
.jwtClaimConstraint
- The constraint to apply on the optional claim.- Returns:
- This builder.
-
claims
Adds aJwtClaimConstraint
on a claim.- Parameters:
key
- The claim's key.jwtClaimConstraint
- The constraint to apply on the claim.- Returns:
- This builder.
-
optionalClaims
public JwtValidator.Builder optionalClaims(String key, JwtClaimConstraint<String> jwtClaimConstraint) Adds aString
basedJwtClaimConstraint
on an optional claim.- Parameters:
key
- The claim's key.jwtClaimConstraint
- The constraint to apply on the optional claim.- Returns:
- This builder.
-
claimSet
@Deprecated(since="2024.3.0") public <T> JwtValidator.Builder claimSet(String key, Function<Optional<JwtClaimsSet>, Optional<T>> adapter, JwtClaimConstraint<T> jwtClaimConstraint) Deprecated.since 2024.3.0, with OPENIG-8029. UseclaimSet(String, java.util.function.Function, JwtClaimConstraint, boolean)
instead.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.
-
claimSet
public <T> JwtValidator.Builder claimSet(String key, Function<Optional<JwtClaimsSet>, Optional<T>> adapter, JwtClaimConstraint<T> jwtClaimConstraint, boolean optional) 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.optional
- Set to true to mark this as an optional claim.- Returns:
- This builder.
-
jwt
Adds aJwtConstraint
on the JWT.- Parameters:
jwtConstraint
- The constraint to apply on the JWT.- Returns:
- This builder.
-
build
Builds theJwtValidator
.- Returns:
- a new JwtValidator.
-