Interface JwtSignature

All Known Subinterfaces:
JwtClaimsBuilder, JwtSignatureBuilder

public interface JwtSignature
JWT JsonWebSignature.
  • Method Details

    • sign

      String sign(PrivateKey signingKey) throws JwtSignatureException
      Sign the claims with PrivateKey. 'RS256' algorithm will be used unless a different algorithm has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RS256' algorithm.
      Parameters:
      signingKey - the signing key
      Returns:
      signed JWT token
      Throws:
      JwtSignatureException - the exception if the signing operation has failed
    • sign

      String sign(SecretKey signingKey) throws JwtSignatureException
      Sign the claims with SecretKey 'HS256' algorithm will be used unless a different algorithm has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property.
      Parameters:
      signingKey - the signing key
      Returns:
      signed JWT token
      Throws:
      JwtSignatureException - the exception if the signing operation has failed
    • sign

      String sign(String keyLocation) throws JwtSignatureException
      Sign the claims with a private or secret key loaded from the custom location which can point to a PEM, JWK or JWK set keys. 'RS256' algorithm will be used unless a different algorithm has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RS256' algorithm.
      Parameters:
      keyLocation - the signing key location
      Returns:
      signed JWT token
      Throws:
      JwtSignatureException - the exception if the signing operation has failed
    • sign

      Sign the claims with a key loaded from the location set with the "smallrye.jwt.sign.key.location" property or the key content set with the "smallrye.jwt.sign.key" property. Keys in PEM, JWK and JWK formats are supported. 'RS256' algorithm will be used unless a different algorithm has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RS256' algorithm.
      Returns:
      signed JWT token
      Throws:
      JwtSignatureException - the exception if the signing operation has failed
    • signWithSecret

      String signWithSecret(String secret) throws JwtSignatureException
      Sign the claims with a secret key string. 'HS256' algorithm will be used unless a different algorithm has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property.
      Parameters:
      secret - the secret
      Returns:
      signed JWT token
      Throws:
      JwtSignatureException - the exception if the signing operation has failed
    • innerSign

      Sign the claims with PrivateKey and encrypt the inner JWT by moving to JwtEncryptionBuilder. 'RS256' algorithm will be used unless a different algorithm has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RS256' algorithm.
      Parameters:
      signingKey - the signing key
      Returns:
      JwtEncryption
      Throws:
      JwtSignatureException - the exception if the inner JWT signing operation has failed
    • innerSign

      Sign the claims with SecretKey and encrypt the inner JWT by moving to JwtEncryptionBuilder. 'HS256' algorithm will be used unless a different algorithm has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property.
      Parameters:
      signingKey - the signing key
      Returns:
      JwtEncryption
      Throws:
      JwtSignatureException - the exception if the inner JWT signing operation has failed
    • innerSign

      JwtEncryptionBuilder innerSign(String keyLocation) throws JwtSignatureException
      Sign the claims with a private or secret key loaded from the custom location which can point to a PEM, JWK or JWK set keys and encrypt the inner JWT by moving to JwtEncryptionBuilder. 'RS256' algorithm will be used unless a different one has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property. A key of size 2048 bits or larger MUST be used with the 'RS256' algorithm.
      Parameters:
      keyLocation - the signing key location
      Returns:
      JwtEncryption
      Throws:
      JwtSignatureException - the exception if the inner JWT signing operation has failed
    • innerSign

      Sign the claims with a key loaded from the location set with the "smallrye.jwt.sign.key.location" property or the key content set with the "smallrye.jwt.sign.key" property and encrypt the inner JWT by moving to JwtEncryptionBuilder. Signing keys in PEM, JWK and JWK formats are supported. A key of size 2048 bits or larger MUST be used with the 'RS256' algorithm or 'smallrye.jwt.new-token.signature-algorithm' property.
      Returns:
      JwtEncryption
      Throws:
      JwtSignatureException - the exception if the inner JWT signing operation has failed
    • innerSignWithSecret

      JwtEncryptionBuilder innerSignWithSecret(String secret) throws JwtSignatureException
      Sign the claims with a secret key string and encrypt the inner JWT by moving to JwtEncryptionBuilder. 'HS256' algorithm will be used unless a different one has been set with JwtSignatureBuilder or 'smallrye.jwt.new-token.signature-algorithm' property.
      Parameters:
      secret - the secret
      Returns:
      signed JWT token
      Throws:
      JwtSignatureException - the exception if the signing operation has failed