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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.authorization.model.Resource
Resource.FilterOption, Resource.SearchableFields
-
-
Constructor Summary
Constructors Constructor Description ResourceAdapter(ResourceEntity entity, javax.persistence.EntityManager em, StoreFactory storeFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
List<String>
getAttribute(String name)
Returns the values of an attribute with the givenname
Map<String,List<String>>
getAttributes()
Returns the attributes associated with this resource.String
getDisplayName()
Returns the end user friendly name for this resource.ResourceEntity
getEntity()
String
getIconUri()
Returns an iconURI
for this resource.String
getId()
Returns the unique identifier for this instance.String
getName()
Returns the resource's name.String
getOwner()
Returns the resource's owner, which is usually an identifier that uniquely identifies the resource's owner.ResourceServer
getResourceServer()
Returns theResourceServer
to where this resource belongs to.List<Scope>
getScopes()
String
getSingleAttribute(String name)
Returns the first value of an attribute with the givenname
String
getType()
Returns a string representing the type of this resource.Set<String>
getUris()
int
hashCode()
boolean
isOwnerManagedAccess()
Indicates if this resource can be managed by the resource owner.void
removeAttribute(String name)
void
setAttribute(String name, List<String> values)
Sets an attribute with the givenname
andvalues
.void
setDisplayName(String name)
Sets an end user friendly name for this resource.void
setIconUri(String iconUri)
Sets an iconURI
for this resource.void
setName(String name)
Sets a name for this resource.void
setOwnerManagedAccess(boolean ownerManagedAccess)
Sets if this resource can be managed by the resource owner.void
setType(String type)
Sets a string representing the type of this resource.static ResourceEntity
toEntity(javax.persistence.EntityManager em, Resource resource)
void
updateScopes(Set<Scope> toUpdate)
Update the set of scopes associated with this resource.void
updateUris(Set<String> uri)
Sets a list ofURI
that uniquely identify this resource.-
Methods inherited from class org.keycloak.authorization.model.AbstractAuthorizationModel
throwExceptionIfReadonly
-
-
-
-
Constructor Detail
-
ResourceAdapter
public ResourceAdapter(ResourceEntity entity, javax.persistence.EntityManager em, StoreFactory storeFactory)
-
-
Method Detail
-
getEntity
public ResourceEntity getEntity()
- Specified by:
getEntity
in interfaceJpaModel<ResourceEntity>
-
getId
public String getId()
Description copied from interface:Resource
Returns the unique identifier for this instance.
-
getName
public String getName()
Description copied from interface:Resource
Returns the resource's name.
-
getDisplayName
public String getDisplayName()
Description copied from interface:Resource
Returns the end user friendly name for this resource. If not defined, value forResource.getName()
is returned.- Specified by:
getDisplayName
in interfaceResource
- 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 interfaceResource
- Parameters:
name
- the name of this resource
-
updateUris
public void updateUris(Set<String> uri)
Description copied from interface:Resource
Sets a list ofURI
that uniquely identify this resource.- Specified by:
updateUris
in interfaceResource
- Parameters:
uri
- anURI
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.
-
getType
public String getType()
Description copied from interface:Resource
Returns a string representing the type of this resource.
-
setType
public void setType(String type)
Description copied from interface:Resource
Sets a string representing the type of this resource.
-
getIconUri
public String getIconUri()
Description copied from interface:Resource
Returns an iconURI
for this resource.- Specified by:
getIconUri
in interfaceResource
- Returns:
- a uri for an icon
-
setIconUri
public void setIconUri(String iconUri)
Description copied from interface:Resource
Sets an iconURI
for this resource.- Specified by:
setIconUri
in interfaceResource
- Parameters:
iconUri
- an uri for an icon
-
getResourceServer
public ResourceServer getResourceServer()
Description copied from interface:Resource
Returns theResourceServer
to where this resource belongs to.- Specified by:
getResourceServer
in interfaceResource
- 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.
-
isOwnerManagedAccess
public boolean isOwnerManagedAccess()
Description copied from interface:Resource
Indicates if this resource can be managed by the resource owner.- Specified by:
isOwnerManagedAccess
in interfaceResource
- 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 interfaceResource
- 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 interfaceResource
- 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 interfaceResource
- 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 givenname
- Specified by:
getSingleAttribute
in interfaceResource
- 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 givenname
- Specified by:
getAttribute
in interfaceResource
- 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 givenname
andvalues
.- Specified by:
setAttribute
in interfaceResource
- Parameters:
name
- the attribute namevalues
- the attribute values
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttribute
in interfaceResource
-
toEntity
public static ResourceEntity toEntity(javax.persistence.EntityManager em, Resource resource)
-
-