Class ServiceProviderToken.Session
- java.lang.Object
-
- com.atlassian.bitbucket.jenkins.internal.applink.oauth.serviceprovider.token.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ServiceProviderToken.Session.Builder
Builder for creating session instances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getCreationTime()
String
getHandle()
long
getLastRenewalTime()
long
getTimeToLive()
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.static ServiceProviderToken.Session.Builder
newSession(String handle)
Static factory for creating a session builder.
-
-
-
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)
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.
-
-