Class DefaultClientSecretCredential

java.lang.Object
net.shibboleth.oidc.security.credential.DefaultClientSecretCredential
All Implemented Interfaces:
ClientSecretCredential

@ThreadSafe public class DefaultClientSecretCredential extends Object implements ClientSecretCredential
A basic implementation of ClientSecretCredential.
Since:
2.2.0
  • Field Details

    • DEFAULT_SECRET_KEY_NAME

      @Nonnull private static final String DEFAULT_SECRET_KEY_NAME
      Default client_secret keyname.
      See Also:
    • clientSecret

      @Nonnull private final byte[] clientSecret
      The client_secret.
    • secretKeyName

      @Nonnull @NotEmpty private final String secretKeyName
      The chosen client_secret keyname.
  • Constructor Details

    • DefaultClientSecretCredential

      public DefaultClientSecretCredential(@Nonnull String secret)
      Constructor.
      Parameters:
      secret - the client_secret
    • DefaultClientSecretCredential

      public DefaultClientSecretCredential(@Nonnull String secret, @Nonnull String keyName)
      Constructor.
      Parameters:
      secret - the client_secret
      keyName - the keyname to use when creating a JWKCredential
  • Method Details

    • getSecret

      @Nonnull public String getSecret()
      Get the client_secret as a UTF-8 encoded String.
      Specified by:
      getSecret in interface ClientSecretCredential
      Returns:
      The client_secret.
    • getSecretAsBytes

      @NotLive @Nonnull public byte[] getSecretAsBytes()
      Get the client_secret as UTF-8 bytes.
      Specified by:
      getSecretAsBytes in interface ClientSecretCredential
      Returns:
      the client_secret in bytes
    • toSigningCredential

      @Nonnull public JWKCredential toSigningCredential()
      Create a MAC singing key from the client_secret. The MAC key used is the octets of the UTF-8 representation of the client_secret value.
      Specified by:
      toSigningCredential in interface ClientSecretCredential
      Returns:
      a MAC signing key
    • toEncryptionCredential

      @Nonnull public JWKCredential toEncryptionCredential(@Nonnull JWEAlgorithm alg, @Nonnull EncryptionMethod enc) throws JOSEException
      Create a symmetric encryption key derived from the client_secret and compatible with the key management mode and encryption algorithm specified.
      Specified by:
      toEncryptionCredential in interface ClientSecretCredential
      Parameters:
      alg - the key management mode
      enc - the encryption algorithm
      Returns:
      a JWKCredential compatible with the 'alg' and 'enc' input
      Throws:
      JOSEException - if a key can not be derived