Interface ScopesRequestCache


public interface ScopesRequestCache
  • Method Details

    • withScopes

      Closeable withScopes(Scope scope, Supplier<Optional<String>> applicationNameSupplier)
      Applies scopes to Request cache. The scopes will be removed by calling close() method on the Closeable.
      Parameters:
      scope - the scopes applied during the action
      applicationNameSupplier - attempts to supply the application name for the request
      Returns:
      Closeable to remove the scopes
      Since:
      2.1
    • containsOnlyThisScope

      boolean containsOnlyThisScope(Scope scope)
      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

      boolean hasPermission(Permission permission)
      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

      @Nonnull Optional<String> 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

      @Nonnull Set<Permission> 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

      Gets a copy of the stored request cache
      Returns:
    • setRequestCache

      void setRequestCache(@Nullable ScopesRequestCache.RequestCache requestCache)
      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.