Class ServiceProviderToken.Session

  • Enclosing class:
    ServiceProviderToken

    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()
        Returns:
        handle of the session used when swapping access tokens
      • getCreationTime

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

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

        public long getTimeToLive()
        Returns:
        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.
        Parameters:
        handle - handle the session will have
        Returns:
        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.
        Parameters:
        clock - clock to use to determine the current time
        Returns:
        true if the session has expired, false otherwise.