Package com.google.crypto.tink.jwt
Class JwtValidator
- java.lang.Object
-
- com.google.crypto.tink.jwt.JwtValidator
-
@Immutable public final class JwtValidator extends java.lang.ObjectDefines how the headers and claims of a JWT should be validated.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJwtValidator.BuilderBuilder for JwtValidator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JwtValidator.BuildernewBuilder()Returns a new JwtValidator.Builder.java.lang.StringtoString()Returns a brief description of a JwtValidator object.VerifiedJwtunsafeValidate(RawJwt target)Validates that all claims in this validator are also present intarget.
-
-
-
Method Detail
-
newBuilder
public static JwtValidator.Builder newBuilder()
Returns a new JwtValidator.Builder.By default, the JwtValidator requires that a token has a valid expiration claim, no issuer and no audience claim. This can be changed using the expect...(), ignore...() and allowMissingExpiration() methods.
If present, the JwtValidator also validates the not-before claim. The validation time can be changed using the setClock() method.
-
unsafeValidate
public VerifiedJwt unsafeValidate(RawJwt target) throws JwtInvalidException
Validates that all claims in this validator are also present intarget. IMPORTANT: although public, this class should only be used internally within Tink. Please preferJwtPublicKeyVerify.verifyAndDecode(java.lang.String, com.google.crypto.tink.jwt.JwtValidator)orJwtMac.verifyMacAndDecode(java.lang.String, com.google.crypto.tink.jwt.JwtValidator)instead.- Throws:
JwtInvalidException- whentargetcontains an invalid claim or header
-
toString
public java.lang.String toString()
Returns a brief description of a JwtValidator object. The exact details of the representation are unspecified and subject to change.- Overrides:
toStringin classjava.lang.Object
-
-