Class DefaultToken

java.lang.Object
org.springframework.security.core.token.DefaultToken
All Implemented Interfaces:
Token

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

    • DefaultToken

      public DefaultToken(String key, long keyCreationTime, String extendedInformation)
  • Method Details

    • getKey

      public 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 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(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object