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
public class EncryptedJwtBuilder extends AbstractJwtBuilder
An implementation of a JwtBuilder that can build a JWT and encrypt it, resulting in an EncryptedJwt object.- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description EncryptedJwtBuilder(Key publicKey)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description EncryptedJwt
asJwt()
Builds the JWT object from its constituent parts.String
build()
Builds the JWE into aString
by calling thebuild
method on the JWE object.EncryptedJwtBuilder
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.SignedEncryptedJwtBuilder
sign(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm)
Deprecated.UsesignedWith(SigningHandler, JwsAlgorithm)
instead.EncryptedThenSignedJwtBuilder
signedWith(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm)
Returns anEncryptedThenSignedJwtBuilder
that will build a signed JWT with this builder's encrypted JWT as its payload.
-
-
-
Constructor Detail
-
EncryptedJwtBuilder
@Deprecated public EncryptedJwtBuilder(Key publicKey)
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 Detail
-
headers
public JweHeaderBuilder<? extends EncryptedJwtBuilder> 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
public EncryptedJwtBuilder claims(JwtClaimsSet claimsSet)
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
public EncryptedJwt asJwt()
Description copied from interface:JwtBuilder
Builds the JWT object from its constituent parts.- Returns:
- The Jwt.
-
build
public String 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:
EncryptedJwt.build()
-
-