getHeader |
JWT.getHeader( ) |
Return the JWS header for the JWS |
getPayload |
JWT.getPayload( ) |
Return payload as a string. |
getSignature |
JWT.getSignature( ) |
Return the signature for the JWS or JWT |
isSigned |
JWT.isSigned( ) |
Return true if the specified JWT compact string represents a signed JWS, false otherwise. |
verifyFileJWKSet |
JWT.verifyFileJWKSet( filename ) |
The public RSA keys to validate the signatures will be sourced from the
OAuth 2.0 server's JWK set, published at a well-known URL |
verifyFromKeyStore |
JWT.verifyFromKeyStore( keystore , password ) |
Validates the signature using a specified KeyStore location and password. |
verifyHMAC |
JWT.verifyHMAC( secret ) |
Verify HMAC signature with a specified SecretKey |
verifyInputStreamJWKSet |
JWT.verifyInputStreamJWKSet( is ) |
The public RSA keys to validate the signatures will be sourced from the
OAuth 2.0 server's JWK set, published at a well-known URL |
verifyPublicKey |
JWT.verifyPublicKey( publickKey ) |
Verify RSA signature with a specified PublicKey |
verifyRemoteJWKSet |
JWT.verifyRemoteJWKSet( url ) |
Verify the signature using the OAuth 2.0 server's JSON Web Key Set (JWKS) endpoint. |
JWT
represents a parsed JWT (JSON Web Token) Object.A JWT consists of three sections:
Header
The header consist of two parts:
Payload
The payload contains the data for the JWT. These are known as JWT Claims. The claims contain all the information regarding the JWT. Typically the JWT payload is in JSON format
Registered Claims
Registered claims are not mandatory but they are reserved names outline in RFC 7519, These include:
Public Claims
These are claims that are created, for example name, email etc..
An example payload:
Signature The third and final part of our JSON Web Token is going to be the signature. The signature is omitted if the algorithm in the header is set to none. The signature is created by signing the concatenated base64Encoded header and payload:
Example of a HS256 signature: