public interface 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.
|
Verification |
ignoreIssuedAt()
Skip the Issued At ("iat") date verification.
|
default 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.
|
Verification withIssuer(java.lang.String... issuer)
issuer
- the required Issuer value. If multiple values are given, the claim must at least match one of themVerification withSubject(java.lang.String subject)
subject
- the required Subject valueVerification withAudience(java.lang.String... audience)
withAnyOfAudience(String...)
, whichever one is configured last will
determine the audience validation behavior.audience
- the required Audience valuedefault Verification withAnyOfAudience(java.lang.String... audience)
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.audience
- the required Audience value for which the "aud" claim must contain at least one value.Verification acceptLeeway(long leeway) throws java.lang.IllegalArgumentException
leeway
- 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.Verification acceptExpiresAt(long leeway) throws java.lang.IllegalArgumentException
leeway
- the window in seconds in which the Expires At Claim will still be valid.java.lang.IllegalArgumentException
- if leeway is negative.Verification acceptNotBefore(long leeway) throws java.lang.IllegalArgumentException
leeway
- the window in seconds in which the Not Before Claim will still be valid.java.lang.IllegalArgumentException
- if leeway is negative.Verification acceptIssuedAt(long leeway) throws java.lang.IllegalArgumentException
acceptLeeway(long)
.
By default, the Issued At claim is always verified when the value is present, unless disabled with ignoreIssuedAt()
.
If Issued At verification has been disabled, no verification of the Issued At claim will be performed, and this method has no effect.leeway
- the window in seconds in which the Issued At Claim will still be valid.java.lang.IllegalArgumentException
- if leeway is negative.Verification withJWTId(java.lang.String jwtId)
jwtId
- the required Id valueVerification withClaimPresence(java.lang.String name) throws java.lang.IllegalArgumentException
name
- the Claim's name.java.lang.IllegalArgumentException
- if the name is null.Verification withClaim(java.lang.String name, java.lang.Boolean value) throws java.lang.IllegalArgumentException
name
- the Claim's name.value
- the Claim's value.java.lang.IllegalArgumentException
- if the name is null.Verification withClaim(java.lang.String name, java.lang.Integer value) throws java.lang.IllegalArgumentException
name
- the Claim's name.value
- the Claim's value.java.lang.IllegalArgumentException
- if the name is null.Verification withClaim(java.lang.String name, java.lang.Long value) throws java.lang.IllegalArgumentException
name
- the Claim's name.value
- the Claim's value.java.lang.IllegalArgumentException
- if the name is null.Verification withClaim(java.lang.String name, java.lang.Double value) throws java.lang.IllegalArgumentException
name
- the Claim's name.value
- the Claim's value.java.lang.IllegalArgumentException
- if the name is null.Verification withClaim(java.lang.String name, java.lang.String value) throws java.lang.IllegalArgumentException
name
- the Claim's name.value
- the Claim's value.java.lang.IllegalArgumentException
- if the name is null.Verification withClaim(java.lang.String name, java.util.Date value) throws java.lang.IllegalArgumentException
name
- the Claim's name.value
- the Claim's value.java.lang.IllegalArgumentException
- if the name is null.Verification withArrayClaim(java.lang.String name, java.lang.String... items) throws java.lang.IllegalArgumentException
name
- the Claim's name.items
- the items the Claim must contain.java.lang.IllegalArgumentException
- if the name is null.Verification withArrayClaim(java.lang.String name, java.lang.Integer... items) throws java.lang.IllegalArgumentException
name
- the Claim's name.items
- the items the Claim must contain.java.lang.IllegalArgumentException
- if the name is null.Verification withArrayClaim(java.lang.String name, java.lang.Long... items) throws java.lang.IllegalArgumentException
name
- the Claim's name.items
- the items the Claim must contain.java.lang.IllegalArgumentException
- if the name is null.Verification ignoreIssuedAt()
JWTVerifier build()