Package org.forgerock.json.jose.builders
Class JwtBuilderFactory
java.lang.Object
org.forgerock.json.jose.builders.JwtBuilderFactory
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclaims()Creates a builder for building a JWT Claims Set to be used in the building of JWTs.Deprecated.jwe(EncryptionKey<?> key) Creates a builder for building an encrypted JWT using the given encryption key.jws(SigningHandler signingHandler) Creates a builder for building a signed JWT into a base64url UTF-8 encoded JWT string.jwt()Deprecated.This method provides no security at all and shouldn't be used.recognizedHeaders(String... headers) Configures additional application-specific header values that are understood and processed by the application.<T extends Jwt>
Treconstruct(String jwtString, Class<T> jwtClass) Reconstructs the given JWT string into a JWT object of the specified type.
-
Constructor Details
-
JwtBuilderFactory
public JwtBuilderFactory()
-
-
Method Details
-
recognizedHeaders
Configures additional application-specific header values that are understood and processed by the application. Any non-standard critical headers that are not in this list will causereconstruct(String, Class)to fail.- Parameters:
headers- the set of headers to add to the recognized set.- Returns:
- the updated JwtBuilderFactory object.
-
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
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
Deprecated.Preferjwe(EncryptionKey)instead.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.
-
jwe
Creates a builder for building an encrypted JWT using the given encryption key.- Parameters:
key- the encryption key. Must not be null.- Returns:
- A builder for constructing an encrypted JWT.
-
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
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.
-
jwe(EncryptionKey)instead.