public static interface Assertions.Builder
Modifier and Type | Method and Description |
---|---|
Assertions |
build()
Creates a new assertions object using the configuration of this builder.
|
Assertions.Builder |
requireAudience(String audience,
String... otherAudiences)
Requires an claim whose value is equal to one of the
given audiences.
|
Assertions.Builder |
requireAudienceSatisfies(Predicate<List> condition,
Function<List,JWTAssertionFailedException> errorSupplier)
Requires an claim whose value satisfies the given
condition.
|
Assertions.Builder |
requireCertificateSubjectMatches(String subjectName)
Requires that the certificate associated with a public key that was
used to verify the signature has a subject name that exactly matches
the given subject name.
|
Assertions.Builder |
requireCertificateSubjectMatchesIssuer()
Requires that the certificate associated with a public key that was
used to verify the signature has a subject name that exactly matches
the value of the claim.
|
Assertions.Builder |
requireContains(String name,
Object value,
Object... otherValues)
Requires a named claim whose value is an array which contains one of the
given values.
|
Assertions.Builder |
requireEquals(String name,
Object value,
Object... otherValues)
Requires a named claim whose value is equal to one of the given values.
|
Assertions.Builder |
requireExpirationSatisfies(BiPredicate<Instant,Clock> condition,
BiFunction<Instant,Clock,JWTAssertionFailedException> errorSupplier)
Requires a claim whose value satisfies the specified
condition.
|
Assertions.Builder |
requireId()
Requires some non-empty value for the claim.
|
Assertions.Builder |
requireIdSatisfies(Predicate<String> condition,
Function<String,JWTAssertionFailedException> errorSupplier)
Requires a claim that satisfies the given condition.
|
Assertions.Builder |
requireInstantSatisfies(String name,
BiPredicate<Instant,Clock> condition,
BiFunction<Instant,Clock,JWTAssertionFailedException> errorSupplier)
Requires a named claim whose numeric value, interpreted as a quantity of
seconds from the epoch, satisfies a condition represented as bi-predicate
whose arguments are the given instant and a reference clock.
|
Assertions.Builder |
requireIssuedAtSatisfies(BiPredicate<Instant,Clock> condition,
BiFunction<Instant,Clock,JWTAssertionFailedException> errorSupplier)
Requires a claim whose value satisfies the specified
condition.
|
Assertions.Builder |
requireIssuer(String issuer,
String... otherIssuers)
Requires an claim whose value is equal to one of the
given issuers.
|
Assertions.Builder |
requireIssuerSatisfies(Predicate<String> condition,
Function<String,JWTAssertionFailedException> errorSupplier)
Requires a claim whose value satisfies the given
condition.
|
Assertions.Builder |
requireLifetimeNotExceeded(Duration lifetime)
Requires a claim whose value is after the current
time of a reference clock less the given lifetime duration.
|
Assertions.Builder |
requireNotExpired(Duration tolerance)
Requires an claim whose value is after the current
time of a reference clock, less the given tolerance to allow for clock
skew.
|
Assertions.Builder |
requirePublicKeyInfoSatisfies(Predicate<PublicKeyInfo> condition,
Function<PublicKeyInfo,JWTAssertionFailedException> errorSupplier)
Requires that the public key info for a public key used to verify the
signature satisfies the given condition.
|
Assertions.Builder |
requirePublicKeyInfoSatisfies(String name,
BiPredicate<String,PublicKeyInfo> condition,
BiFunction<String,PublicKeyInfo,JWTAssertionFailedException> errorSupplier)
Requires that the public key info for a public key used to verify the
signature satisfies the given condition.
|
<T> Assertions.Builder |
requireSatisfies(String name,
Class<? extends T> type,
Predicate<T> condition,
Function<T,JWTAssertionFailedException> errorSupplier)
Requires a named claim whose value satisfies the given condition.
|
Assertions.Builder |
requireSubject(String subject,
String... otherSubjects)
Requires a claim whose value is equal to one of the
given subjects.
|
Assertions.Builder |
requireSubjectSatisfies(Predicate<String> condition,
Function<String,JWTAssertionFailedException> errorSupplier)
Requires a claim whose value satisfies the given
condition.
|
Assertions.Builder requireId()
Assertions.Builder requireIdSatisfies(Predicate<String> condition, Function<String,JWTAssertionFailedException> errorSupplier)
condition
- a predicate to evaluate as the conditionerrorSupplier
- a function that supplies an exception describing
the condition that was not metAssertions.Builder requireLifetimeNotExceeded(Duration lifetime)
lifetime
- lifetime duration to allowAssertions.Builder requireIssuedAtSatisfies(BiPredicate<Instant,Clock> condition, BiFunction<Instant,Clock,JWTAssertionFailedException> errorSupplier)
condition
- a bi-predicate to evaluate as the conditionerrorSupplier
- a bi-function that supplies an exception describing
the condition that was not metAssertions.Builder requireNotExpired(Duration tolerance)
tolerance
- tolerance to allow for clock skewAssertions.Builder requireExpirationSatisfies(BiPredicate<Instant,Clock> condition, BiFunction<Instant,Clock,JWTAssertionFailedException> errorSupplier)
condition
- a bi-predicate to evaluate as the conditionerrorSupplier
- a bi-function that supplies an exception describing
the condition that was not metAssertions.Builder requireIssuer(String issuer, String... otherIssuers)
issuer
- issuer to matchotherIssuers
- other issuers to allowAssertions.Builder requireIssuerSatisfies(Predicate<String> condition, Function<String,JWTAssertionFailedException> errorSupplier)
condition
- predicate that represents the required conditionerrorSupplier
- a function that supplies an exception describing
the condition that was not metAssertions.Builder requireCertificateSubjectMatchesIssuer()
When matching the issuer name to the certificate subject, the common name (CN) component of the subject distinguished name, as well as any subject alternative names are considered.
Assertions.Builder requireCertificateSubjectMatches(String subjectName)
When matching the given name to the certificate subject, the common name (CN) component of the subject distinguished name, as well as any subject alternative names are considered.
subjectName
- the subject name to matchAssertions.Builder requireAudience(String audience, String... otherAudiences)
audience
- audience to matchotherAudiences
- other audiences to allowAssertions.Builder requireAudienceSatisfies(Predicate<List> condition, Function<List,JWTAssertionFailedException> errorSupplier)
condition
- predicate that represents the required conditionerrorSupplier
- a function that supplies an exception describing
the condition that was not metAssertions.Builder requireSubject(String subject, String... otherSubjects)
subject
- subject to matchotherSubjects
- other subjects to allowAssertions.Builder requireSubjectSatisfies(Predicate<String> condition, Function<String,JWTAssertionFailedException> errorSupplier)
condition
- predicate that represents the required conditionerrorSupplier
- a function that supplies an exception describing
the condition that was not metAssertions.Builder requireEquals(String name, Object value, Object... otherValues)
name
- name of the claim to testvalue
- value to matchotherValues
- other values to allowAssertions.Builder requireContains(String name, Object value, Object... otherValues)
name
- name of the claim to testvalue
- value to matchotherValues
- other values to allow<T> Assertions.Builder requireSatisfies(String name, Class<? extends T> type, Predicate<T> condition, Function<T,JWTAssertionFailedException> errorSupplier)
name
- name of the claim to testtype
- type to which the claim value will be coercedcondition
- predicate that represents the required conditionerrorSupplier
- a function that supplies an exception describing
the condition that was not metAssertions.Builder requireInstantSatisfies(String name, BiPredicate<Instant,Clock> condition, BiFunction<Instant,Clock,JWTAssertionFailedException> errorSupplier)
name
- name of the claim to testcondition
- bi-predicate that represents a condition to be
evaluated about an instant relative to a reference clockerrorSupplier
- a bi-function that supplies an exception describing
the condition that was not metAssertions.Builder requirePublicKeyInfoSatisfies(String name, BiPredicate<String,PublicKeyInfo> condition, BiFunction<String,PublicKeyInfo,JWTAssertionFailedException> errorSupplier)
name
- name of a string-valued claim to pass to the conditioncondition
- the condition to satisfyerrorSupplier
- a function that supplies an exception describing
the condition that was not metAssertions.Builder requirePublicKeyInfoSatisfies(Predicate<PublicKeyInfo> condition, Function<PublicKeyInfo,JWTAssertionFailedException> errorSupplier)
condition
- the condition to satisfyerrorSupplier
- a function that supplies an exception describing
the condition that was not metAssertions build()
Copyright © 2019. All rights reserved.