Package org.keycloak.authorization.model
Interface Resource
-
- All Known Implementing Classes:
AbstractResourceModel
,MapResourceAdapter
,ResourceAdapter
,ResourceAdapter
public interface Resource
Represents a resource, which is usually protected by a set of policies within a resource server.- Author:
- Pedro Igor
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Resource.FilterOption
static class
Resource.SearchableFields
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.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()
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.void
updateScopes(Set<Scope> scopes)
Update the set of scopes associated with this resource.void
updateUris(Set<String> uri)
Sets a list ofURI
that uniquely identify this resource.
-
-
-
Method Detail
-
getId
String getId()
Returns the unique identifier for this instance.- Returns:
- the unique identifier for this instance
-
getName
String getName()
Returns the resource's name.- Returns:
- the name of this resource
-
setName
void setName(String name)
Sets a name for this resource. The name must be unique.- Parameters:
name
- the name of this resource
-
getDisplayName
String getDisplayName()
Returns the end user friendly name for this resource. If not defined, value forgetName()
is returned.- Returns:
- the friendly name for this resource
-
setDisplayName
void setDisplayName(String name)
Sets an end user friendly name for this resource.- Parameters:
name
- the name of this resource
-
updateUris
void updateUris(Set<String> uri)
Sets a list ofURI
that uniquely identify this resource.- Parameters:
uri
- anURI
for this resource
-
getType
String getType()
Returns a string representing the type of this resource.- Returns:
- the type of this resource or null if not defined
-
setType
void setType(String type)
Sets a string representing the type of this resource.- Parameters:
type
- the type of this resource or null if not defined
-
setIconUri
void setIconUri(String iconUri)
Sets an iconURI
for this resource.- Parameters:
iconUri
- an uri for an icon
-
getResourceServer
ResourceServer getResourceServer()
Returns theResourceServer
to where this resource belongs to.- Returns:
- the resource server associated with this resource
-
getOwner
String getOwner()
Returns the resource's owner, which is usually an identifier that uniquely identifies the resource's owner.- Returns:
- the owner of this resource
-
isOwnerManagedAccess
boolean isOwnerManagedAccess()
Indicates if this resource can be managed by the resource owner.- Returns:
true
if this resource can be managed by the resource owner. Otherwise,false
.
-
setOwnerManagedAccess
void setOwnerManagedAccess(boolean ownerManagedAccess)
Sets if this resource can be managed by the resource owner.- Parameters:
ownerManagedAccess
-true
indicates that this resource can be managed by the resource owner.
-
updateScopes
void updateScopes(Set<Scope> scopes)
Update the set of scopes associated with this resource.- Parameters:
scopes
- the list of scopes to update
-
getAttributes
Map<String,List<String>> getAttributes()
Returns the attributes associated with this resource.- Returns:
- a map holding the attributes associated with this resource
-
getSingleAttribute
String getSingleAttribute(String name)
Returns the first value of an attribute with the givenname
- Parameters:
name
- of the attribute- Returns:
- the first value of an attribute
-
getAttribute
List<String> getAttribute(String name)
Returns the values of an attribute with the givenname
- Parameters:
name
- of the attribute- Returns:
- the values of an attribute
-
setAttribute
void setAttribute(String name, List<String> values)
Sets an attribute with the givenname
andvalues
.- Parameters:
name
- the attribute namevalues
- the attribute values
-
removeAttribute
void removeAttribute(String name)
-
-