Class ResourceAdapter

java.lang.Object
org.keycloak.authorization.model.AbstractAuthorizationModel
org.keycloak.authorization.jpa.store.ResourceAdapter
All Implemented Interfaces:
Resource, JpaModel<ResourceEntity>

public class ResourceAdapter extends AbstractAuthorizationModel implements Resource, JpaModel<ResourceEntity>
Version:
$Revision: 1 $
Author:
Bill Burke
  • Constructor Details

    • ResourceAdapter

      public ResourceAdapter(ResourceEntity entity, jakarta.persistence.EntityManager em, StoreFactory storeFactory)
  • Method Details

    • getEntity

      public ResourceEntity getEntity()
      Specified by:
      getEntity in interface JpaModel<ResourceEntity>
    • getId

      public String getId()
      Description copied from interface: Resource
      Returns the unique identifier for this instance.
      Specified by:
      getId in interface Resource
      Returns:
      the unique identifier for this instance
    • getName

      public String getName()
      Description copied from interface: Resource
      Returns the resource's name.
      Specified by:
      getName in interface Resource
      Returns:
      the name of this resource
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: Resource
      Returns the end user friendly name for this resource. If not defined, value for Resource.getName() is returned.
      Specified by:
      getDisplayName in interface Resource
      Returns:
      the friendly name for this resource
    • setDisplayName

      public void setDisplayName(String name)
      Description copied from interface: Resource
      Sets an end user friendly name for this resource.
      Specified by:
      setDisplayName in interface Resource
      Parameters:
      name - the name of this resource
    • getUris

      public Set<String> getUris()
      Description copied from interface: Resource
      Returns a List containing all URI that uniquely identify this resource.
      Specified by:
      getUris in interface Resource
      Returns:
      a List if URI for this resource or empty list if not defined.
    • updateUris

      public void updateUris(Set<String> uri)
      Description copied from interface: Resource
      Sets a list of URI that uniquely identify this resource.
      Specified by:
      updateUris in interface Resource
      Parameters:
      uri - an URI for this resource
    • setName

      public void setName(String name)
      Description copied from interface: Resource
      Sets a name for this resource. The name must be unique.
      Specified by:
      setName in interface Resource
      Parameters:
      name - the name of this resource
    • getType

      public String getType()
      Description copied from interface: Resource
      Returns a string representing the type of this resource.
      Specified by:
      getType in interface Resource
      Returns:
      the type of this resource or null if not defined
    • setType

      public void setType(String type)
      Description copied from interface: Resource
      Sets a string representing the type of this resource.
      Specified by:
      setType in interface Resource
      Parameters:
      type - the type of this resource or null if not defined
    • getScopes

      public List<Scope> getScopes()
      Description copied from interface: Resource
      Returns a List containing all the Scope associated with this resource.
      Specified by:
      getScopes in interface Resource
      Returns:
      a list with all scopes associated with this resource
    • getIconUri

      public String getIconUri()
      Description copied from interface: Resource
      Returns an icon URI for this resource.
      Specified by:
      getIconUri in interface Resource
      Returns:
      a uri for an icon
    • setIconUri

      public void setIconUri(String iconUri)
      Description copied from interface: Resource
      Sets an icon URI for this resource.
      Specified by:
      setIconUri in interface Resource
      Parameters:
      iconUri - an uri for an icon
    • getResourceServer

      public ResourceServer getResourceServer()
      Description copied from interface: Resource
      Returns the ResourceServer to where this resource belongs to.
      Specified by:
      getResourceServer in interface Resource
      Returns:
      the resource server associated with this resource
    • getOwner

      public String getOwner()
      Description copied from interface: Resource
      Returns the resource's owner, which is usually an identifier that uniquely identifies the resource's owner.
      Specified by:
      getOwner in interface Resource
      Returns:
      the owner of this resource
    • isOwnerManagedAccess

      public boolean isOwnerManagedAccess()
      Description copied from interface: Resource
      Indicates if this resource can be managed by the resource owner.
      Specified by:
      isOwnerManagedAccess in interface Resource
      Returns:
      true if this resource can be managed by the resource owner. Otherwise, false.
    • setOwnerManagedAccess

      public void setOwnerManagedAccess(boolean ownerManagedAccess)
      Description copied from interface: Resource
      Sets if this resource can be managed by the resource owner.
      Specified by:
      setOwnerManagedAccess in interface Resource
      Parameters:
      ownerManagedAccess - true indicates that this resource can be managed by the resource owner.
    • updateScopes

      public void updateScopes(Set<Scope> toUpdate)
      Description copied from interface: Resource
      Update the set of scopes associated with this resource.
      Specified by:
      updateScopes in interface Resource
      Parameters:
      toUpdate - the list of scopes to update
    • getAttributes

      public Map<String,List<String>> getAttributes()
      Description copied from interface: Resource
      Returns the attributes associated with this resource.
      Specified by:
      getAttributes in interface Resource
      Returns:
      a map holding the attributes associated with this resource
    • getSingleAttribute

      public String getSingleAttribute(String name)
      Description copied from interface: Resource
      Returns the first value of an attribute with the given name
      Specified by:
      getSingleAttribute in interface Resource
      Parameters:
      name - of the attribute
      Returns:
      the first value of an attribute
    • getAttribute

      public List<String> getAttribute(String name)
      Description copied from interface: Resource
      Returns the values of an attribute with the given name
      Specified by:
      getAttribute in interface Resource
      Parameters:
      name - of the attribute
      Returns:
      the values of an attribute
    • setAttribute

      public void setAttribute(String name, List<String> values)
      Description copied from interface: Resource
      Sets an attribute with the given name and values.
      Specified by:
      setAttribute in interface Resource
      Parameters:
      name - the attribute name
      values - the attribute values
    • removeAttribute

      public void removeAttribute(String name)
      Specified by:
      removeAttribute in interface Resource
    • toEntity

      public static ResourceEntity toEntity(jakarta.persistence.EntityManager em, Resource resource)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object