Class JwtValidators.AtJwtBuilder
java.lang.Object
org.springframework.security.oauth2.jwt.JwtValidators.AtJwtBuilder
- Enclosing class:
- JwtValidators
A class for building a validator that conforms to
RFC 9068.
To comply with this spec, this builder needs you to specify at least the
audience(java.lang.String), issuer(java.lang.String), and clientId(java.lang.String).
While building, the claims are keyed by claim name to allow for simplified lookup
and replacement in validators.
- Since:
- 6.5
-
Method Summary
Modifier and TypeMethodDescriptionValidate that each token has this audience.build()Build the validatorValidate that each token has this client_id.Validate that each token has this issuer.validators(Consumer<Map<String, OAuth2TokenValidator<Jwt>>> validators) Mutate the list of validators by claim name.
-
Method Details
-
issuer
Validate that each token has this issuer.- Parameters:
issuer- the required issuer- Returns:
- the
JwtValidators.AtJwtBuilderfor further configuration
-
audience
Validate that each token has this audience.- Parameters:
audience- the required audience- Returns:
- the
JwtValidators.AtJwtBuilderfor further configuration
-
clientId
Validate that each token has this client_id.- Parameters:
clientId- the client identifier to use- Returns:
- the
JwtValidators.AtJwtBuilderfor further configuration
-
validators
public JwtValidators.AtJwtBuilder validators(Consumer<Map<String, OAuth2TokenValidator<Jwt>>> validators) Mutate the list of validators by claim name.For example, to add a validator for azp do:
builder.validators((v) -> v.put("acr", myValidator()));A validator is required for all required RFC 9068 claims.
- Parameters:
validators- the mutator for the map of validators- Returns:
- the
JwtValidators.AtJwtBuilderfor further configuration
-
build
Build the validator- Returns:
- the RFC 9068 validator
-