public static class JWTVerifier.BaseVerification extends java.lang.Object implements Verification
| Modifier and Type | Method and Description |
|---|---|
Verification |
acceptExpiresAt(long leeway)
Set a specific leeway window in seconds in which the Expires At ("exp") Claim will still be valid.
|
Verification |
acceptIssuedAt(long leeway)
Set a specific leeway window in seconds in which the Issued At ("iat") Claim will still be valid.
|
Verification |
acceptLeeway(long leeway)
Define the default window in seconds in which the Not Before, Issued At and Expires At Claims will still be valid.
|
Verification |
acceptNotBefore(long leeway)
Set a specific leeway window in seconds in which the Not Before ("nbf") Claim will still be valid.
|
JWTVerifier |
build()
Creates a new and reusable instance of the JWTVerifier with the configuration already provided.
|
JWTVerifier |
build(Clock clock)
Creates a new and reusable instance of the JWTVerifier with the configuration already provided.
|
Verification |
ignoreIssuedAt()
Skip the Issued At ("iat") date verification.
|
Verification |
withAnyOfAudience(java.lang.String... audience)
Require that the Audience ("aud") claim contain at least one of the specified audiences.
|
Verification |
withArrayClaim(java.lang.String name,
java.lang.Integer... items)
Require a specific Array Claim to contain at least the given items.
|
Verification |
withArrayClaim(java.lang.String name,
java.lang.Long... items)
Require a specific Array Claim to contain at least the given items.
|
Verification |
withArrayClaim(java.lang.String name,
java.lang.String... items)
Require a specific Array Claim to contain at least the given items.
|
Verification |
withAudience(java.lang.String... audience)
Require a specific Audience ("aud") claim.
|
Verification |
withClaim(java.lang.String name,
java.lang.Boolean value)
Require a specific Claim value.
|
Verification |
withClaim(java.lang.String name,
java.util.Date value)
Require a specific Claim value.
|
Verification |
withClaim(java.lang.String name,
java.lang.Double value)
Require a specific Claim value.
|
Verification |
withClaim(java.lang.String name,
java.lang.Integer value)
Require a specific Claim value.
|
Verification |
withClaim(java.lang.String name,
java.lang.Long value)
Require a specific Claim value.
|
Verification |
withClaim(java.lang.String name,
java.lang.String value)
Require a specific Claim value.
|
Verification |
withClaimPresence(java.lang.String name)
Require a claim to be present, with any value.
|
Verification |
withIssuer(java.lang.String... issuer)
Require a specific Issuer ("iss") claim.
|
Verification |
withJWTId(java.lang.String jwtId)
Require a specific JWT Id ("jti") claim.
|
Verification |
withSubject(java.lang.String subject)
Require a specific Subject ("sub") claim.
|
public Verification withIssuer(java.lang.String... issuer)
VerificationwithIssuer in interface Verificationissuer - the required Issuer value. If multiple values are given, the claim must at least match one of thempublic Verification withSubject(java.lang.String subject)
VerificationwithSubject in interface Verificationsubject - the required Subject valuepublic Verification withAudience(java.lang.String... audience)
VerificationVerification.withAnyOfAudience(String...), whichever one is configured last will
determine the audience validation behavior.withAudience in interface Verificationaudience - the required Audience valuepublic Verification withAnyOfAudience(java.lang.String... audience)
VerificationVerification.withAudience(String...), whichever one is configured last will
determine the audience validation behavior.
Note: This method was added after the interface was released.
It is defined as a default method for compatibility reasons.
From version 4.0 on, the method will be abstract and all implementations of this interface
will have to provide their own implementation.
The default implementation throws an UnsupportedOperationException.withAnyOfAudience in interface Verificationaudience - the required Audience value for which the "aud" claim must contain at least one value.public Verification acceptLeeway(long leeway) throws java.lang.IllegalArgumentException
VerificationacceptLeeway in interface Verificationleeway - the window in seconds in which the Not Before, Issued At and Expires At Claims will still be valid.java.lang.IllegalArgumentException - if leeway is negative.public Verification acceptExpiresAt(long leeway) throws java.lang.IllegalArgumentException
VerificationacceptExpiresAt in interface Verificationleeway - the window in seconds in which the Expires At Claim will still be valid.java.lang.IllegalArgumentException - if leeway is negative.public Verification acceptNotBefore(long leeway) throws java.lang.IllegalArgumentException
VerificationacceptNotBefore in interface Verificationleeway - the window in seconds in which the Not Before Claim will still be valid.java.lang.IllegalArgumentException - if leeway is negative.public Verification acceptIssuedAt(long leeway) throws java.lang.IllegalArgumentException
VerificationVerification.acceptLeeway(long).
By default, the Issued At claim is always verified when the value is present, unless disabled with Verification.ignoreIssuedAt().
If Issued At verification has been disabled, no verification of the Issued At claim will be performed, and this method has no effect.acceptIssuedAt in interface Verificationleeway - the window in seconds in which the Issued At Claim will still be valid.java.lang.IllegalArgumentException - if leeway is negative.public Verification ignoreIssuedAt()
VerificationignoreIssuedAt in interface Verificationpublic Verification withJWTId(java.lang.String jwtId)
VerificationwithJWTId in interface VerificationjwtId - the required Id valuepublic Verification withClaimPresence(java.lang.String name) throws java.lang.IllegalArgumentException
VerificationwithClaimPresence in interface Verificationname - the Claim's name.java.lang.IllegalArgumentException - if the name is null.public Verification withClaim(java.lang.String name, java.lang.Boolean value) throws java.lang.IllegalArgumentException
VerificationwithClaim in interface Verificationname - the Claim's name.value - the Claim's value.java.lang.IllegalArgumentException - if the name is null.public Verification withClaim(java.lang.String name, java.lang.Integer value) throws java.lang.IllegalArgumentException
VerificationwithClaim in interface Verificationname - the Claim's name.value - the Claim's value.java.lang.IllegalArgumentException - if the name is null.public Verification withClaim(java.lang.String name, java.lang.Long value) throws java.lang.IllegalArgumentException
VerificationwithClaim in interface Verificationname - the Claim's name.value - the Claim's value.java.lang.IllegalArgumentException - if the name is null.public Verification withClaim(java.lang.String name, java.lang.Double value) throws java.lang.IllegalArgumentException
VerificationwithClaim in interface Verificationname - the Claim's name.value - the Claim's value.java.lang.IllegalArgumentException - if the name is null.public Verification withClaim(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
VerificationwithClaim in interface Verificationname - the Claim's name.value - the Claim's value.java.lang.IllegalArgumentException - if the name is null.public Verification withClaim(java.lang.String name, java.util.Date value) throws java.lang.IllegalArgumentException
VerificationwithClaim in interface Verificationname - the Claim's name.value - the Claim's value.java.lang.IllegalArgumentException - if the name is null.public Verification withArrayClaim(java.lang.String name, java.lang.String... items) throws java.lang.IllegalArgumentException
VerificationwithArrayClaim in interface Verificationname - the Claim's name.items - the items the Claim must contain.java.lang.IllegalArgumentException - if the name is null.public Verification withArrayClaim(java.lang.String name, java.lang.Integer... items) throws java.lang.IllegalArgumentException
VerificationwithArrayClaim in interface Verificationname - the Claim's name.items - the items the Claim must contain.java.lang.IllegalArgumentException - if the name is null.public Verification withArrayClaim(java.lang.String name, java.lang.Long... items) throws java.lang.IllegalArgumentException
VerificationwithArrayClaim in interface Verificationname - the Claim's name.items - the items the Claim must contain.java.lang.IllegalArgumentException - if the name is null.public JWTVerifier build()
Verificationbuild in interface Verificationpublic JWTVerifier build(Clock clock)
clock - the instance that will handle the current time.