Package com.styra.opa.openapi.utils
Class SessionManager<T extends SessionManager.HasSessionKey>
java.lang.Object
com.styra.opa.openapi.utils.SessionManager<T>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static final class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSession
(T credentials, Optional<List<String>> scopes, Function<List<String>, SessionManager.Session<T>> tokenProvider) static boolean
static boolean
hasTokenExpired
(Optional<OffsetDateTime> expiresAt, OffsetDateTime now) void
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) static <T extends SessionManager.HasSessionKey>
booleanshouldCreateNewSession
(Optional<SessionManager.Session<T>> currentSession, Optional<List<String>> oauthScopes)
-
Field Details
-
REFRESH_BEFORE_EXPIRY_SECONDS
public static final int REFRESH_BEFORE_EXPIRY_SECONDS- See Also:
-
-
Constructor Details
-
SessionManager
public SessionManager()
-
-
Method Details
-
getSession
-
shouldCreateNewSession
public static <T extends SessionManager.HasSessionKey> boolean shouldCreateNewSession(Optional<SessionManager.Session<T>> currentSession, Optional<List<String>> oauthScopes) -
hasTokenExpired
-
hasRequiredScopes
-
remove
-
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)
-