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 EncryptedJwtasJwt()Builds the JWT object from its constituent parts.Stringbuild()Builds the JWE into aStringby calling thebuildmethod on the JWE object.EncryptedJwtBuilderclaims(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.SignedEncryptedJwtBuildersign(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm)Deprecated.UsesignedWith(SigningHandler, JwsAlgorithm)instead.EncryptedThenSignedJwtBuildersignedWith(SigningHandler signingHandler, JwsAlgorithm jwsAlgorithm)Returns anEncryptedThenSignedJwtBuilderthat 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:
headersin classAbstractJwtBuilder- Returns:
- The JweHeaderBuilder instance.
-
claims
public EncryptedJwtBuilder claims(JwtClaimsSet claimsSet)
Sets the JwtClaimsSet for this JwtBuilder.- Overrides:
claimsin 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 anEncryptedThenSignedJwtBuilderthat 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:JwtBuilderBuilds the JWT object from its constituent parts.- Returns:
- The Jwt.
-
build
public String build()
Builds the JWE into aStringby calling thebuildmethod on the JWE object.- Returns:
- The base64url encoded UTF-8 parts of the JWE.
- See Also:
EncryptedJwt.build()
-
-