Package org.forgerock.json.jose.builders
Class EncryptedJwtBuilder
java.lang.Object
org.forgerock.json.jose.builders.AbstractJwtBuilder
org.forgerock.json.jose.builders.EncryptedJwtBuilder
- All Implemented Interfaces:
JwtBuilder
- Direct Known Subclasses:
SignedThenEncryptedJwtBuilder
An implementation of a JwtBuilder that can build a JWT and encrypt it, resulting in an EncryptedJwt object.
- Since:
- 2.0.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionasJwt()
Builds the JWT object from its constituent parts.build()
Builds the JWE into aString
by calling thebuild
method on the JWE object.claims
(JwtClaimsSet claimsSet) Sets the JwtClaimsSet for this JwtBuilder.JweHeaderBuilder<? extends EncryptedJwtBuilder>
headers()
Gets the JweHeaderBuilder that this JwtBuilder will use to build the JWE's header parameters.sign
(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm) Deprecated.UsesignedWith(SigningHandler, JwsAlgorithm)
instead.signedWith
(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm) Returns anEncryptedThenSignedJwtBuilder
that will build a signed JWT with this builder's encrypted JWT as its payload.
-
Constructor Details
-
EncryptedJwtBuilder
Deprecated.Constructs a new EncryptedJwtBuilder that will use the given public key to encrypt the JWT.- Parameters:
publicKey
- The public key to encrypt the JWT with.
-
-
Method Details
-
headers
Gets the JweHeaderBuilder that this JwtBuilder will use to build the JWE's header parameters.- Specified by:
headers
in classAbstractJwtBuilder
- Returns:
- The JweHeaderBuilder instance.
-
claims
Sets the JwtClaimsSet for this JwtBuilder.- Overrides:
claims
in classAbstractJwtBuilder
- Parameters:
claimsSet
- The JwtClaimsSet containing the JWT's claims.- Returns:
- This EncryptedJwtBuilder.
-
sign
@Deprecated public SignedEncryptedJwtBuilder sign(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm) Deprecated.UsesignedWith(SigningHandler, JwsAlgorithm)
instead.Returns a SignedEncryptedJwtBuilder that will build a signed JWT with this builder's encrypted JWT as its payload.- Parameters:
signingHandler
- The SigningHandler instance used to sign the JWS.jwsAlgorithm
- The JwsAlgorithm to use when signing the JWT.- Returns:
- The SignedEncryptedJwtBuilder instance.
-
signedWith
public EncryptedThenSignedJwtBuilder signedWith(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm) Returns anEncryptedThenSignedJwtBuilder
that will build a signed JWT with this builder's encrypted JWT as its payload.- Parameters:
signingHandler
- The SigningHandler instance used to sign the JWS.jwsAlgorithm
- The JwsAlgorithm to use when signing the JWT.- Returns:
- The EncryptedThenSignedJwtBuilder instance.
-
asJwt
Description copied from interface:JwtBuilder
Builds the JWT object from its constituent parts.- Returns:
- The Jwt.
-
build
Builds the JWE into aString
by calling thebuild
method on the JWE object.- Returns:
- The base64url encoded UTF-8 parts of the JWE.
- See Also:
-
JwtBuilderFactory.jwe(org.forgerock.secrets.keys.EncryptionKey)
instead.