Class CredentialsConstants


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

      • FIELD_TYPE

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

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

        public static final String FIELD_SECRETS
        The name of the field that contains the secret(s) of the credentials.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • FIELD_SECRETS_PWD_HASH

        public static final String FIELD_SECRETS_PWD_HASH
        The name of the field that contains the password hash.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • FIELD_SECRETS_KEY

        public static final String FIELD_SECRETS_KEY
        The name of the field that contains a (pre-shared) key.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • CREDENTIALS_ENDPOINT

        public static final String CREDENTIALS_ENDPOINT
        The Credential service's endpoint name.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • SECRETS_TYPE_HASHED_PASSWORD

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

        public static final String SECRETS_TYPE_PRESHARED_KEY
        The type name that indicates a pre-shared key secret.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • HASH_FUNCTION_BCRYPT

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

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

        public static final String HASH_FUNCTION_SHA512
        The name of the SHA-512 hash function.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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 Detail

      • 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.
      • getServiceGetRequestAsJson

        public static io.vertx.core.json.JsonObject getServiceGetRequestAsJson​(String tenantId,
                                                                               String deviceId,
                                                                               String authId,
                                                                               String type)
        Build a Json object as a request for internal communication via the vert.x event bus. Clients use this object to build their request that is sent to the processing service.
        Parameters:
        tenantId - The tenant for which the message was processed.
        deviceId - The device that the message relates to.
        authId - The authId of the device that the message relates to.
        type - The type of credentials that the message relates to.
        Returns:
        JsonObject The JSON object for the request that is to be sent via the vert.x event bus.
        Throws:
        NullPointerException - if tenant is 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.