public abstract class Privilege extends Object implements IPrivilege
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_ATTRIBUTE
application index key
|
static SearchAttribute |
APPLICATION_SEARCH_ATTRIBUTE
application search attribute
|
static String |
CREATED_BY_ATTRIBUTE
Created by index key
|
static SearchAttribute |
CREATED_BY_SEARCH_ATTRIBUTE
Created by search attribute
|
static String |
CREATION_DATE_ATTRIBUTE
Creation date index key
|
static SearchAttribute |
CREATION_DATE_SEARCH_ATTRIBUTE
Creation date index key
|
static String |
DESCRIPTION_ATTRIBUTE
Privilege description attribute name,
|
static SearchAttribute |
DESCRIPTION_SEARCH_ATTRIBUTE
Privilege description search attribute name,
|
static String |
LAST_MODIFIED_BY_ATTRIBUTE
Last modified by index key
|
static SearchAttribute |
LAST_MODIFIED_BY_SEARCH_ATTRIBUTE
Last modified by search attribute
|
static String |
LAST_MODIFIED_DATE_ATTRIBUTE
Last modified date index key
|
static SearchAttribute |
LAST_MODIFIED_DATE_SEARCH_ATTRIBUTE
Last modified date index key
|
static String |
NAME_ATTRIBUTE
Name attribute name,
|
static SearchAttribute |
NAME_SEARCH_ATTRIBUTE
Name search attribute
|
static NoSubject |
NOT_SUBJECT |
static String |
PRIVILEGE_CLASS_PROPERTY
The system property defining the default Privilege sub-class to use when constructing new privilege instances.
|
static String |
RESOURCE_MACRO_ATTRIBUTE
Macro used in condition
|
static String |
RESOURCE_MACRO_SELF
Macro used in resource name
|
static String |
RESOURCE_TYPE_UUID_ATTRIBUTE
Resource type uuid reference.
|
static SearchAttribute |
RESOURCE_TYPE_UUID_SEARCH_ATTRIBUTE
Resource type uuid reference.
|
Constructor and Description |
---|
Privilege() |
Modifier and Type | Method and Description |
---|---|
void |
canonicalizeResources(Subject adminSubject,
String realm)
Canonicalizes resource name before persistence.
|
protected ConditionDecision |
doesConditionMatch(String realm,
Subject subject,
String resourceName,
Map<String,Set<String>> environment) |
protected SubjectDecision |
doesSubjectMatch(Subject adminSubject,
String realm,
Subject subject,
String resourceName,
Map<String,Set<String>> environment) |
boolean |
equals(Object obj)
Returns
true if the passed in object is equal to this object |
abstract List<Entitlement> |
evaluate(Subject adminSubject,
String realm,
Subject subject,
String applicationName,
String normalisedResourceName,
String requestedResourceName,
Set<String> actionNames,
Map<String,Set<String>> environment,
boolean recursive,
Object context)
Returns a list of entitlement for a given subject, resource name
and environment.
|
Set<String> |
getApplicationIndexes() |
protected Map<String,Set<String>> |
getAttributes(Subject adminSubject,
String realm,
Subject subject,
String resourceName,
Map<String,Set<String>> environment) |
EntitlementCondition |
getCondition()
Returns the eCondition the privilege
|
String |
getCreatedBy()
Returns the user ID who created the policy.
|
long |
getCreationDate()
Returns creation date.
|
String |
getDescription()
Returns the description of the privilege.
|
Entitlement |
getEntitlement()
Returns entitlement defined in the privilege
|
static Privilege |
getInstance(org.json.JSONObject jo) |
String |
getLastModifiedBy()
Returns the user ID who last modified the policy.
|
long |
getLastModifiedDate()
Returns last modified date.
|
String |
getName()
Returns the name of the privilege.
|
static Privilege |
getNewInstance()
Returns entitlement privilege.
|
static Privilege |
getNewInstance(org.json.JSONObject jo) |
static Privilege |
getNewInstance(String jo) |
Set<ResourceAttribute> |
getResourceAttributes()
Returns the eResurceAttributes of the privilege
|
ResourceSaveIndexes |
getResourceSaveIndexes(Subject adminSubject,
String realm)
Returns resource save indexes.
|
String |
getResourceTypeUuid()
Retrieves the resource type uuid that is associated with this policy.
|
EntitlementSubject |
getSubject()
Returns the eSubject the privilege
|
PrivilegeType |
getType()
Returns privilege Type.
|
int |
hashCode()
Returns hash code of the object
|
protected abstract void |
init(org.json.JSONObject jo) |
boolean |
isActive()
Returns
true if this privilege is active. |
void |
setActive(boolean active)
Sets this privilege active/inactive.
|
void |
setApplicationIndexes(Set<String> indexes) |
void |
setCondition(EntitlementCondition condition)
Sets condition.
|
void |
setCreatedBy(String createdBy)
Sets the user ID who created the policy.
|
void |
setCreationDate(long creationDate)
Sets the creation date.
|
void |
setDescription(String description)
Sets the description of the privilege.
|
void |
setEntitlement(Entitlement entitlement)
Sets entitlement.
|
void |
setLastModifiedBy(String lastModifiedBy)
Sets the user ID who last modified the policy.
|
void |
setLastModifiedDate(long lastModifiedDate)
Sets the last modified date.
|
void |
setName(String name)
Sets name.
|
void |
setResourceAttributes(Set<ResourceAttribute> set)
Sets resource attributes.
|
void |
setResourceTypeUuid(String resourceTypeUuid)
Sets the resource type uuid that this policy makes reference to.
|
void |
setSubject(EntitlementSubject eSubject)
Sets entitlement subject.
|
org.json.JSONObject |
toJSONObject()
Returns JSONObject mapping of the object
|
org.json.JSONObject |
toMinimalJSONObject() |
String |
toString()
Returns string representation of the object
|
public static final String PRIVILEGE_CLASS_PROPERTY
public static final String APPLICATION_ATTRIBUTE
public static final SearchAttribute APPLICATION_SEARCH_ATTRIBUTE
public static final String CREATED_BY_ATTRIBUTE
public static final SearchAttribute CREATED_BY_SEARCH_ATTRIBUTE
public static final String LAST_MODIFIED_BY_ATTRIBUTE
public static final SearchAttribute LAST_MODIFIED_BY_SEARCH_ATTRIBUTE
public static final String CREATION_DATE_ATTRIBUTE
public static final SearchAttribute CREATION_DATE_SEARCH_ATTRIBUTE
public static final String LAST_MODIFIED_DATE_ATTRIBUTE
public static final SearchAttribute LAST_MODIFIED_DATE_SEARCH_ATTRIBUTE
public static final String NAME_ATTRIBUTE
public static final SearchAttribute NAME_SEARCH_ATTRIBUTE
public static final String RESOURCE_TYPE_UUID_ATTRIBUTE
public static final SearchAttribute RESOURCE_TYPE_UUID_SEARCH_ATTRIBUTE
public static final String RESOURCE_MACRO_SELF
public static final String RESOURCE_MACRO_ATTRIBUTE
public static final String DESCRIPTION_ATTRIBUTE
public static final SearchAttribute DESCRIPTION_SEARCH_ATTRIBUTE
public static final NoSubject NOT_SUBJECT
public static Privilege getNewInstance() throws EntitlementException
EntitlementException
- if entitlementPrivilege cannot be returned.public void setSubject(EntitlementSubject eSubject) throws EntitlementException
eSubject
- Entitlement subjectEntitlementException
- if subject is null.public String getName()
getName
in interface IPrivilege
public String getDescription()
public void setDescription(String description)
description
- Description of the privilege.public EntitlementSubject getSubject()
public EntitlementCondition getCondition()
public Set<ResourceAttribute> getResourceAttributes()
public Entitlement getEntitlement()
public void setResourceTypeUuid(String resourceTypeUuid)
resourceTypeUuid
- the resource type uuid.public String getResourceTypeUuid()
public PrivilegeType getType()
PrivilegeType
public abstract List<Entitlement> evaluate(Subject adminSubject, String realm, Subject subject, String applicationName, String normalisedResourceName, String requestedResourceName, Set<String> actionNames, Map<String,Set<String>> environment, boolean recursive, Object context) throws EntitlementException
evaluate
in interface IPrivilege
adminSubject
- Admin Subjectrealm
- Realm Namesubject
- Subject who is under evaluation.applicationName
- Application name.normalisedResourceName
- The normalised resource name.requestedResourceName
- The requested resource name.actionNames
- Set of action names.environment
- Environment parameters.recursive
- true
to perform evaluation on sub resources
from the given resource name.context
- A security contextEntitlementException
- if the result cannot be determined.public String toString()
public org.json.JSONObject toMinimalJSONObject() throws org.json.JSONException
org.json.JSONException
public org.json.JSONObject toJSONObject() throws org.json.JSONException
org.json.JSONException
- if can not map to JSONObjectprotected abstract void init(org.json.JSONObject jo)
public static Privilege getInstance(org.json.JSONObject jo) throws EntitlementException
EntitlementException
public boolean equals(Object obj)
true
if the passed in object is equal to this objectpublic int hashCode()
protected SubjectDecision doesSubjectMatch(Subject adminSubject, String realm, Subject subject, String resourceName, Map<String,Set<String>> environment) throws EntitlementException
EntitlementException
protected ConditionDecision doesConditionMatch(String realm, Subject subject, String resourceName, Map<String,Set<String>> environment) throws EntitlementException
EntitlementException
public long getCreationDate()
public void setCreationDate(long creationDate)
creationDate
- creation date.public long getLastModifiedDate()
getLastModifiedDate
in interface IPrivilege
public void setLastModifiedDate(long lastModifiedDate)
lastModifiedDate
- last modified date.public String getLastModifiedBy()
public void setLastModifiedBy(String lastModifiedBy)
lastModifiedBy
- user ID who last modified the policy.public String getCreatedBy()
public void setCreatedBy(String createdBy)
createdBy
- user ID who created the policy.public void canonicalizeResources(Subject adminSubject, String realm) throws EntitlementException
adminSubject
- Admin Subject.realm
- Realm NameEntitlementException
public ResourceSaveIndexes getResourceSaveIndexes(Subject adminSubject, String realm) throws EntitlementException
getResourceSaveIndexes
in interface IPrivilege
adminSubject
- Admin Subject.realm
- Realm NameEntitlementException
public void setName(String name) throws EntitlementException
name
- Name of privilege.EntitlementException
- if name is null or empty.public void setEntitlement(Entitlement entitlement) throws EntitlementException
entitlement
- Entitlement.EntitlementException
- if entitlement is null.public void setCondition(EntitlementCondition condition)
condition
- Condition.public void setResourceAttributes(Set<ResourceAttribute> set)
set
- Set of resource attribute.protected Map<String,Set<String>> getAttributes(Subject adminSubject, String realm, Subject subject, String resourceName, Map<String,Set<String>> environment) throws EntitlementException
EntitlementException
public boolean isActive()
true
if this privilege is active.true
if this privilege is active.public void setActive(boolean active)
active
- true
if this privilege is to be active.public static Privilege getNewInstance(String jo) throws EntitlementException
EntitlementException
public static Privilege getNewInstance(org.json.JSONObject jo) throws EntitlementException
EntitlementException
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.