Package org.forgerock.android.auth
Class OathMechanism.OathBuilder<T extends OathMechanism.OathBuilder>
- java.lang.Object
-
- org.forgerock.android.auth.OathMechanism.OathBuilder<T>
-
- Direct Known Subclasses:
HOTPMechanism.HOTPBuilder,TOTPMechanism.TOTPBuilder
- Enclosing class:
- OathMechanism
public abstract static class OathMechanism.OathBuilder<T extends OathMechanism.OathBuilder> extends java.lang.ObjectBuilder class responsible for producing a Token.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringaccountNameprotected java.lang.Stringalgorithmprotected intdigitsprotected java.lang.Stringissuerprotected java.lang.StringmechanismUIDprotected java.lang.Stringsecretprotected java.util.CalendartimeAdded
-
Constructor Summary
Constructors Constructor Description OathBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected OathMechanismbuild()Produce the described OathMechanism Token.protected abstract TgetThis()TsetAccountName(java.lang.String accountName)Sets the name of the account.TsetAlgorithm(java.lang.String algorithm)Sets the algorithm used for generating the OTP.TsetDigits(int digits)Sets the length of the OTP to generate.TsetIssuer(java.lang.String issuer)Sets the name of the IDP that issued this account.TsetMechanismUID(java.lang.String mechanismUID)Sets the mechanism unique Id.TsetSecret(java.lang.String secret)Sets the secret used for generating the OTP.TsetTimeAdded(java.util.Calendar timeAdded)Sets the Date and Time this mechanism was stored.
-
-
-
Field Detail
-
mechanismUID
protected java.lang.String mechanismUID
-
issuer
protected java.lang.String issuer
-
accountName
protected java.lang.String accountName
-
algorithm
protected java.lang.String algorithm
-
secret
protected java.lang.String secret
-
digits
protected int digits
-
timeAdded
protected java.util.Calendar timeAdded
-
-
Method Detail
-
getThis
protected abstract T getThis()
-
setMechanismUID
public T setMechanismUID(java.lang.String mechanismUID)
Sets the mechanism unique Id.- Parameters:
mechanismUID- the mechanism unique Id- Returns:
- The current builder
-
setIssuer
public T setIssuer(java.lang.String issuer)
Sets the name of the IDP that issued this account.- Parameters:
issuer- The IDP name- Returns:
- The current builder
-
setAccountName
public T setAccountName(java.lang.String accountName)
Sets the name of the account.- Parameters:
accountName- The account name- Returns:
- The current builder
-
setAlgorithm
public T setAlgorithm(java.lang.String algorithm)
Sets the algorithm used for generating the OTP. Assumption: algorithm name is valid if a corresponding algorithm can be loaded.- Parameters:
algorithm- algorithm to assign- Returns:
- The current builder
-
setSecret
public T setSecret(java.lang.String secret)
Sets the secret used for generating the OTP. Base32 encoding based on: http://tools.ietf.org/html/rfc4648#page-8- Parameters:
secret- A Base32 encoded secret key- Returns:
- The current builder
-
setDigits
public T setDigits(int digits)
Sets the length of the OTP to generate.- Parameters:
digits- Number of digits, either 6 or 8- Returns:
- The current builder
-
setTimeAdded
public T setTimeAdded(java.util.Calendar timeAdded)
Sets the Date and Time this mechanism was stored.- Parameters:
timeAdded- when this mechanism was stored.
-
build
protected OathMechanism build() throws MechanismCreationException
Produce the described OathMechanism Token.- Returns:
- The built Token
- Throws:
MechanismCreationException- If an issuer or accountName were not provided.
-
-