Package org.forgerock.android.auth
Class HOTPMechanism
- java.lang.Object
-
- org.forgerock.android.auth.Mechanism
-
- org.forgerock.android.auth.OathMechanism
-
- org.forgerock.android.auth.HOTPMechanism
-
- All Implemented Interfaces:
java.lang.Comparable<Mechanism>
public class HOTPMechanism extends OathMechanism
Represents HMAC-based OTP authentication mechanism and is responsible for its related operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHOTPMechanism.HOTPBuilderBuilder class responsible for producing a TOTPMechanism Token.-
Nested classes/interfaces inherited from class org.forgerock.android.auth.OathMechanism
OathMechanism.OathBuilder<T extends OathMechanism.OathBuilder>, OathMechanism.TokenType
-
-
Field Summary
Fields Modifier and Type Field Description protected longcounterCounter as in Int for number of OTP credentials generated-
Fields inherited from class org.forgerock.android.auth.OathMechanism
algorithm, digits
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HOTPMechanism.HOTPBuilderbuilder()Returns a builder for creating a HOTPMechanism Mechanism.static HOTPMechanismdeserialize(java.lang.String jsonString)Deserializes the specified Json into an object of theHOTPMechanismobject.OathTokenCodegetOathTokenCode()Generates a new set of codes for this OathMechanism Token.java.lang.StringtoJson()Creates a JSON string representation ofModelObjectobject.-
Methods inherited from class org.forgerock.android.auth.OathMechanism
getAlgorithm, getDigits, getOathType
-
Methods inherited from class org.forgerock.android.auth.Mechanism
compareTo, equals, getAccountName, getId, getIssuer, getMechanismUID, getTimeAdded, getType, hashCode, matches
-
-
-
-
Method Detail
-
getOathTokenCode
public OathTokenCode getOathTokenCode() throws OathMechanismException
Description copied from class:OathMechanismGenerates a new set of codes for this OathMechanism Token.- Specified by:
getOathTokenCodein classOathMechanism- Returns:
- OathTokenCode object that contains the currently active token code
- Throws:
OathMechanismException- If an error occur on generating the OTP codes
-
toJson
public java.lang.String toJson()
Creates a JSON string representation ofModelObjectobject. Sensitive information are not exposed.- Specified by:
toJsonin classOathMechanism- Returns:
- a JSON string object
-
deserialize
public static HOTPMechanism deserialize(java.lang.String jsonString)
Deserializes the specified Json into an object of theHOTPMechanismobject.- Parameters:
jsonString- the json string representing the object to be deserialized- Returns:
- an
HOTPMechanismobject from the string. ReturnsnullifjsonStringisnull, ifjsonStringis empty or not able to parse it.
-
builder
public static HOTPMechanism.HOTPBuilder builder()
Returns a builder for creating a HOTPMechanism Mechanism.- Returns:
- The OathMechanism builder.
-
-