Class ServiceProviderToken.Session
java.lang.Object
com.atlassian.bitbucket.jenkins.internal.applink.oauth.serviceprovider.token.ServiceProviderToken.Session
- Enclosing class:
- ServiceProviderToken
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builder for creating session instances. -
Method Summary
Modifier and TypeMethodDescriptionlong
long
long
boolean
hasExpired
(Clock clock) Returnstrue
if the session has expired - the time to live plus the last renewal time is less than the current time,false
otherwise.newSession
(String handle) Static factory for creating a session builder.
-
Method Details
-
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
Static factory for creating a session builder.- Parameters:
handle
- handle the session will have- Returns:
- new builder
-
hasExpired
Returnstrue
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.
-