Class JwtBuilderFactory


  • public class JwtBuilderFactory
    extends Object
    A factory for getting builders for plaintext, signed and encrypted JWTs and reconstructing JWT strings back into their relevant JWT objects.
    Since:
    2.0.0
    • Constructor Detail

      • JwtBuilderFactory

        public JwtBuilderFactory()
    • Method Detail

      • jwt

        @Deprecated
        public SignedJwtBuilderImpl jwt()
        Deprecated.
        This method provides no security at all and shouldn't be used.
        Creates a builder for building a plaintext JWT into base64url UTF-8 encoded JWT string.
        Returns:
        The JwtBuilder instance that will build the plaintext JWT.
      • jws

        public SignedJwtBuilderImpl jws​(SigningHandler signingHandler)
        Creates a builder for building a signed JWT into a base64url UTF-8 encoded JWT string.
        Parameters:
        signingHandler - The SigningHandler instance used to sign the JWS.
        Returns:
        The JwtBuilder instance that will build the signed JWT.
      • jwe

        public EncryptedJwtBuilder jwe​(Key publicKey)
        Creates a builder for building an encrypted JWT into a base64url UTF-8 encoded JWT string.
        Parameters:
        publicKey - The public key that will be used to encrypted the JWT.
        Returns:
        The JwtBuilder instance that will build the encrypted JWT.
      • claims

        public JwtClaimsSetBuilder claims()
        Creates a builder for building a JWT Claims Set to be used in the building of JWTs.
        Returns:
        The JwtClaimsSetBuilder instance that will build the claims set.
      • reconstruct

        public <T extends Jwt> T reconstruct​(String jwtString,
                                             Class<T> jwtClass)
        Reconstructs the given JWT string into a JWT object of the specified type.
        Type Parameters:
        T - The type of JWT the JWT string represents.
        Parameters:
        jwtString - The JWT string.
        jwtClass - The JWT class to reconstruct the JWT string to.
        Returns:
        The reconstructed JWT object.