Class PolicyAdapter
- java.lang.Object
-
- org.keycloak.authorization.model.AbstractAuthorizationModel
-
- org.keycloak.authorization.jpa.store.PolicyAdapter
-
- All Implemented Interfaces:
Policy,JpaModel<PolicyEntity>
public class PolicyAdapter extends AbstractAuthorizationModel implements Policy, JpaModel<PolicyEntity>
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.authorization.model.Policy
Policy.FilterOption, Policy.SearchableFields
-
-
Field Summary
-
Fields inherited from interface org.keycloak.authorization.model.Policy
CONFIG_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description PolicyAdapter(PolicyEntity entity, javax.persistence.EntityManager em, StoreFactory storeFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAssociatedPolicy(Policy associatedPolicy)voidaddResource(Resource resource)voidaddScope(Scope scope)booleanequals(Object o)Set<Policy>getAssociatedPolicies()Returns thePolicyinstances associated with this policy and used to evaluate authorization decisions when this policy applies.Map<String,String>getConfig()Returns aMapholding string-based key/value pairs representing any additional configuration for this policy.DecisionStrategygetDecisionStrategy()Returns theDecisionStrategyfor this policy.StringgetDescription()Returns the description of this policy.PolicyEntitygetEntity()StringgetId()Returns the unique identifier for this instance.LogicgetLogic()Returns theLogicfor this policy.StringgetName()Returns the name of this policy.StringgetOwner()Set<Resource>getResources()Returns theResourceinstances where this policy applies.ResourceServergetResourceServer()Returns theResourceServerwhere this policy belongs to.Set<Scope>getScopes()Returns theScopeinstances where this policy applies.StringgetType()Returns the type of this policy.inthashCode()voidputConfig(String name, String value)voidremoveAssociatedPolicy(Policy associatedPolicy)voidremoveConfig(String name)voidremoveResource(Resource resource)voidremoveScope(Scope scope)voidsetConfig(Map<String,String> config)Sets aMapwith string-based key/value pairs representing any additional configuration for this policy.voidsetDecisionStrategy(DecisionStrategy decisionStrategy)Sets the {DecisionStrategy} for this policy.voidsetDescription(String description)Sets the description for this policy.voidsetLogic(Logic logic)Sets the {Logic} for this policy.voidsetName(String name)Sets an unique name to this policy.voidsetOwner(String owner)static PolicyEntitytoEntity(javax.persistence.EntityManager em, Policy policy)-
Methods inherited from class org.keycloak.authorization.model.AbstractAuthorizationModel
throwExceptionIfReadonly
-
-
-
-
Constructor Detail
-
PolicyAdapter
public PolicyAdapter(PolicyEntity entity, javax.persistence.EntityManager em, StoreFactory storeFactory)
-
-
Method Detail
-
getEntity
public PolicyEntity getEntity()
- Specified by:
getEntityin interfaceJpaModel<PolicyEntity>
-
getId
public String getId()
Description copied from interface:PolicyReturns the unique identifier for this instance.
-
getType
public String getType()
Description copied from interface:PolicyReturns the type of this policy.
-
getDecisionStrategy
public DecisionStrategy getDecisionStrategy()
Description copied from interface:PolicyReturns theDecisionStrategyfor this policy.- Specified by:
getDecisionStrategyin interfacePolicy- Returns:
- the decision strategy defined for this policy
-
setDecisionStrategy
public void setDecisionStrategy(DecisionStrategy decisionStrategy)
Description copied from interface:PolicySets the {DecisionStrategy} for this policy.- Specified by:
setDecisionStrategyin interfacePolicy- Parameters:
decisionStrategy- for this policy
-
getLogic
public Logic getLogic()
Description copied from interface:PolicyReturns theLogicfor this policy.
-
setLogic
public void setLogic(Logic logic)
Description copied from interface:PolicySets the {Logic} for this policy.
-
getConfig
public Map<String,String> getConfig()
Description copied from interface:PolicyReturns aMapholding string-based key/value pairs representing any additional configuration for this policy.
-
setConfig
public void setConfig(Map<String,String> config)
Description copied from interface:PolicySets aMapwith string-based key/value pairs representing any additional configuration for this policy.
-
removeConfig
public void removeConfig(String name)
- Specified by:
removeConfigin interfacePolicy
-
getName
public String getName()
Description copied from interface:PolicyReturns the name of this policy.
-
setName
public void setName(String name)
Description copied from interface:PolicySets an unique name to this policy.
-
getDescription
public String getDescription()
Description copied from interface:PolicyReturns the description of this policy.- Specified by:
getDescriptionin interfacePolicy- Returns:
- a description or null of there is no description
-
setDescription
public void setDescription(String description)
Description copied from interface:PolicySets the description for this policy.- Specified by:
setDescriptionin interfacePolicy- Parameters:
description- a description
-
getResourceServer
public ResourceServer getResourceServer()
Description copied from interface:PolicyReturns theResourceServerwhere this policy belongs to.- Specified by:
getResourceServerin interfacePolicy- Returns:
- a resource server
-
getAssociatedPolicies
public Set<Policy> getAssociatedPolicies()
Description copied from interface:PolicyReturns thePolicyinstances associated with this policy and used to evaluate authorization decisions when this policy applies.- Specified by:
getAssociatedPoliciesin interfacePolicy- Returns:
- the associated policies or an empty set if no policy is associated with this policy
-
getResources
public Set<Resource> getResources()
Description copied from interface:PolicyReturns theResourceinstances where this policy applies.- Specified by:
getResourcesin interfacePolicy- Returns:
- a set with all resource instances where this policy applies. Or an empty set if there is no resource associated with this policy
-
getScopes
public Set<Scope> getScopes()
Description copied from interface:PolicyReturns theScopeinstances where this policy applies.
-
removeScope
public void removeScope(Scope scope)
- Specified by:
removeScopein interfacePolicy
-
addAssociatedPolicy
public void addAssociatedPolicy(Policy associatedPolicy)
- Specified by:
addAssociatedPolicyin interfacePolicy
-
removeAssociatedPolicy
public void removeAssociatedPolicy(Policy associatedPolicy)
- Specified by:
removeAssociatedPolicyin interfacePolicy
-
addResource
public void addResource(Resource resource)
- Specified by:
addResourcein interfacePolicy
-
removeResource
public void removeResource(Resource resource)
- Specified by:
removeResourcein interfacePolicy
-
toEntity
public static PolicyEntity toEntity(javax.persistence.EntityManager em, Policy policy)
-
-