Package org.forgerock.json.jose.builders
Class SignedJwtBuilderImpl
- java.lang.Object
-
- org.forgerock.json.jose.builders.AbstractJwtBuilder
-
- org.forgerock.json.jose.builders.SignedJwtBuilderImpl
-
- All Implemented Interfaces:
JwtBuilder,SignedJwtBuilder
public class SignedJwtBuilderImpl extends AbstractJwtBuilder implements SignedJwtBuilder
An implementation of a JwtBuilder that can build a JWT and sign it, resulting in a SignedJwt object.- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description SignedJwtBuilderImpl(SigningHandler signingHandler)Constructs a new SignedJwtBuilderImpl that will use the given private key to sign the JWT.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SignedJwtasJwt()Builds the JWT object from its constituent parts.Stringbuild()Builds the JWS into aStringby calling thebuildmethod on the JWS object.SignedJwtBuilderImplclaims(JwtClaimsSet claimsSet)Sets the JwtClaimsSet for this JwtBuilder.SignedThenEncryptedJwtBuilderencrypt(Key encryptionKey)Deprecated.Preferencrypt(EncryptionKey)instead.SignedThenEncryptedJwtBuilderencrypt(EncryptionKey<?> encryptionKey)Wraps the signed JWT in an outer encrypted JWE envelope.JwsHeaderBuilderheaders()Gets the JwsHeaderBuilder that this JwtBuilder will use to build the JWS' header parameters.
-
-
-
Constructor Detail
-
SignedJwtBuilderImpl
public SignedJwtBuilderImpl(SigningHandler signingHandler)
Constructs a new SignedJwtBuilderImpl that will use the given private key to sign the JWT.- Parameters:
signingHandler- The SigningHandler instance used to sign the JWS.
-
-
Method Detail
-
headers
public JwsHeaderBuilder headers()
Gets the JwsHeaderBuilder that this JwtBuilder will use to build the JWS' header parameters.- Specified by:
headersin classAbstractJwtBuilder- Returns:
- The JwsHeaderBuilder instance.
-
claims
public SignedJwtBuilderImpl claims(JwtClaimsSet claimsSet)
Sets the JwtClaimsSet for this JwtBuilder.- Overrides:
claimsin classAbstractJwtBuilder- Parameters:
claimsSet- The JwtClaimsSet containing the JWT's claims.- Returns:
- This SignedJwtBuilderImpl.
-
encrypt
@Deprecated public SignedThenEncryptedJwtBuilder encrypt(Key encryptionKey)
Deprecated.Preferencrypt(EncryptionKey)instead.Wraps the signed JWT in an outer encrypted JWE envelope.- Parameters:
encryptionKey- the key to use for encryption. This should either be a symmetric secret key or a public key.- Returns:
- the nested encrypted signed JWT builder.
-
encrypt
public SignedThenEncryptedJwtBuilder encrypt(EncryptionKey<?> encryptionKey)
Wraps the signed JWT in an outer encrypted JWE envelope.- Parameters:
encryptionKey- the key to use for encryption.- Returns:
- the nested encrypted signed JWT builder.
-
asJwt
public SignedJwt asJwt()
Description copied from interface:JwtBuilderBuilds the JWT object from its constituent parts.- Specified by:
asJwtin interfaceJwtBuilder- Returns:
- The Jwt.
-
build
public String build()
Builds the JWS into aStringby calling thebuildmethod on the JWS object.- Specified by:
buildin interfaceJwtBuilder- Returns:
- The base64url encoded UTF-8 parts of the JWS.
- See Also:
SignedJwt.build()
-
-