Class TokenLifetime

java.lang.Object
com.atlassian.crowd.model.token.TokenLifetime

public class TokenLifetime extends Object
A value object that describes the requested lifetime of a new Token. Get an instance using the factory method, or use the default lifetime constant.
  • Field Details

    • USE_DEFAULT

      public static final TokenLifetime USE_DEFAULT
      Indicates that the token does not specify a concrete lifetime, and will use the default lifetime
  • Method Details

    • getSeconds

      public long getSeconds()
      Returns:
      the token lifetime in seconds
      Throws:
      IllegalStateException - if this is the default lifetime, i.e., it does not prescribe a particular duration
    • isDefault

      public boolean isDefault()
      Returns:
      true if this is the default lifetime, i.e., it does not prescribe a particular duration
    • inSeconds

      public static TokenLifetime inSeconds(long seconds)
      Builds a new instance that represents a requested lifetime of a given number of seconds
      Parameters:
      seconds - requested token lifetime in seconds
      Returns:
      a new instance of TokenLifetime
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object