public abstract class OathMechanism extends Mechanism
| Modifier and Type | Class and Description |
|---|---|
static class |
OathMechanism.OathBuilder<T extends OathMechanism.OathBuilder>
Builder class responsible for producing a Token.
|
static class |
OathMechanism.TokenType |
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
algorithm
Algorithm of HMAC-based OTP
|
protected int |
digits
Digits as in Int for length of OTP credentials
|
| Modifier | Constructor and Description |
|---|---|
protected |
OathMechanism(java.lang.String mechanismUID,
java.lang.String issuer,
java.lang.String accountName,
java.lang.String type,
OathMechanism.TokenType oathType,
java.lang.String algorithm,
java.lang.String secret,
int digits,
java.util.Calendar timeCreated) |
| Modifier and Type | Method and Description |
|---|---|
static OathMechanism |
deserialize(java.lang.String jsonString)
Deserializes the specified Json into an object of the
OathMechanism object. |
java.lang.String |
getAlgorithm()
Returns the algorithm used by this OathMechanism.
|
int |
getDigits()
Returns the number of digits that are in OTPs generated by this Token.
|
abstract OathTokenCode |
getOathTokenCode()
Generates a new set of codes for this OathMechanism Token.
|
OathMechanism.TokenType |
getOathType()
Returns the token type (HOTPMechanism, TOTPMechanism).
|
abstract java.lang.String |
toJson()
Creates a JSON string representation of
T object. |
compareTo, equals, getAccountName, getId, getIssuer, getMechanismUID, getTimeAdded, getType, hashCode, matchesprotected java.lang.String algorithm
protected int digits
protected OathMechanism(java.lang.String mechanismUID,
java.lang.String issuer,
java.lang.String accountName,
java.lang.String type,
OathMechanism.TokenType oathType,
java.lang.String algorithm,
java.lang.String secret,
int digits,
java.util.Calendar timeCreated)
public int getDigits()
public java.lang.String getAlgorithm()
public OathMechanism.TokenType getOathType()
public abstract OathTokenCode getOathTokenCode() throws OathMechanismException
OathMechanismException - If an error occur on generating the OTP codespublic abstract java.lang.String toJson()
T object. Sensitive information are not
exposed.public static OathMechanism deserialize(java.lang.String jsonString)
OathMechanism object.jsonString - the json string representing the object to be deserializedOathMechanism object from the string. Returns null if
jsonString is null, if jsonString is empty or not able to parse it