Class JPAScopeStore

java.lang.Object
org.keycloak.authorization.jpa.store.JPAScopeStore
All Implemented Interfaces:
ScopeStore

public class JPAScopeStore extends Object implements ScopeStore
Author:
Pedro Igor
  • Constructor Details

    • JPAScopeStore

      public JPAScopeStore(jakarta.persistence.EntityManager entityManager, AuthorizationProvider provider)
  • Method Details

    • create

      public Scope create(ResourceServer resourceServer, String name)
      Description copied from interface: ScopeStore
      Creates a new Scope instance. The new instance is not necessarily persisted though, which may require a call to the {#save} method to actually make it persistent.
      Specified by:
      create in interface ScopeStore
      Parameters:
      resourceServer - the resource server to which this scope belongs. Cannot be null.
      name - the name of the scope
      Returns:
      a new instance of Scope
    • create

      public Scope create(ResourceServer resourceServer, String id, String name)
      Description copied from interface: ScopeStore
      Creates a new Scope instance. The new instance is not necessarily persisted though, which may require a call to the {#save} method to actually make it persistent.
      Specified by:
      create in interface ScopeStore
      Parameters:
      resourceServer - the resource server to which this scope belongs. Cannot be null.
      id - the id of the scope. Is generated randomly when null
      name - the name of the scope
      Returns:
      a new instance of Scope
    • delete

      public void delete(String id)
      Description copied from interface: ScopeStore
      Deletes a scope from the underlying persistence mechanism.
      Specified by:
      delete in interface ScopeStore
      Parameters:
      id - the id of the scope to delete
    • findById

      public Scope findById(ResourceServer resourceServer, String id)
      Description copied from interface: ScopeStore
      Returns a Scope with the given id
      Specified by:
      findById in interface ScopeStore
      Parameters:
      resourceServer - the resource server id. Ignored if null.
      id - the identifier of the scope
      Returns:
      a scope with the given identifier.
    • findByName

      public Scope findByName(ResourceServer resourceServer, String name)
      Description copied from interface: ScopeStore
      Returns a Scope with the given name
      Specified by:
      findByName in interface ScopeStore
      Parameters:
      resourceServer - the resource server. Cannot be null.
      name - the name of the scope
      Returns:
      a scope with the given name.
    • findByResourceServer

      public List<Scope> findByResourceServer(ResourceServer resourceServer)
      Description copied from interface: ScopeStore
      Returns a list of Scope associated with the ResourceServer.
      Specified by:
      findByResourceServer in interface ScopeStore
      Parameters:
      resourceServer - the resource server. Cannot be null.
      Returns:
      a list of scopes that belong to the given resource server
    • findByResourceServer

      public List<Scope> findByResourceServer(ResourceServer resourceServer, Map<Scope.FilterOption,String[]> attributes, Integer firstResult, Integer maxResults)
      Description copied from interface: ScopeStore
      Returns a list of Scope associated with a ResourceServer with the given resourceServerId.
      Specified by:
      findByResourceServer in interface ScopeStore
      Parameters:
      resourceServer - the resource server. Cannot be null.
      attributes - a map holding the attributes that will be used as a filter; possible filter options are given by Scope.FilterOption
      firstResult - first result to return. Ignored if negative or null.
      maxResults - maximum number of results to return. Ignored if negative or null.
      Returns:
      a list of scopes that belong to the given resource server