Class CredentialsConstants

java.lang.Object
org.eclipse.hono.util.RequestResponseApiConstants
org.eclipse.hono.util.CredentialsConstants

public final class CredentialsConstants extends RequestResponseApiConstants
Constants & utility methods used throughout the Credentials API.
  • Field Details

    • FIELD_USERNAME

      public static final String FIELD_USERNAME
      The name of the field that contains the user name.
      See Also:
    • FIELD_PASSWORD

      public static final String FIELD_PASSWORD
      The name of the field that contains the password.
      See Also:
    • FIELD_TYPE

      public static final String FIELD_TYPE
      The name of the field that contains the type of credentials.
      See Also:
    • FIELD_AUTH_ID

      public static final String FIELD_AUTH_ID
      The name of the field that contains the authentication identifier.
      See Also:
    • FIELD_SECRETS

      public static final String FIELD_SECRETS
      The name of the field that contains the secret(s) of the credentials.
      See Also:
    • FIELD_CREDENTIALS_TOTAL

      public static final String FIELD_CREDENTIALS_TOTAL
      The name of the field that contains the number of credentials contained in a message.
      See Also:
    • FIELD_SECRETS_PWD_HASH

      public static final String FIELD_SECRETS_PWD_HASH
      The name of the field that contains the password hash.
      See Also:
    • FIELD_SECRETS_PWD_PLAIN

      public static final String FIELD_SECRETS_PWD_PLAIN
      The name of the field that contains the clear text password.
      See Also:
    • FIELD_SECRETS_SALT

      public static final String FIELD_SECRETS_SALT
      The name of the field that contains the salt for the password hash.
      See Also:
    • FIELD_SECRETS_HASH_FUNCTION

      public static final String FIELD_SECRETS_HASH_FUNCTION
      The name of the field that contains the name of the hash function used for a hashed password.
      See Also:
    • FIELD_SECRETS_KEY

      public static final String FIELD_SECRETS_KEY
      The name of the field that contains a (pre-shared) key.
      See Also:
    • FIELD_SECRETS_NOT_BEFORE

      public static final String FIELD_SECRETS_NOT_BEFORE
      The name of the field that contains the earliest point in time a secret may be used for authentication.
      See Also:
    • FIELD_SECRETS_NOT_AFTER

      public static final String FIELD_SECRETS_NOT_AFTER
      The name of the field that contains the latest point in time a secret may be used for authentication.
      See Also:
    • FIELD_CLIENT_CERT

      public static final String FIELD_CLIENT_CERT
      The name of the field that contains the client certificate that is used for authentication.
      See Also:
    • CREDENTIALS_ENDPOINT

      public static final String CREDENTIALS_ENDPOINT
      The Credential service's endpoint name.
      See Also:
    • SECRETS_TYPE_X509_CERT

      public static final String SECRETS_TYPE_X509_CERT
      The type name that indicates an X.509 client certificate secret.
      See Also:
    • SECRETS_TYPE_HASHED_PASSWORD

      public static final String SECRETS_TYPE_HASHED_PASSWORD
      The type name that indicates a hashed password secret.
      See Also:
    • SECRETS_TYPE_PRESHARED_KEY

      public static final String SECRETS_TYPE_PRESHARED_KEY
      The type name that indicates a pre-shared key secret.
      See Also:
    • SPECIFIER_WILDCARD

      public static final String SPECIFIER_WILDCARD
      The name of the field that contains the pattern to use for matching authentication identifiers.
      See Also:
    • HASH_FUNCTION_BCRYPT

      public static final String HASH_FUNCTION_BCRYPT
      The name of the BCrypt hash function.
      See Also:
    • HASH_FUNCTION_SHA256

      public static final String HASH_FUNCTION_SHA256
      The name of the SHA-256 hash function.
      See Also:
    • HASH_FUNCTION_SHA512

      public static final String HASH_FUNCTION_SHA512
      The name of the SHA-512 hash function.
      See Also:
    • DEFAULT_HASH_FUNCTION

      public static final String DEFAULT_HASH_FUNCTION
      The name of the default hash function to use for hashed passwords if not set explicitly.
      See Also:
    • EVENT_BUS_ADDRESS_CREDENTIALS_IN

      public static final String EVENT_BUS_ADDRESS_CREDENTIALS_IN
      The vert.x event bus address to which inbound credentials messages are published.
      See Also:
    • PATTERN_TYPE_VALUE

      public static final Pattern PATTERN_TYPE_VALUE
      The regular expression to validate that the type field supplied in credentials is legal.
  • Method Details

    • getSearchCriteria

      public static io.vertx.core.json.JsonObject getSearchCriteria(String type, String authId)
      Creates a JSON object containing search criteria for Credentials.
      Parameters:
      type - The type of credentials to get.
      authId - The authentication ID to get credentials for.
      Returns:
      The search criteria.
      Throws:
      NullPointerException - if any of the parameters are null.
    • getHashFunction

      public static String getHashFunction(io.vertx.core.json.JsonObject secret)
      Gets the hash function of a hashed-password secret.
      Parameters:
      secret - The secret.
      Returns:
      The hash function.
      Throws:
      NullPointerException - if secret is null.
      IllegalArgumentException - if the secret contains a non-string valued hash function property.
    • getPasswordHash

      public static String getPasswordHash(io.vertx.core.json.JsonObject secret)
      Gets the password hash of a hashed-password secret.
      Parameters:
      secret - The secret.
      Returns:
      The Base64 encoded password hash.
      Throws:
      NullPointerException - if secret is null.
      IllegalArgumentException - if the secret does not contain a password hash property.
    • getPasswordSalt

      public static String getPasswordSalt(io.vertx.core.json.JsonObject secret)
      Gets the password salt of a hashed-password secret.
      Parameters:
      secret - The secret.
      Returns:
      The Base64 encoded password salt or null if no salt is used.
      Throws:
      NullPointerException - if secret is null.
      IllegalArgumentException - if the secret contains a non-string valued password salt property.