Package com.google.genai.gaos.utils
Class SessionManager<T extends SessionManager.HasSessionKey>
java.lang.Object
com.google.genai.gaos.utils.SessionManager<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSession(T credentials, List<String> scopes, Function<List<String>, SessionManager.Session<T>> tokenProvider) static booleanhasRequiredScopes(List<String> sessionScopes, List<String> requiredScopes) static booleanhasTokenExpired(Optional<OffsetDateTime> expiresAt, OffsetDateTime now) Checks if the token has expired.voidvoidremoveSession(String sessionKey, String scopeKey) static <T extends SessionManager.HasSessionKey>
SessionManager.Session<T>requestOAuth2Token(HTTPClient client, T credentials, List<String> scopes, Map<String, String> body, Map<String, String> headers, URI tokenUri)
-
Field Details
-
REFRESH_BEFORE_EXPIRY_SECONDS
public static final int REFRESH_BEFORE_EXPIRY_SECONDS- See Also:
-
-
Constructor Details
-
SessionManager
public SessionManager()
-
-
Method Details
-
getSession
public SessionManager.Session<T> getSession(T credentials, List<String> scopes, Function<List<String>, SessionManager.Session<T>> tokenProvider) -
hasTokenExpired
Checks if the token has expired. If no expires_in field was returned by the authorization server, the token is considered to never expire. A buffer (REFRESH_BEFORE_EXPIRY_SECONDS) is applied to refresh tokens before they actually expire. -
hasRequiredScopes
-
remove
-
removeSession
-
requestOAuth2Token
public static <T extends SessionManager.HasSessionKey> SessionManager.Session<T> requestOAuth2Token(HTTPClient client, T credentials, List<String> scopes, Map<String, String> body, Map<String, String> headers, URI tokenUri)
-