Class ServiceProviderToken.Session

  • Enclosing class:

    public static final class ServiceProviderToken.Session
    extends Object
    Representation of an OAuth session. As long as the session is valid, old access tokens can be swapped for new access tokens. A session is valid as long as the last renewal time plus the time to live is greater than the current time.
    • Method Detail

      • getHandle

        public String getHandle()
        handle of the session used when swapping access tokens
      • getCreationTime

        public long getCreationTime()
        time the session was originally created - i.e. when the first access token was created
      • getLastRenewalTime

        public long getLastRenewalTime()
        last time the session was renewed by swapping an old access token
      • getTimeToLive

        public long getTimeToLive()
        length of time, from the last renewal time, that the session is valid
      • newSession

        public static ServiceProviderToken.Session.Builder newSession​(String handle)
        Static factory for creating a session builder.
        handle - handle the session will have
        new builder
      • hasExpired

        public boolean hasExpired​(Clock clock)
        Returns true if the session has expired - the time to live plus the last renewal time is less than the current time, false otherwise.
        clock - clock to use to determine the current time
        true if the session has expired, false otherwise.