public class DefaultCredentials extends Object implements Credentials
Credentials implementation| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultCredentials.CredentialsBuilder
Default
Builder implementation. |
static class |
DefaultCredentials.CredentialsEncoder
Default
Encoder implementation. |
Credentials.Builder, Credentials.Encoder| Constructor and Description |
|---|
DefaultCredentials()
Constructor
|
DefaultCredentials(byte[] secret)
Constructor
|
DefaultCredentials(byte[] secret,
String hashAlgorithm)
Constructor
|
DefaultCredentials(byte[] secret,
String hashAlgorithm,
byte[] salt,
int hashIterations)
Constructor
|
DefaultCredentials(String secret)
Constructor
|
DefaultCredentials(String secret,
String hashAlgorithm)
Constructor
|
DefaultCredentials(String secret,
String hashAlgorithm,
byte[] salt,
int hashIterations)
Constructor
|
DefaultCredentials(String secret,
String hashAlgorithm,
String salt,
int hashIterations)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Date |
getExpireDate()
Credential expire date
|
String |
getHashAlgorithm()
Get hash algorithm used to encode secret.
|
int |
getHashIterations()
Get hash iterations performed for secret encoding
|
byte[] |
getSalt()
Get salt data used to hash secret
|
byte[] |
getSecret()
Get secret data (e.g.
|
boolean |
isBase64Encoded()
Whether secret is encoded using Base64.
|
boolean |
isHexEncoded()
Whether secret is encoded using hexademical representation
|
void |
setBase64Encoded(boolean base64Encoded)
Set whether secret is encoded using Base64
|
void |
setExpireDate(Date expireDate)
Set credential expire date
|
void |
setHashAlgorithm(String hashAlgorithm)
Set hash algorithm name
|
void |
setHashIterations(int hashIterations)
Set hash iterations performed to encode secret
|
void |
setHexEncoded(boolean hexEncoded)
Set whether secret is hex encoded
|
void |
setSalt(byte[] salt)
Set salt data used to hash secret
|
void |
setSalt(String salt)
Set salt as UTF-8 String
|
void |
setSecret(byte[] secret)
Set secret
|
void |
setSecret(String secret)
Set secret as UTF-8 String
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuilder, encoderpublic DefaultCredentials()
public DefaultCredentials(String secret)
secret - Secret (e.g. password)public DefaultCredentials(String secret, String hashAlgorithm)
secret - Secret (e.g. password)hashAlgorithm - Hash algorithm used to encode secretpublic DefaultCredentials(String secret, String hashAlgorithm, byte[] salt, int hashIterations)
secret - Secret (e.g. password)hashAlgorithm - Hash algorithm used to encode secretsalt - Salt used in secret hashinghashIterations - Hash iterations performed to encode secretpublic DefaultCredentials(String secret, String hashAlgorithm, String salt, int hashIterations)
secret - Secret (e.g. password)hashAlgorithm - Hash algorithm used to encode secretsalt - Salt used in secret hashinghashIterations - Hash iterations performed to encode secretpublic DefaultCredentials(byte[] secret)
secret - Secret (e.g. password)public DefaultCredentials(byte[] secret,
String hashAlgorithm)
secret - Secret (e.g. password)hashAlgorithm - Hash algorithm used to encode secretpublic DefaultCredentials(byte[] secret,
String hashAlgorithm,
byte[] salt,
int hashIterations)
secret - Secret (e.g. password)hashAlgorithm - Hash algorithm used to encode secretsalt - Salt used in secret hashinghashIterations - Hash iterations performed to encode secretpublic byte[] getSecret()
CredentialsgetSecret in interface Credentialspublic String getHashAlgorithm()
Credentialsnull, means secret is not hashed and Credentials.getSalt()
or Credentials.getHashIterations() must be ignored.getHashAlgorithm in interface Credentialspublic byte[] getSalt()
CredentialsgetSalt in interface Credentialspublic int getHashIterations()
CredentialsgetHashIterations in interface Credentialspublic boolean isBase64Encoded()
Credentialstrue and hash algorithm is specified, any salt data will
be considered Base64 encoded too.isBase64Encoded in interface Credentialstrue if secret is encoded using Base64public boolean isHexEncoded()
CredentialsisHexEncoded in interface Credentialstrue if secret is hex encodedpublic Date getExpireDate()
CredentialsgetExpireDate in interface Credentialsnull if credential never expirespublic void setSecret(byte[] secret)
secret - the secret to setpublic void setSecret(String secret)
secret - the secret to setpublic void setHashAlgorithm(String hashAlgorithm)
hashAlgorithm - the hashAlgorithm to setpublic void setSalt(byte[] salt)
salt - the salt to setpublic void setSalt(String salt)
salt - the salt to setpublic void setHashIterations(int hashIterations)
hashIterations - the hashIterations to setpublic void setBase64Encoded(boolean base64Encoded)
base64Encoded - true if secret is encoded using Base64public void setHexEncoded(boolean hexEncoded)
hexEncoded - true if secret is hex encodedpublic void setExpireDate(Date expireDate)
expireDate - Expire dateCopyright © 2019 The Holon Platform. All rights reserved.