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 SignedJwt
asJwt()
Builds the JWT object from its constituent parts.String
build()
Builds the JWS into aString
by calling thebuild
method on the JWS object.SignedJwtBuilderImpl
claims(JwtClaimsSet claimsSet)
Sets the JwtClaimsSet for this JwtBuilder.SignedThenEncryptedJwtBuilder
encrypt(Key encryptionKey)
Deprecated.Preferencrypt(EncryptionKey)
instead.SignedThenEncryptedJwtBuilder
encrypt(EncryptionKey<?> encryptionKey)
Wraps the signed JWT in an outer encrypted JWE envelope.JwsHeaderBuilder
headers()
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:
headers
in classAbstractJwtBuilder
- Returns:
- The JwsHeaderBuilder instance.
-
claims
public SignedJwtBuilderImpl claims(JwtClaimsSet claimsSet)
Sets the JwtClaimsSet for this JwtBuilder.- Overrides:
claims
in 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:JwtBuilder
Builds the JWT object from its constituent parts.- Specified by:
asJwt
in interfaceJwtBuilder
- Returns:
- The Jwt.
-
build
public String build()
Builds the JWS into aString
by calling thebuild
method on the JWS object.- Specified by:
build
in interfaceJwtBuilder
- Returns:
- The base64url encoded UTF-8 parts of the JWS.
- See Also:
SignedJwt.build()
-
-