Class DefaultToken

  • All Implemented Interfaces:
    Token

    public class DefaultToken
    extends java.lang.Object
    implements Token
    The default implementation of Token.
    Since:
    2.0.1
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultToken​(java.lang.String key, long keyCreationTime, java.lang.String extendedInformation)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.lang.String getExtendedInformation()
      Obtains the extended information associated within the token, which was presented when the token was first created.
      java.lang.String getKey()
      Obtains the randomised, secure key assigned to this token.
      long getKeyCreationTime()
      The time the token key was initially created is available from this method.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DefaultToken

        public DefaultToken​(java.lang.String key,
                            long keyCreationTime,
                            java.lang.String extendedInformation)
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Description copied from interface: Token
        Obtains the randomised, secure key assigned to this token. Presentation of this token to TokenService will always return a Token that is equal to the original Token issued for that key.
        Specified by:
        getKey in interface Token
        Returns:
        a key with appropriate randomness and security.
      • getKeyCreationTime

        public long getKeyCreationTime()
        Description copied from interface: Token
        The time the token key was initially created is available from this method. Note that a given token must never have this creation time changed. If necessary, a new token can be requested from the TokenService to replace the original token.
        Specified by:
        getKeyCreationTime in interface Token
        Returns:
        the time this token key was created, in the same format as specified by Date.getTime().
      • getExtendedInformation

        public java.lang.String getExtendedInformation()
        Description copied from interface: Token
        Obtains the extended information associated within the token, which was presented when the token was first created.
        Specified by:
        getExtendedInformation in interface Token
        Returns:
        the user-specified extended information, if any
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object