Class OathMechanism.OathBuilder<T extends OathMechanism.OathBuilder>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String accountName  
      protected java.lang.String algorithm  
      protected int digits  
      protected java.lang.String issuer  
      protected java.lang.String mechanismUID  
      protected java.lang.String secret  
      protected java.util.Calendar timeAdded  
    • Constructor Summary

      Constructors 
      Constructor Description
      OathBuilder()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected OathMechanism build()
      Produce the described OathMechanism Token.
      protected abstract T getThis()  
      T setAccountName​(java.lang.String accountName)
      Sets the name of the account.
      T setAlgorithm​(java.lang.String algorithm)
      Sets the algorithm used for generating the OTP.
      T setDigits​(int digits)
      Sets the length of the OTP to generate.
      T setIssuer​(java.lang.String issuer)
      Sets the name of the IDP that issued this account.
      T setMechanismUID​(java.lang.String mechanismUID)
      Sets the mechanism unique Id.
      T setSecret​(java.lang.String secret)
      Sets the secret used for generating the OTP.
      T setTimeAdded​(java.util.Calendar timeAdded)
      Sets the Date and Time this mechanism was stored.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • OathBuilder

        public OathBuilder()
    • 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.