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 Details

    • 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 Details

    • headers

      public JwsHeaderBuilder headers()
      Gets the JwsHeaderBuilder that this JwtBuilder will use to build the JWS' header parameters.
      Specified by:
      headers in class AbstractJwtBuilder
      Returns:
      The JwsHeaderBuilder instance.
    • claims

      public SignedJwtBuilderImpl claims(JwtClaimsSet claimsSet)
      Sets the JwtClaimsSet for this JwtBuilder.
      Overrides:
      claims in class AbstractJwtBuilder
      Parameters:
      claimsSet - The JwtClaimsSet containing the JWT's claims.
      Returns:
      This SignedJwtBuilderImpl.
    • encrypt

      @Deprecated public SignedThenEncryptedJwtBuilder encrypt(Key encryptionKey)
      Deprecated.
      Prefer encrypt(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 interface JwtBuilder
      Returns:
      The Jwt.
    • build

      public String build()
      Builds the JWS into a String by calling the build method on the JWS object.

      Specified by:
      build in interface JwtBuilder
      Returns:
      The base64url encoded UTF-8 parts of the JWS.
      See Also: