Class SecretSignature

java.lang.Object
io.micronaut.security.token.jwt.signature.AbstractSignatureConfiguration
io.micronaut.security.token.jwt.signature.secret.SecretSignature
All Implemented Interfaces:
SignatureConfiguration, SignatureGeneratorConfiguration

Since:
1.0
Author:
Sergio del Amo
  • Constructor Details

  • Method Details

    • supportedAlgorithmsMessage

      public String supportedAlgorithmsMessage()
      Specified by:
      supportedAlgorithmsMessage in interface SignatureConfiguration
      Returns:
      message explaining the supported algorithms
    • supports

      public boolean supports(com.nimbusds.jose.JWSAlgorithm algorithm)
      Description copied from interface: SignatureConfiguration
      Whether this signature configuration supports this algorithm.
      Specified by:
      supports in interface SignatureConfiguration
      Parameters:
      algorithm - the signature algorithm
      Returns:
      whether this signature configuration supports this algorithm
    • sign

      public com.nimbusds.jwt.SignedJWT sign(com.nimbusds.jwt.JWTClaimsSet claims) throws com.nimbusds.jose.JOSEException
      Description copied from interface: SignatureGeneratorConfiguration
      Generate a signed JWT based on claims.
      Specified by:
      sign in interface SignatureGeneratorConfiguration
      Parameters:
      claims - the provided claims
      Returns:
      the signed JWT
      Throws:
      com.nimbusds.jose.JOSEException - could be thrown while signing the JWT token
    • verify

      public boolean verify(com.nimbusds.jwt.SignedJWT jwt) throws com.nimbusds.jose.JOSEException
      Description copied from interface: SignatureConfiguration
      Verify a signed JWT.
      Specified by:
      verify in interface SignatureConfiguration
      Parameters:
      jwt - the signed JWT
      Returns:
      whether the signed JWT is verified
      Throws:
      com.nimbusds.jose.JOSEException - exception when verifying the JWT
    • getSecret

      public String getSecret()
      Returns:
      a string build the secret byte[] and UTF_8 charset
    • setSecret

      public void setSecret(String secret)
      Sets secret byte[] with a string with UTF_8 charset.
      Parameters:
      secret - UTF_8 string