Package com.atlassian.oauth2.scopes.api
Interface ScopesRequestCache
public interface ScopesRequestCache
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classThe state of the ScopesRequestCache -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves the scopes request cache.booleancontainsOnlyThisScope(Scope scope) Checks if the cache contains only the passed scopeGets the application name for the OAuth 2 request if this is one Otherwise returns an empty OptionalGets the current set of permissions for the requestGets a copy of the stored request cachebooleanhasPermission(Permission permission) Using the scope cache, checks if the request has the specified permissionvoidsetRequestCache(ScopesRequestCache.RequestCache requestCache) Allows the request cache to be manually set.withScopes(Scope scope, Supplier<Optional<String>> applicationNameSupplier) Applies scopes to Request cache.
-
Method Details
-
withScopes
Applies scopes to Request cache. The scopes will be removed by calling close() method on the Closeable.- Parameters:
scope- the scopes applied during the actionapplicationNameSupplier- attempts to supply the application name for the request- Returns:
- Closeable to remove the scopes
- Since:
- 2.1
-
containsOnlyThisScope
Checks if the cache contains only the passed scope- Parameters:
scope- the scope to check if it exists alone in the cache- Returns:
- true if it exists alone, false otherwise
-
hasPermission
Using the scope cache, checks if the request has the specified permission- Parameters:
permission- the permission to check- Returns:
- true if the scope cache is empty, or the request has permission. Otherwise false.
-
getApplicationNameForRequest
Gets the application name for the OAuth 2 request if this is one Otherwise returns an empty Optional- Returns:
- an Optional with the Application Name or an empty Optional
-
getPermissionsForRequest
Gets the current set of permissions for the request- Returns:
- the set of Permissions for the current request or an empty set if none present
-
getRequestCache
ScopesRequestCache.RequestCache getRequestCache()Gets a copy of the stored request cache- Returns:
-
setRequestCache
Allows the request cache to be manually set. Setting it to null is the same as clearing it- Parameters:
requestCache- the request cache to store
-
clearRequestCache
void clearRequestCache()Removes the scopes request cache.
-