Package org.eclipse.hono.util
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CredentialsConstants.CredentialsAction
Request actions that belong to the Credentials API.
-
Field Summary
Fields Modifier and Type Field Description static String
CREDENTIALS_ENDPOINT
The Credential service's endpoint name.static String
DEFAULT_HASH_FUNCTION
The name of the default hash function to use for hashed passwords if not set explicitly.static String
EVENT_BUS_ADDRESS_CREDENTIALS_IN
The vert.x event bus address to which inbound credentials messages are published.static String
FIELD_AUTH_ID
The name of the field that contains the authentication identifier.static String
FIELD_CREDENTIALS_TOTAL
The name of the field that contains the number of credentials contained in a message.static String
FIELD_SECRETS
The name of the field that contains the secret(s) of the credentials.static String
FIELD_SECRETS_HASH_FUNCTION
The name of the field that contains the name of the hash function used for a hashed password.static String
FIELD_SECRETS_KEY
The name of the field that contains a (pre-shared) key.static String
FIELD_SECRETS_NOT_AFTER
The name of the field that contains the latest point in time a secret may be used for authentication.static String
FIELD_SECRETS_NOT_BEFORE
The name of the field that contains the earliest point in time a secret may be used for authentication.static String
FIELD_SECRETS_PWD_HASH
The name of the field that contains the password hash.static String
FIELD_SECRETS_PWD_PLAIN
The name of the field that contains the clear text password.static String
FIELD_SECRETS_SALT
The name of the field that contains the salt for the password hash.static String
FIELD_TYPE
The name of the field that contains the type of credentials.static String
HASH_FUNCTION_BCRYPT
The name of the BCrypt hash function.static String
HASH_FUNCTION_SHA256
The name of the SHA-256 hash function.static String
HASH_FUNCTION_SHA512
The name of the SHA-512 hash function.static String
SECRETS_TYPE_HASHED_PASSWORD
The type name that indicates a hashed password secret.static String
SECRETS_TYPE_PRESHARED_KEY
The type name that indicates a pre-shared key secret.static String
SECRETS_TYPE_X509_CERT
The type name that indicates an X.509 client certificate secret.static String
SPECIFIER_WILDCARD
The name of the field that contains the pattern to use for matching authentication identifiers.-
Fields inherited from class org.eclipse.hono.util.RequestResponseApiConstants
CONTENT_TYPE_APPLICATION_JSON, FIELD_ENABLED, FIELD_ERROR, FIELD_OBJECT_ID, FIELD_PAYLOAD, FIELD_PAYLOAD_DEFAULTS, FIELD_PAYLOAD_DEVICE_ID, FIELD_PAYLOAD_SUBJECT_DN, FIELD_PAYLOAD_TENANT_ID
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getHashFunction(io.vertx.core.json.JsonObject secret)
Gets the hash function of a hashed-password secret.static String
getPasswordHash(io.vertx.core.json.JsonObject secret)
Gets the password hash of a hashed-password secret.static String
getPasswordSalt(io.vertx.core.json.JsonObject secret)
Gets the password salt of a hashed-password secret.static io.vertx.core.json.JsonObject
getSearchCriteria(String type, String authId)
Creates a JSON object containing search criteria for Credentials.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.-
Methods inherited from class org.eclipse.hono.util.RequestResponseApiConstants
getAmqpReply, getErrorMessage
-
-
-
-
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
-
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
-
-
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 arenull
.
-
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 isnull
.
-
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 isnull
.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 isnull
.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 isnull
.IllegalArgumentException
- if the secret contains a non-string valued password salt property.
-
-