java.lang.Object
io.helidon.security.jwt.JwtValidator.Builder
- All Implemented Interfaces:
Builder<JwtValidator.Builder,
,JwtValidator> Supplier<JwtValidator>
- Enclosing interface:
JwtValidator
public static final class JwtValidator.Builder
extends Object
implements Builder<JwtValidator.Builder,JwtValidator>
Builder of the
JwtValidator
.-
Method Summary
Modifier and TypeMethodDescriptionaddAudienceValidator
(String expectedAudience) Add newAudienceValidator
with the expected audience.addAudienceValidator
(Consumer<AudienceValidator.Builder> builderConsumer) Add newAudienceValidator
instance based on the builder configuration.addAudienceValidator
(Set<String> expectedAudience) Add newAudienceValidator
with the expected audience.addClaimValidator
(ClaimValidator claimValidator) AddClaimValidator
instance.Add new "crit" claim validator.Add default time validators.addDefaultTimeValidators
(Instant now, Duration allowedTimeSkew, boolean mandatory) Add default time validators with specific time settings.Add newExpirationValidator
instance.addExpirationValidator
(Consumer<ExpirationValidator.Builder> builderConsumer) Add newExpirationValidator
instance based on the builder configuration.addFieldValidator
(Consumer<FieldValidator.Builder> builderConsumer) Add newFieldValidator
based on the builder configuration.addHeaderFieldValidator
(String claimKey, String fieldName, String expectedValue) Add newFieldValidator
of the header field.addIssuerValidator
(String expectedIssuer) Add new JWT issuer validator.addIssuerValidator
(String expectedIssuer, boolean mandatory) Add new JWT issuer validator.Add newIssueTimeValidator
instance.addIssueTimeValidator
(Consumer<IssueTimeValidator.Builder> builderConsumer) Add newIssueTimeValidator
instance based on the builder configuration.addMaxTokenAgeValidator
(Duration expectedMaxTokenAge) Add newMaxTokenAgeValidator
with the expected max token age.addMaxTokenAgeValidator
(Consumer<MaxTokenAgeValidator.Builder> builderConsumer) Add newMaxTokenAgeValidator
instance based on the builder configuration.Add newNotBeforeValidator
instance.addNotBeforeValidator
(Consumer<NotBeforeValidator.Builder> builderConsumer) Add newNotBeforeValidator
instance based on the builder configuration.addPayloadFieldValidator
(String claimKey, String fieldName, String expectedValue) Add newFieldValidator
of the payload field.Add newUserPrincipalValidator
.addUserPrincipalValidator
(Consumer<UserPrincipalValidator.Builder> builderConsumer) Add newUserPrincipalValidator
instance based on the builder configuration.addValidator
(JwtScope scope, Validator<Jwt> validator, String... claims) AddValidator
instance among the claim validators.addValidator
(Validator<Jwt> validator, String... claims) AddValidator
instance among the claim validators.build()
Build the instance from this builder.Clear all add validators.
-
Method Details
-
build
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<JwtValidator.Builder,
JwtValidator> - Returns:
- instance of the built type
-
addClaimValidator
AddClaimValidator
instance.- Parameters:
claimValidator
- claim validator to be added- Returns:
- updated builder instance
-
addValidator
AddValidator
instance among the claim validators. Default scope is set toJwtScope.PAYLOAD
.- Parameters:
validator
- to be addedclaims
- claims handled by the validator- Returns:
- updated builder instance
-
addValidator
public JwtValidator.Builder addValidator(JwtScope scope, Validator<Jwt> validator, String... claims) AddValidator
instance among the claim validators.- Parameters:
scope
- scope of the validatorvalidator
- to be addedclaims
- claims handled by the validator- Returns:
- updated builder instance
-
addHeaderFieldValidator
public JwtValidator.Builder addHeaderFieldValidator(String claimKey, String fieldName, String expectedValue) Add newFieldValidator
of the header field.- Parameters:
claimKey
- claim keyfieldName
- header field to be validatedexpectedValue
- expected value of the field- Returns:
- updated builder instance
-
addPayloadFieldValidator
public JwtValidator.Builder addPayloadFieldValidator(String claimKey, String fieldName, String expectedValue) Add newFieldValidator
of the payload field.- Parameters:
claimKey
- claim keyfieldName
- payload field to be validatedexpectedValue
- expected value of the field- Returns:
- updated builder instance
-
addFieldValidator
Add newFieldValidator
based on the builder configuration.- Parameters:
builderConsumer
- consumer of the builder- Returns:
- updated builder instance
-
addIssuerValidator
Add new JWT issuer validator. This issuer claim is set as mandatory to be present by default.- Parameters:
expectedIssuer
- expected JWT issuer- Returns:
- updated builder instance
-
addIssuerValidator
Add new JWT issuer validator.- Parameters:
expectedIssuer
- expected JWT issuermandatory
- whether this issuer claim is mandatory- Returns:
- updated builder instance
-
addDefaultTimeValidators
Add default time validators. This adds the following validators:- Returns:
- updated builder instance
-
addDefaultTimeValidators
public JwtValidator.Builder addDefaultTimeValidators(Instant now, Duration allowedTimeSkew, boolean mandatory) Add default time validators with specific time settings. This adds the following validators:- Parameters:
now
- time which is considered current time during the time validationallowedTimeSkew
- allowed time skewmandatory
- whether the time claims are mandatory to be present- Returns:
- updated builder instance
-
addExpirationValidator
Add newExpirationValidator
instance.- Returns:
- updated builder instance
-
addExpirationValidator
public JwtValidator.Builder addExpirationValidator(Consumer<ExpirationValidator.Builder> builderConsumer) Add newExpirationValidator
instance based on the builder configuration.- Parameters:
builderConsumer
- consumer of the builder- Returns:
- updated builder instance
-
addNotBeforeValidator
Add newNotBeforeValidator
instance.- Returns:
- updated builder instance
-
addNotBeforeValidator
public JwtValidator.Builder addNotBeforeValidator(Consumer<NotBeforeValidator.Builder> builderConsumer) Add newNotBeforeValidator
instance based on the builder configuration.- Parameters:
builderConsumer
- consumer of the builder- Returns:
- updated builder instance
-
addIssueTimeValidator
Add newIssueTimeValidator
instance.- Returns:
- updated builder instance
-
addIssueTimeValidator
public JwtValidator.Builder addIssueTimeValidator(Consumer<IssueTimeValidator.Builder> builderConsumer) Add newIssueTimeValidator
instance based on the builder configuration.- Parameters:
builderConsumer
- consumer of the builder- Returns:
- updated builder instance
-
addCriticalValidator
Add new "crit" claim validator. This validator behaves as mentioned in RFC 7515 - 4.1.11.- Returns:
- updated builder instance
- See Also:
-
addUserPrincipalValidator
Add newUserPrincipalValidator
. This validator is mandatory by default.- Returns:
- updated builder instance
-
addUserPrincipalValidator
public JwtValidator.Builder addUserPrincipalValidator(Consumer<UserPrincipalValidator.Builder> builderConsumer) Add newUserPrincipalValidator
instance based on the builder configuration. This validator is mandatory by default.- Parameters:
builderConsumer
- consumer of the builder- Returns:
- updated builder instance
-
addMaxTokenAgeValidator
Add newMaxTokenAgeValidator
with the expected max token age.- Parameters:
expectedMaxTokenAge
- expected max token age- Returns:
- updated builder instance
-
addMaxTokenAgeValidator
public JwtValidator.Builder addMaxTokenAgeValidator(Consumer<MaxTokenAgeValidator.Builder> builderConsumer) Add newMaxTokenAgeValidator
instance based on the builder configuration.- Parameters:
builderConsumer
- consumer of the builder- Returns:
- updated builder instance
-
addAudienceValidator
Add newAudienceValidator
with the expected audience. This validator is mandatory by default.- Parameters:
expectedAudience
- expected audience- Returns:
- updated builder instance
-
addAudienceValidator
Add newAudienceValidator
with the expected audience. This validator is mandatory by default.- Parameters:
expectedAudience
- expected audience- Returns:
- updated builder instance
-
addAudienceValidator
public JwtValidator.Builder addAudienceValidator(Consumer<AudienceValidator.Builder> builderConsumer) Add newAudienceValidator
instance based on the builder configuration. This validator is mandatory by default.- Parameters:
builderConsumer
- consumer of the builder- Returns:
- updated builder instance
-
clearValidators
Clear all add validators.- Returns:
- updated builder instance
-