### JWT Verification Setup Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWT.html Initializes the token verification process by requiring a specific algorithm for signature validation. ```APIDOC ## require ### Description Returns a `Verification` builder with the algorithm to be used to validate token signature. ### Method Signature `static Verification require(Algorithm algorithm)` ### Parameters * `algorithm` (Algorithm) - The algorithm that will be used to verify the token's signature. ### Returns * `Verification` - A `Verification` builder. ### Throws * `IllegalArgumentException` - If the provided algorithm is null. ``` -------------------------------- ### Initialize and Use JWTVerifier Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/JWTVerifier.html Demonstrates how to initialize a JWTVerifier with an Algorithm and issuer, and then use it to verify a JWT token. Catches JWTVerificationException for invalid tokens. ```java try { JWTVerifier verifier = JWTVerifier.init(Algorithm.RSA256(publicKey, privateKey) .withIssuer("auth0") .build(); DecodedJWT jwt = verifier.verify("token"); } catch (JWTVerificationException e) { // invalid signature or claims } ``` -------------------------------- ### Get Algorithm Name Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Retrieves the standard name of the algorithm, as defined in the JWT specification (e.g., "HS256", "RS256"). ```APIDOC ## getName public String getName() ### Description Getter for the name of this Algorithm, as defined in the JWT Standard. i.e. "HS256" ### Returns the algorithm name. ``` -------------------------------- ### Get Signing Key ID Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Retrieves the Key ID (kid) of the Private Key used to sign the tokens. This is typically found in the `kid` claim within the JWT header. ```APIDOC ## getSigningKeyId public String getSigningKeyId() ### Description Getter for the Id of the Private Key used to sign the tokens. This is usually specified as the `kid` claim in the Header. ### Returns the Key Id that identifies the Signing Key or null if it's not specified. ``` -------------------------------- ### Build Verifier Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Create a JWT verifier instance with the configured options. ```APIDOC ## Build Verifier ### Description Creates a new and reusable instance of the JWTVerifier with the configuration already provided. ### Interface `com.auth0.jwt.interfaces.Verification` ### Methods - `build()`: Creates a new verifier instance. - `build(Clock clock)`: Creates a new verifier instance with a custom clock. ``` -------------------------------- ### ECDSA384 (KeyProvider) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA384withECDSA with an ECDSAKeyProvider. Tokens specify this as "ES384". ```APIDOC ## ECDSA384 public static Algorithm ECDSA384(ECDSAKeyProvider keyProvider) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA384withECDSA. Tokens specify this as "ES384". ### Parameters * `keyProvider` (ECDSAKeyProvider) - The provider of the Public Key and Private Key for the verify and signing instance. ### Returns A valid ECDSA384 Algorithm. ### Throws * `IllegalArgumentException` - if the Key Provider is null. ``` -------------------------------- ### Accessing JWT Claims Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/Payload.html The Payload interface allows retrieval of standard JWT claims like issuer, subject, audience, expiration, and issued at times. It also provides a way to get specific claims by name or all claims as a map. ```APIDOC ## Payload Interface Methods The Payload interface represents the claims section of a JWT. ### Methods * **`getIssuer()`**: Returns the value of the "iss" claim (Issuer). * **`getSubject()`**: Returns the value of the "sub" claim (Subject). * **`getAudience()`**: Returns a list of strings representing the "aud" claim (Audience). * **`getExpiresAt()`**: Returns a `Date` object for the "exp" claim (Expiration Time). * **`getExpiresAtAsInstant()`**: Returns an `Instant` object for the "exp" claim (Expiration Time). * **`getNotBefore()`**: Returns a `Date` object for the "nbf" claim (Not Before). * **`getNotBeforeAsInstant()`**: Returns an `Instant` object for the "nbf" claim (Not Before). * **`getIssuedAt()`**: Returns a `Date` object for the "iat" claim (Issued At). * **`getIssuedAtAsInstant()`**: Returns an `Instant` object for the "iat" claim (Issued At). * **`getId()`**: Returns the value of the "jti" claim (JWT ID). * **`getClaim(String name)`**: Retrieves a specific `Claim` object by its name. * **`getClaims()`**: Returns a `Map` of all claims present in the payload. ``` -------------------------------- ### build() Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html Creates a new and reusable instance of the JWTVerifier with the configuration already provided. This is the primary method for obtaining a verifier instance. ```APIDOC ### build public JWTVerifier build() Returns: a new `JWTVerifier` instance. ``` -------------------------------- ### None Algorithm Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Static factory method to create an Algorithm instance for the 'none' algorithm, which does not perform any signing or verification. ```APIDOC ## none ### Description Creates an Algorithm instance for the 'none' algorithm. ### Method Signature `static Algorithm none()` ``` -------------------------------- ### build Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/Verification.html Creates a new and reusable instance of the JWTVerifier with the configuration already provided. ```APIDOC ## build JWTVerifier build() ### Description Creates a new and reusable instance of the JWTVerifier with the configuration already provided. ### Returns a new `JWTVerifier` instance. ``` -------------------------------- ### ECDSA256 (KeyProvider) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA256withECDSA with an ECDSAKeyProvider. Tokens specify this as "ES256". ```APIDOC ## ECDSA256 public static Algorithm ECDSA256(ECDSAKeyProvider keyProvider) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA256withECDSA. Tokens specify this as "ES256". ### Parameters * `keyProvider` (ECDSAKeyProvider) - The provider of the Public Key and Private Key for the verify and signing instance. ### Returns A valid ECDSA256 Algorithm. ### Throws * `IllegalArgumentException` - if the Key Provider is null. ``` -------------------------------- ### ECDSA512 (KeyProvider) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA512withECDSA with an ECDSAKeyProvider. Tokens specify this as "ES512". ```APIDOC ## ECDSA512 public static Algorithm ECDSA512(ECDSAKeyProvider keyProvider) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA512withECDSA. Tokens specify this as "ES512". ### Parameters * `keyProvider` (ECDSAKeyProvider) - The provider of the Public Key and Private Key for the verify and signing instance. ### Returns A valid ECDSA512 Algorithm. ### Throws * `IllegalArgumentException` - if the Key Provider is null. ``` -------------------------------- ### ECDSAKeyProvider Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/allclasses-index.html Provides Elliptic Curve (EC) Public/Private Keys. ```APIDOC ## ECDSAKeyProvider ### Description Elliptic Curve (EC) Public/Private Key provider. ### Class ECDSAKeyProvider ``` -------------------------------- ### Algorithm Properties Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Methods to retrieve the name and signing key ID of the algorithm. ```APIDOC ## getName ### Description Getter for the name of this Algorithm, as defined in the JWT Standard. ### Method Signature `String getName()` ## getSigningKeyId ### Description Getter for the Id of the Private Key used to sign the tokens. ### Method Signature `String getSigningKeyId()` ``` -------------------------------- ### JWT Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Use the JWT class to create and sign new JSON Web Tokens. ```APIDOC ## JWT Creation ### Description Returns a Json Web Token builder used to create and sign tokens. ### Method ```java public static JWT.Builder create() ``` ``` -------------------------------- ### RSA384 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Provides methods to create an Algorithm instance for RSA384 signing and verification using different key configurations. ```APIDOC ## RSA384 public static Algorithm RSA384(RSAKeyProvider keyProvider) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA384withRSA. Tokens specify this as "RS384". ### Parameters * `keyProvider` - the provider of the Public Key and Private Key for the verify and signing instance. ### Returns a valid RSA384 Algorithm. ### Throws `IllegalArgumentException` - if the Key Provider is null. ## RSA384 public static Algorithm RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA384withRSA. Tokens specify this as "RS384". ### Parameters * `publicKey` - the key to use in the verify instance. * `privateKey` - the key to use in the signing instance. ### Returns a valid RSA384 Algorithm. ### Throws `IllegalArgumentException` - if both provided Keys are null. ## RSA384 public static Algorithm RSA384(RSAKey key) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA384withRSA. Tokens specify this as "RS384". ### Parameters * `key` - the key to use in the verify or signing instance. ### Returns a valid RSA384 Algorithm. ### Throws `IllegalArgumentException` - if the provided Key is null. ``` -------------------------------- ### RSA Algorithms Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Static factory methods to create Algorithm instances for RSA with SHA256, SHA384, and SHA512, supporting different key provider and key types. ```APIDOC ## RSA256 ### Description Creates a new Algorithm instance using SHA256withRSA. ### Method Signature `static Algorithm RSA256(RSAKeyProvider keyProvider)` `static Algorithm RSA256(RSAKey key)` `static Algorithm RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey)` ## RSA384 ### Description Creates a new Algorithm instance using SHA384withRSA. ### Method Signature `static Algorithm RSA384(RSAKeyProvider keyProvider)` `static Algorithm RSA384(RSAKey key)` `static Algorithm RSA384(RSAPublicKey publicKey, RSAPrivateKey privateKey)` ## RSA512 ### Description Creates a new Algorithm instance using SHA512withRSA. ### Method Signature `static Algorithm RSA512(RSAKeyProvider keyProvider)` `static Algorithm RSA512(RSAKey key)` `static Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey)` ``` -------------------------------- ### withClaim (Instant) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/Verification.html Verifies whether the claim is equal to the given Instant value. Note that date-time claims are serialized as seconds since the epoch; when verifying a date-time claim value, any time units more granular than seconds will not be considered. ```APIDOC ## withClaim default Verification withClaim(String name, Instant value) throws IllegalArgumentException ### Description Verifies whether the claim is equal to the given Instant value. Note that date-time claims are serialized as seconds since the epoch; when verifying a date-time claim value, any time units more granular than seconds will not be considered. ### Parameters #### Path Parameters * **name** (String) - Required - The Claim's name. * **value** (Instant) - Required - The Claim's value. ### Throws * `IllegalArgumentException` - if the name is `null`. ### Returns this same Verification instance. ``` -------------------------------- ### JWTVerifier.BaseVerification Utility Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html Utility methods for fetching leeway settings. ```APIDOC ## getLeewayFor ### Description Fetches the Leeway set for claim or returns the `defaultLeeway`. ### Method long getLeewayFor(String name) ``` -------------------------------- ### JWTVerifier.BaseVerification Build Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html Methods to build a JWTVerifier instance based on the configured verification rules. ```APIDOC ## build ### Description Creates a new and reusable instance of the JWTVerifier with the configuration already provided. ### Method JWTVerifier build() JWTVerifier build(Clock clock) ``` -------------------------------- ### withClaim (Instant) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html Verifies whether the claim is equal to the given Instant value. ```APIDOC ## withClaim (Instant) ### Description Verifies whether the claim is equal to the given Instant value. ### Method public Verification withClaim(String name, Instant value) throws IllegalArgumentException ### Parameters #### Path Parameters - **name** (String) - Required - the Claim's name. - **value** (Instant) - Required - the Claim's value. ### Throws `IllegalArgumentException` - if the name is `null`. ### Returns this same Verification instance. ``` -------------------------------- ### RSAKeyProvider Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/allclasses-index.html Provides RSA Public/Private Keys. ```APIDOC ## RSAKeyProvider ### Description RSA Public/Private Key provider. ### Class RSAKeyProvider ``` -------------------------------- ### RSA Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Provides static methods to create RSA algorithm instances for JWT signing and verification. ```APIDOC ## RSA256(RSAKeyProvider) ### Description Creates a new Algorithm instance using SHA256withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **keyProvider** (RSAKeyProvider) - The RSA key provider. ``` ```APIDOC ## RSA256(RSAKey) ### Description Creates a new Algorithm instance using SHA256withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **key** (RSAKey) - The RSA key. ``` ```APIDOC ## RSA256(RSAPublicKey, RSAPrivateKey) ### Description Creates a new Algorithm instance using SHA256withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **publicKey** (RSAPublicKey) - The RSA public key. - **privateKey** (RSAPrivateKey) - The RSA private key. ``` ```APIDOC ## RSA384(RSAKeyProvider) ### Description Creates a new Algorithm instance using SHA384withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **keyProvider** (RSAKeyProvider) - The RSA key provider. ``` ```APIDOC ## RSA384(RSAKey) ### Description Creates a new Algorithm instance using SHA384withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **key** (RSAKey) - The RSA key. ``` ```APIDOC ## RSA384(RSAPublicKey, RSAPrivateKey) ### Description Creates a new Algorithm instance using SHA384withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **publicKey** (RSAPublicKey) - The RSA public key. - **privateKey** (RSAPrivateKey) - The RSA private key. ``` ```APIDOC ## RSA512(RSAKeyProvider) ### Description Creates a new Algorithm instance using SHA512withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **keyProvider** (RSAKeyProvider) - The RSA key provider. ``` ```APIDOC ## RSA512(RSAKey) ### Description Creates a new Algorithm instance using SHA512withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **key** (RSAKey) - The RSA key. ``` ```APIDOC ## RSA512(RSAPublicKey, RSAPrivateKey) ### Description Creates a new Algorithm instance using SHA512withRSA. ### Method Static method ### Class com.auth0.jwt.algorithms.Algorithm ### Parameters - **publicKey** (RSAPublicKey) - The RSA public key. - **privateKey** (RSAPrivateKey) - The RSA private key. ``` -------------------------------- ### ECDSA384 (PublicKey, PrivateKey) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA384withECDSA with separate Public and Private keys. Tokens specify this as "ES384". ```APIDOC ## ECDSA384 public static Algorithm ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA384withECDSA. Tokens specify this as "ES384". ### Parameters * `publicKey` (ECPublicKey) - The key to use in the verify instance. * `privateKey` (ECPrivateKey) - The key to use in the signing instance. ### Returns A valid ECDSA384 Algorithm. ### Throws * `IllegalArgumentException` - if the provided Key is null. ``` -------------------------------- ### ECDSAKeyProvider Interface Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/package-summary.html Elliptic Curve (EC) Public/Private Key provider interface. ```APIDOC ## Interface: ECDSAKeyProvider ### Description Elliptic Curve (EC) Public/Private Key provider. ### Methods (No methods are explicitly documented in the source for direct user invocation.) ``` -------------------------------- ### RSA512 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Provides methods to create an Algorithm instance for RSA512 signing and verification using different key configurations. ```APIDOC ## RSA512 public static Algorithm RSA512(RSAKeyProvider keyProvider) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA512withRSA. Tokens specify this as "RS512". ### Parameters * `keyProvider` - the provider of the Public Key and Private Key for the verify and signing instance. ### Returns a valid RSA512 Algorithm. ### Throws `IllegalArgumentException` - if the Key Provider is null. ## RSA512 public static Algorithm RSA512(RSAPublicKey publicKey, RSAPrivateKey privateKey) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA512withRSA. Tokens specify this as "RS512". ### Parameters * `publicKey` - the key to use in the verify instance. * `privateKey` - the key to use in the signing instance. ### Returns a valid RSA512 Algorithm. ### Throws `IllegalArgumentException` - if both provided Keys are null. ## RSA512 public static Algorithm RSA512(RSAKey key) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA512withRSA. Tokens specify this as "RS512". ### Parameters * `key` - the key to use in the verify or signing instance. ### Returns a valid RSA512 Algorithm. ### Throws `IllegalArgumentException` - if the provided Key is null. ``` -------------------------------- ### RSAKeyProvider Interface Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/package-summary.html RSA Public/Private Key provider interface. ```APIDOC ## Interface: RSAKeyProvider ### Description RSA Public/Private Key provider. ### Methods (No methods are explicitly documented in the source for direct user invocation.) ``` -------------------------------- ### build(Clock clock) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html Creates a new and reusable instance of the JWTVerifier with the configuration already provided. This overload is intended for test purposes only, allowing for custom time handling. ```APIDOC ### build public JWTVerifier build(Clock clock) Parameters: `clock` - the instance that will handle the current time. Returns: a new JWTVerifier instance with a custom `Clock`. ``` -------------------------------- ### JWT Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWT.html Provides a builder to create and sign new JSON Web Tokens. ```APIDOC ## create ### Description Returns a Json Web Token builder used to create and sign tokens. ### Method Signature `static JWTCreator.Builder create()` ### Returns * `JWTCreator.Builder` - A token builder instance. ``` -------------------------------- ### ECDSA384 (ECKey) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA384withECDSA with an ECKey. Tokens specify this as "ES384". ```APIDOC ## ECDSA384 public static Algorithm ECDSA384(ECKey key) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA384withECDSA. Tokens specify this as "ES384". ### Parameters * `key` (ECKey) - The key to use in the verify or signing instance. ### Returns A valid ECDSA384 Algorithm. ### Throws * `IllegalArgumentException` - if the provided Key is null. ``` -------------------------------- ### AlgorithmMismatchException Constructor Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/exceptions/AlgorithmMismatchException.html Constructs a new AlgorithmMismatchException with the specified detail message. ```APIDOC ## AlgorithmMismatchException(String message) ### Description Constructs a new AlgorithmMismatchException with the specified detail message. ### Parameters #### Path Parameters - **message** (String) - Required - The detail message. ``` -------------------------------- ### HMAC384 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Provides static methods to create Algorithm instances for HmacSHA384 using byte arrays or strings. ```APIDOC ## HMAC384(byte[]) Static method in class com.auth0.jwt.algorithms.Algorithm Creates a new Algorithm instance using HmacSHA384. ## HMAC384(String) Static method in class com.auth0.jwt.algorithms.Algorithm Creates a new Algorithm instance using HmacSHA384. ``` -------------------------------- ### withClaim(String name, Instant value) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html Verifies whether a claim is equal to the given Instant value. Date-time claims are serialized as seconds since the epoch, and any time units more granular than seconds will not be considered. ```APIDOC ### withClaim public Verification withClaim(String name, Instant value) Parameters: `name` - the Claim's name. `value` - the Claim's value. Returns: this same Verification instance. Throws: `IllegalArgumentException` - if the name is `null`. ``` -------------------------------- ### Verify JWT by String Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/JWTVerifier.html Performs the verification against the given Token string. Throws JWTVerificationException if verification fails. ```APIDOC ## verify(String token) ### Description Performs the verification against the given Token. ### Method DecodedJWT verify(String token) ### Parameters * `token` (String) - The token to verify. ### Returns * `DecodedJWT` - A verified and decoded JWT. ### Throws * `JWTVerificationException` - If any of the verification steps fail. ``` -------------------------------- ### RSA256 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Provides methods to create an Algorithm instance for RSA256 signing and verification using different key configurations. ```APIDOC ## RSA256 public static Algorithm RSA256(RSAKeyProvider keyProvider) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA256withRSA. Tokens specify this as "RS256". ### Parameters * `keyProvider` - the provider of the Public Key and Private Key for the verify and signing instance. ### Returns a valid RSA256 Algorithm. ### Throws `IllegalArgumentException` - if the provided Key is null. ## RSA256 public static Algorithm RSA256(RSAPublicKey publicKey, RSAPrivateKey privateKey) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA256withRSA. Tokens specify this as "RS256". ### Parameters * `publicKey` - the key to use in the verify instance. * `privateKey` - the key to use in the signing instance. ### Returns a valid RSA256 Algorithm. ### Throws `IllegalArgumentException` - if both provided Keys are null. ## RSA256 public static Algorithm RSA256(RSAKey key) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA256withRSA. Tokens specify this as "RS256". ### Parameters * `key` - the key to use in the verify or signing instance. ### Returns a valid RSA256 Algorithm. ### Throws `IllegalArgumentException` - if the Key Provider is null. ``` -------------------------------- ### JWTCreationException Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/allclasses-index.html Exception thrown when a JWT cannot be created. ```APIDOC ## JWTCreationException ### Description The exception is thrown when a JWT cannot be created. ### Class JWTCreationException ``` -------------------------------- ### RSAKeyProvider Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/RSAKeyProvider.html This interface defines methods for retrieving RSA private and public keys and their associated IDs, used in JWT operations. ```APIDOC ## Interface: RSAKeyProvider RSA Public/Private Key provider. ### Methods * **RSAPublicKey getPublicKeyById(String keyId)** Getter for the Public Key instance with the given Id. Used to verify the signature on the JWT verification stage. * **Parameters:** * `keyId` (String) - The Key Id specified in the Token's Header or null if none is available. Provides a hint on which Public Key to use to verify the token's signature. * **Returns:** RSAPublicKey - The Public Key instance. * **RSAPrivateKey getPrivateKey()** Getter for the Private Key instance. Used to sign the content on the JWT signing stage. * **Returns:** RSAPrivateKey - The Private Key instance. * **String getPrivateKeyId()** Getter for the Id of the Private Key used to sign the tokens. This represents the `kid` claim and will be placed in the Header. * **Returns:** String - The Key Id that identifies the Private Key or null if it's not specified. ``` -------------------------------- ### JWTCreationException Constructor Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/exceptions/JWTCreationException.html Constructs a new JWTCreationException with the specified detail message and cause. ```APIDOC ## JWTCreationException(String message, Throwable cause) ### Description Constructs a new JWTCreationException with the specified detail message and cause. ### Constructor `public JWTCreationException(String message, Throwable cause)` ``` -------------------------------- ### Algorithm.verify(DecodedJWT) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Verify the given token using this Algorithm instance. ```APIDOC ## Algorithm.verify(DecodedJWT) ### Description Verify the given token using this Algorithm instance. ### Method N/A (Method Signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response N/A #### Response Example None ``` -------------------------------- ### ECDSA Algorithms Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Static factory methods to create Algorithm instances for ECDSA with SHA256, SHA384, and SHA512, supporting different key provider and key types. ```APIDOC ## ECDSA256 ### Description Creates a new Algorithm instance using SHA256withECDSA. ### Method Signature `static Algorithm ECDSA256(ECDSAKeyProvider keyProvider)` `static Algorithm ECDSA256(ECKey key)` `static Algorithm ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey)` ## ECDSA384 ### Description Creates a new Algorithm instance using SHA384withECDSA. ### Method Signature `static Algorithm ECDSA384(ECDSAKeyProvider keyProvider)` `static Algorithm ECDSA384(ECKey key)` `static Algorithm ECDSA384(ECPublicKey publicKey, ECPrivateKey privateKey)` ## ECDSA512 ### Description Creates a new Algorithm instance using SHA512withECDSA. ### Method Signature `static Algorithm ECDSA512(ECDSAKeyProvider keyProvider)` `static Algorithm ECDSA512(ECKey key)` `static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey)` ``` -------------------------------- ### Signing and Verification Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Methods for signing content and verifying JWTs using the configured algorithm. ```APIDOC ## sign ### Description Sign the given content using this Algorithm instance. ### Method Signature `byte[] sign(byte[] contentBytes)` `byte[] sign(byte[] headerBytes, byte[] payloadBytes)` ## verify ### Description Verify the given token using this Algorithm instance. ### Method Signature `void verify(DecodedJWT jwt)` ``` -------------------------------- ### JWTVerifier.verify(String) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Performs the verification against the given Token. ```APIDOC ## JWTVerifier.verify(String) ### Description Performs the verification against the given Token. ### Method N/A (Method Signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response N/A #### Response Example None ``` -------------------------------- ### None Algorithm Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates an Algorithm instance that does not perform any cryptographic operation. This is generally not recommended for production environments. ```APIDOC ## none public static Algorithm none() ### Description Creates an Algorithm instance that does not perform any cryptographic operation. This is generally not recommended for production environments. ``` -------------------------------- ### JWT Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Provides functionality to create and sign JWTs. ```APIDOC ## JWT() Constructor for class com.auth0.jwt.JWT Constructs a new instance of the JWT library. ## JWTCreator Class in com.auth0.jwt The JWTCreator class holds the sign method to generate a complete JWT (with Signature) from a given Header and Payload content. ## JWTCreator.Builder Class in com.auth0.jwt The Builder class holds the Claims that defines the JWT to be created. ``` -------------------------------- ### HMAC384 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Provides a method to create an Algorithm instance for HMAC384 signing and verification using a secret. ```APIDOC ## HMAC384 public static Algorithm HMAC384(String secret) throws IllegalArgumentException ### Description Creates a new Algorithm instance using HmacSHA384. Tokens specify this as "HS384". ### Parameters * `secret` - the secret bytes to use in the verify or signing instance. Ensure the length of the secret is at least 384 bit long ### Returns a valid HMAC384 Algorithm. ### Throws `IllegalArgumentException` - if the provided Secret is null. ``` -------------------------------- ### HMAC Algorithms Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Static factory methods to create Algorithm instances for HMAC-SHA256, HMAC-SHA384, and HMAC-SHA512 using either a String or byte array secret. ```APIDOC ## HMAC256 ### Description Creates a new Algorithm instance using HmacSHA256. ### Method Signature `static Algorithm HMAC256(byte[] secret)` `static Algorithm HMAC256(String secret)` ## HMAC384 ### Description Creates a new Algorithm instance using HmacSHA384. ### Method Signature `static Algorithm HMAC384(byte[] secret)` `static Algorithm HMAC384(String secret)` ## HMAC512 ### Description Creates a new Algorithm instance using HmacSHA512. ### Method Signature `static Algorithm HMAC512(byte[] secret)` `static Algorithm HMAC512(String secret)` ``` -------------------------------- ### Header Parameters Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/package-summary.html Contains constants for JWT header parameter names. ```APIDOC ## HeaderParams ### Description Contains constants representing the JWT header parameter names. ``` -------------------------------- ### JWTVerifier.BaseVerification Configuration Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html These methods allow configuration of leeway for various claims and skipping verification for specific claims. ```APIDOC ## acceptExpiresAt ### Description Set a specific leeway window in seconds in which the Expires At ("exp") Claim will still be valid. ### Method Verification acceptExpiresAt(long leeway) ## acceptIssuedAt ### Description Set a specific leeway window in seconds in which the Issued At ("iat") Claim will still be valid. ### Method Verification acceptIssuedAt(long leeway) ## acceptLeeway ### Description Define the default window in seconds in which the Not Before, Issued At and Expires At Claims will still be valid. ### Method Verification acceptLeeway(long leeway) ## acceptNotBefore ### Description Set a specific leeway window in seconds in which the Not Before ("nbf") Claim will still be valid. ### Method Verification acceptNotBefore(long leeway) ## ignoreIssuedAt ### Description Skip the Issued At ("iat") claim verification. ### Method Verification ignoreIssuedAt() ``` -------------------------------- ### KeyProvider Interface Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/package-tree.html Abstract interface for providing keys used in JWT operations. ```APIDOC ## Interface com.auth0.jwt.interfaces.KeyProvider ### Description An interface for providing cryptographic keys used in JWT signing and verification. This is a generic interface. ### Methods * `getPublicKey(String)`: Retrieves the public key based on the provided identifier. * `getPrivateKey(String)`: Retrieves the private key based on the provided identifier. ``` -------------------------------- ### withClaim (Date) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.BaseVerification.html Verifies whether the claim is equal to the given Date value. Note that date-time claims are serialized as seconds since the epoch; when verifying date-time claim value, any time units more granular than seconds will not be considered. ```APIDOC ## withClaim (Date) ### Description Verifies whether the claim is equal to the given Date value. Note that date-time claims are serialized as seconds since the epoch; when verifying date-time claim value, any time units more granular than seconds will not be considered. ### Method public Verification withClaim(String name, Date value) throws IllegalArgumentException ### Parameters #### Path Parameters - **name** (String) - Required - the Claim's name. - **value** (Date) - Required - the Claim's value. ### Throws `IllegalArgumentException` - if the name is `null`. ### Returns this same Verification instance. ``` -------------------------------- ### Verify JWT by String Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/JWTVerifier.html Performs verification against a given JWT token string. Throws JWTVerificationException if verification fails. ```java DecodedJWT verify(String token) throws JWTVerificationException ``` -------------------------------- ### ECDSA256 (PublicKey, PrivateKey) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA256withECDSA with separate Public and Private keys. Tokens specify this as "ES256". ```APIDOC ## ECDSA256 public static Algorithm ECDSA256(ECPublicKey publicKey, ECPrivateKey privateKey) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA256withECDSA. Tokens specify this as "ES256". ### Parameters * `publicKey` (ECPublicKey) - The key to use in the verify instance. * `privateKey` (ECPrivateKey) - The key to use in the signing instance. ### Returns A valid ECDSA256 Algorithm. ### Throws * `IllegalArgumentException` - if the provided Key is null. ``` -------------------------------- ### ECDSA512 (PublicKey, PrivateKey) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA512withECDSA with separate Public and Private keys. Tokens specify this as "ES512". ```APIDOC ## ECDSA512 public static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA512withECDSA. Tokens specify this as "ES512". ### Parameters * `publicKey` (ECPublicKey) - The key to use in the verify instance. * `privateKey` (ECPrivateKey) - The key to use in the signing instance. ### Returns A valid ECDSA512 Algorithm. ### Throws * `IllegalArgumentException` - if the provided Key is null. ``` -------------------------------- ### ECDSA384 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Creates a new Algorithm instance using SHA384withECDSA with different key providers. ```APIDOC ## ECDSA384(ECDSAKeyProvider) ### Description Creates a new Algorithm instance using SHA384withECDSA. ### Method Static method in class com.auth0.jwt.algorithms.Algorithm ## ECDSA384(ECKey) ### Description Creates a new Algorithm instance using SHA384withECDSA. ### Method Static method in class com.auth0.jwt.algorithms.Algorithm ## ECDSA384(ECPublicKey, ECPrivateKey) ### Description Creates a new Algorithm instance using SHA384withECDSA. ### Method Static method in class com.auth0.jwt.algorithms.Algorithm ``` -------------------------------- ### HMAC512 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Provides static methods to create Algorithm instances for HmacSHA512 using byte arrays or strings. ```APIDOC ## HMAC512(byte[]) Static method in class com.auth0.jwt.algorithms.Algorithm Creates a new Algorithm instance using HmacSHA512. ## HMAC512(String) Static method in class com.auth0.jwt.algorithms.Algorithm Creates a new Algorithm instance using HmacSHA512. ``` -------------------------------- ### JWT Creation and General Exceptions Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/exceptions/package-summary.html These exceptions cover issues encountered during the creation of a JWT or general problems with JWT formatting and decoding. ```APIDOC ## JWTCreationException ### Description The exception that is thrown when a JWT cannot be created. ## JWTDecodeException ### Description The exception that is thrown when any part of the token contained an invalid JWT or JSON format. ## SignatureGenerationException ### Description The exception that is thrown when a signature is not able to be generated. ``` -------------------------------- ### MissingClaimException Constructor Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/exceptions/MissingClaimException.html Initializes a new instance of the MissingClaimException class with the specified claim name. ```APIDOC ## MissingClaimException Constructor ### Description Initializes a new instance of the `MissingClaimException` class. ### Signature `public MissingClaimException(String claimName)` ### Parameters * **claimName** (String) - The name of the missing claim. ``` -------------------------------- ### RSAKeyProvider Interface Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/package-tree.html Provides keys for RSA (Rivest–Shamir–Adleman) operations. ```APIDOC ## Interface com.auth0.jwt.interfaces.RSAKeyProvider ### Description Extends `KeyProvider` to specifically handle keys for RSA algorithms. ### Methods * `getPublicKey()`: Returns the RSA public key. * `getPrivateKey()`: Returns the RSA private key. ``` -------------------------------- ### verify(String token) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/JWTVerifier.html Performs verification on a JWT token string. It checks the token's format, signature, and claims against the verifier's configuration. Throws various JWTVerificationException subclasses if verification fails. ```APIDOC ## verify(String token) ### Description Perform the verification against the given Token, using any previous configured options. ### Method public DecodedJWT verify(String token) ### Parameters #### Path Parameters - **token** (String) - The JWT token string to verify. ### Returns - **DecodedJWT** - A verified and decoded JWT object. ### Throws - **AlgorithmMismatchException** - if the algorithm stated in the token's header is not equal to the one defined in the JWTVerifier. - **SignatureVerificationException** - if the signature is invalid. - **TokenExpiredException** - if the token has expired. - **MissingClaimException** - if a claim to be verified is missing. - **IncorrectClaimException** - if a claim contained a different value than the expected one. - **JWTVerificationException** - if any of the verification steps fail ``` -------------------------------- ### JWTDecodeException Constructors Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/exceptions/JWTDecodeException.html Provides constructors for creating JWTDecodeException instances. ```APIDOC ## JWTDecodeException Constructors ### `JWTDecodeException(String message)` Creates a new JWTDecodeException with the specified detail message. ### `JWTDecodeException(String message, Throwable cause)` Creates a new JWTDecodeException with the specified detail message and cause. ``` -------------------------------- ### JWTVerifier.BaseVerification Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/allclasses-index.html An implementation that accepts expected claim values and builds a JWTVerifier. ```APIDOC ## JWTVerifier.BaseVerification ### Description `Verification` implementation that accepts all the expected Claim values for verification, and builds a `JWTVerifier` used to verify a JWT's signature and expected claims. ### Class JWTVerifier.BaseVerification ``` -------------------------------- ### ECDSA256 (ECKey) Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/algorithms/Algorithm.html Creates a new Algorithm instance using SHA256withECDSA with an ECKey. Tokens specify this as "ES256". ```APIDOC ## ECDSA256 public static Algorithm ECDSA256(ECKey key) throws IllegalArgumentException ### Description Creates a new Algorithm instance using SHA256withECDSA. Tokens specify this as "ES256". ### Parameters * `key` (ECKey) - The key to use in the verify or signing instance. ### Returns A valid ECDSA256 Algorithm. ### Throws * `IllegalArgumentException` - if the provided Key is null. ``` -------------------------------- ### Key Provider Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Methods for key providers used in JWT signing and verification. ```APIDOC ## getPrivateKey() ### Description Getter for the Private Key instance. ### Method Getter ### Endpoint N/A (Method) ### Parameters None ### Request Example None ### Response #### Success Response - **PrivateKey** - The private key. ## getPrivateKeyId() ### Description Getter for the Id of the Private Key used to sign the tokens. ### Method Getter ### Endpoint N/A (Method) ### Parameters None ### Request Example None ### Response #### Success Response - **String** - The ID of the private key. ## getPublicKeyById(String) ### Description Getter for the Public Key instance with the given Id. ### Method Getter ### Endpoint N/A (Method) ### Parameters #### Path Parameters - **keyId** (String) - Required - The ID of the public key to retrieve. ### Request Example None ### Response #### Success Response - **PublicKey** - The public key. ``` -------------------------------- ### Claim Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/interfaces/Claim.html This section details the various methods available on the Claim interface to retrieve claim values in different representations. ```APIDOC ## Claim Interface The Claim interface holds the value in a generic way so that it can be recovered in many representations. ### Methods - `boolean isNull()`: Checks if the claim has a null value. - `boolean isMissing()`: Checks if the claim is present. Returns true if the claim is not found or if its value is null. - `Boolean asBoolean()`: Retrieves the claim value as a Boolean. Returns null if the value is not a Boolean or cannot be converted. - `Integer asInt()`: Retrieves the claim value as an Integer. Returns null if the value is not an Integer or cannot be converted. - `Long asLong()`: Retrieves the claim value as a Long. Returns null if the value is not a Long or cannot be converted. - `Double asDouble()`: Retrieves the claim value as a Double. Returns null if the value is not a Double or cannot be converted. - `String asString()`: Retrieves the claim value as a String. Returns null if the value is not a String. - `Date asDate()`: Retrieves the claim value as a Date. Returns null if the value cannot be converted to a Date. - `Instant asInstant()`: Retrieves the claim value as an Instant. Returns null if the value cannot be converted to an Instant. - ` T[] asArray(Class clazz)`: Retrieves the claim value as an Array of type T. Throws `JWTDecodeException` if array elements cannot be converted. - ` List asList(Class clazz)`: Retrieves the claim value as a List of type T. Throws `JWTDecodeException` if list elements cannot be converted. - `Map asMap()`: Retrieves the claim value as a generic Map. Throws `JWTDecodeException` if the value cannot be converted to a Map. - ` T as(Class clazz)`: Retrieves the claim value as a custom type T. Returns null if the claim is missing or null. Throws `JWTDecodeException` if the value cannot be converted to type T. ``` -------------------------------- ### Algorithm and Verification Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Methods related to JWT algorithms and verification. ```APIDOC ## getName() ### Description Getter for the name of this Algorithm, as defined in the JWT Standard. ### Method Getter ### Endpoint N/A (Method) ### Parameters None ### Request Example None ### Response #### Success Response - **String** - The name of the algorithm. ## getLeewayFor(String) ### Description Fetches the Leeway set for a claim or returns the `JWTVerifier.BaseVerification.defaultLeeway`. ### Method Getter ### Endpoint N/A (Method) ### Parameters #### Path Parameters - **claim** (String) - Required - The name of the claim for which to get the leeway. ### Request Example None ### Response #### Success Response - **long** - The leeway value for the specified claim. ``` -------------------------------- ### SignatureVerificationException Constructors Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/com/auth0/jwt/exceptions/SignatureVerificationException.html Provides constructors for creating a SignatureVerificationException. ```APIDOC ## SignatureVerificationException Constructors ### `SignatureVerificationException(Algorithm algorithm)` Constructor for SignatureVerificationException with the algorithm used. ### `SignatureVerificationException(Algorithm algorithm, Throwable cause)` Constructor for SignatureVerificationException with the algorithm used and the underlying cause. ``` -------------------------------- ### Exception Methods Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Methods for retrieving information from JWT exceptions. ```APIDOC ## getClaimName() - IncorrectClaimException ### Description This method can be used to fetch the name for which the Claim verification failed. ### Method Getter ### Endpoint N/A (Method) ### Parameters None ### Request Example None ### Response #### Success Response - **String** - The name of the claim that failed verification. ## getClaimName() - MissingClaimException ### Description This method can be used to fetch the name for which the Claim is missing during the verification. ### Method Getter ### Endpoint N/A (Method) ### Parameters None ### Request Example None ### Response #### Success Response - **String** - The name of the missing claim. ## getClaimValue() ### Description This method can be used to fetch the value for which the Claim verification failed. ### Method Getter ### Endpoint N/A (Method) ### Parameters None ### Request Example None ### Response #### Success Response - **Object** - The value of the claim that failed verification. ## getExpiredOn() ### Description Represents the expiration time of the token. ### Method Getter ### Endpoint N/A (Method) ### Parameters None ### Request Example None ### Response #### Success Response - **Date** - The expiration date of the token. ``` -------------------------------- ### HMAC256 Algorithm Creation Source: https://javadoc.io/doc/com.auth0/java-jwt/latest/index-all.html Provides static methods to create Algorithm instances for HmacSHA256 using byte arrays or strings. ```APIDOC ## HMAC256(byte[]) Static method in class com.auth0.jwt.algorithms.Algorithm Creates a new Algorithm instance using HmacSHA256. ## HMAC256(String) Static method in class com.auth0.jwt.algorithms.Algorithm Creates a new Algorithm instance using HmacSHA256. ```