Package org.openhab.core.auth
Class UserSession
java.lang.Object
org.openhab.core.auth.UserSession
A persistent session for a 
ManagedUser, which holds a refresh token used by a client to get short-lived
 access tokens for API requests authorization.- Author:
- Yannick Schaus - initial contribution
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionGets the ID of the client this session was created forGets the creation time of the session.Gets the time when the refresh token was last used to get a new access token.Gets the redirect URI which was used to perform the authorization flow.Gets the refresh token for the session.getScope()Gets the scope requested when authorizing this session.Gets the ID of the session.booleanSpecifies whether this session is supported by a session cookie, to mitigate the impact of refresh token leakage.voidsetLastRefreshTime(Date lastRefreshTime) Sets the time when the refresh token was last used to get a new access token.voidsetSessionCookie(boolean sessionCookie) Sets the session cookie flag for this session.
- 
Constructor Details- 
UserSessionpublic UserSession(String sessionId, String refreshToken, String clientId, String redirectUri, String scope) Constructs a new session.- Parameters:
- sessionId- a unique ID for the session
- refreshToken- the refresh token associated to the session
- clientId- the client ID associated to the session
- redirectUri- the callback URI provided when the client was authorized by the user
- scope- the granted scope provided when the client was authorized by the user
 
 
- 
- 
Method Details- 
getSessionIdGets the ID of the session.- Returns:
- the session ID
 
- 
getRefreshTokenGets the refresh token for the session.- Returns:
- the refresh token
 
- 
getCreatedTimeGets the creation time of the session.- Returns:
- the creation time
 
- 
getLastRefreshTimeGets the time when the refresh token was last used to get a new access token.- Returns:
- the last refresh time
 
- 
setLastRefreshTimeSets the time when the refresh token was last used to get a new access token.- Parameters:
- lastRefreshTime- the last refresh time
 
- 
getScopeGets the scope requested when authorizing this session.- Returns:
- the session scope
 
- 
getClientIdGets the ID of the client this session was created for- Returns:
- the client ID
 
- 
getRedirectUriGets the redirect URI which was used to perform the authorization flow.- Returns:
- the redirect URI
 
- 
hasSessionCookiepublic boolean hasSessionCookie()Specifies whether this session is supported by a session cookie, to mitigate the impact of refresh token leakage.- Returns:
- whether or not a cookie has been set
 
- 
setSessionCookiepublic void setSessionCookie(boolean sessionCookie) Sets the session cookie flag for this session.- Parameters:
- sessionCookie- the cookie flag
 
 
-