Package org.forgerock.android.auth
Class Mechanism
- java.lang.Object
-
- org.forgerock.android.auth.Mechanism
-
- All Implemented Interfaces:
java.lang.Comparable<Mechanism>
- Direct Known Subclasses:
OathMechanism,PushMechanism
public abstract class Mechanism extends java.lang.ObjectThe Mechanism model represents the two-factor way used for authentication. Encapsulates the related settings, as well as an owning Account.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMechanism(java.lang.String mechanismUID, java.lang.String issuer, java.lang.String accountName, java.lang.String type, java.lang.String secret, java.util.Calendar timeAdded)Base constructor which encapsulates common elements of all Mechanisms.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(Mechanism another)static Mechanismdeserialize(java.lang.String jsonString)Deserializes the specified Json into an object of theMechanismobject.booleanequals(java.lang.Object o)java.lang.StringgetAccountName()Returns the name of this Account.java.lang.StringgetId()Gets the storage id of the Mechanism.java.lang.StringgetIssuer()Gets the name of the IDP that issued this account.java.lang.StringgetMechanismUID()Get the mechanism unique Id.java.util.CalendargetTimeAdded()Get the Date and Time this mechanism was stored.java.lang.StringgetType()Get the string used to represent this type of mechanism.inthashCode()booleanmatches(Mechanism other)Returns true if the two objects would conflict if added to a storage system.abstract java.lang.StringtoJson()Creates a JSON string representation ofModelObjectobject.
-
-
-
Field Detail
-
PUSH
public static final java.lang.String PUSH
- See Also:
- Constant Field Values
-
OATH
public static final java.lang.String OATH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Mechanism
protected Mechanism(java.lang.String mechanismUID, java.lang.String issuer, java.lang.String accountName, java.lang.String type, java.lang.String secret, java.util.Calendar timeAdded)Base constructor which encapsulates common elements of all Mechanisms.- Parameters:
mechanismUID- The ID used to identify the Mechanism to external systemsissuer- String value of issueraccountName- String value of accountName or usernametype- String value of the mechanism typesecret- String value of the shared secrettimeAdded- Date and Time this Mechanism was stored
-
-
Method Detail
-
getId
public java.lang.String getId()
Gets the storage id of the Mechanism.- Returns:
- The unique identifier.
-
getMechanismUID
public java.lang.String getMechanismUID()
Get the mechanism unique Id.- Returns:
- The receiving Mechanism.
-
getIssuer
public java.lang.String getIssuer()
Gets the name of the IDP that issued this account.- Returns:
- The name of the IDP.
-
getAccountName
public java.lang.String getAccountName()
Returns the name of this Account.- Returns:
- The account name.
-
getType
public java.lang.String getType()
Get the string used to represent this type of mechanism.- Returns:
- The mechanism type as string.
-
getTimeAdded
public java.util.Calendar getTimeAdded()
Get the Date and Time this mechanism was stored.- Returns:
- when this mechanism was stored.
-
toJson
public abstract java.lang.String toJson()
Creates a JSON string representation ofModelObjectobject. Sensitive information are not exposed.- Returns:
- a JSON string object
-
deserialize
public static Mechanism deserialize(java.lang.String jsonString)
Deserializes the specified Json into an object of theMechanismobject.- Parameters:
jsonString- the json string representing the object to be deserialized- Returns:
- an
Mechanismobject from the string. ReturnsnullifjsonStringisnull, ifjsonStringis empty or not able to parse it.
-
matches
public final boolean matches(Mechanism other)
Returns true if the two objects would conflict if added to a storage system.- Parameters:
other- The object to compare.- Returns:
- True if key traits of the objects match, false otherwise.
-
compareTo
public int compareTo(Mechanism another)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-