Class LogicalSubject
- java.lang.Object
-
- com.sun.identity.entitlement.LogicalSubject
-
- All Implemented Interfaces:
EntitlementSubject
- Direct Known Subclasses:
AndSubject,NotSubject,OrSubject
public abstract class LogicalSubject extends Object implements EntitlementSubject
Base class forOrSubejctandAndSubejct.
-
-
Constructor Summary
Constructors Constructor Description LogicalSubject()Constructor.LogicalSubject(Set<EntitlementSubject> eSubjects)Constructor.LogicalSubject(Set<EntitlementSubject> eSubjects, String pSubjectName)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclearMemberRejection()Clears a recorded refusal.booleanequals(Object obj)Returnstrueif the passed in object is equal to this objectSet<EntitlementSubject>getESubjects()Returns the nested EntitlementSubject(s)StringgetPSubjectName()Returns OpenAM policy Subject nameprotected List<org.json.JSONObject>getRejectedMembers()Returns the refused members, kept verbatim for re-emission bytoJSONObject().Set<String>getRequiredAttributeNames()Returns the required attribute names.Map<String,Set<String>>getSearchIndexAttributes()Returns the search index attributes.StringgetState()Returns state of the objectinthashCode()Returns hash code of the objectbooleanhasRejectedMemberInSubtree()Returns whether this wrapper, or any logical subject nested below it, had a member class name refused bysetState(String).booleanisIdentity()Returnstrueis this subject is an identity object.booleanisMemberRejected()Returns whethersetState(String)refused a member class name, leaving this wrapper with fewer members than the stored policy declares.protected voidmarkMemberRejected(org.json.JSONObject rejectedMember)Records that a member could not be rebuilt from the state being applied, keeping the member's JSON so thattoJSONObject()can write it back out.voidsetESubjects(Set<EntitlementSubject> eSubjects)Sets the nested EntitlementSubject(s)voidsetPSubjectName(String pSubjectName)Sets OpenAM policy Subject namevoidsetState(String state)Sets state of the objectorg.json.JSONObjecttoJSONObject()Returns JSONObject mapping of the objectStringtoString()Returns string representation of the object-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.sun.identity.entitlement.EntitlementSubject
evaluate
-
-
-
-
Constructor Detail
-
LogicalSubject
public LogicalSubject()
Constructor.
-
LogicalSubject
public LogicalSubject(Set<EntitlementSubject> eSubjects)
Constructor.- Parameters:
eSubjects- wrapped EntitlementSubject(s)
-
LogicalSubject
public LogicalSubject(Set<EntitlementSubject> eSubjects, String pSubjectName)
Constructor.- Parameters:
eSubjects- wrapped EntitlementSubject(s)pSubjectName- subject name as used in OpenAM policy, this is relevant only when UserESubject was created from OpenAM policy Subject
-
-
Method Detail
-
setState
public void setState(String state)
Sets state of the object- Specified by:
setStatein interfaceEntitlementSubject- Parameters:
state- State of the object encoded as string
-
getState
public String getState()
Returns state of the object- Specified by:
getStatein interfaceEntitlementSubject- Returns:
- state of the object encoded as string
-
setESubjects
public void setESubjects(Set<EntitlementSubject> eSubjects)
Sets the nested EntitlementSubject(s)- Parameters:
eSubjects- the nested EntitlementSubject(s)
-
markMemberRejected
protected void markMemberRejected(org.json.JSONObject rejectedMember)
Records that a member could not be rebuilt from the state being applied, keeping the member's JSON so thattoJSONObject()can write it back out. Subclasses that read the member themselves -NotSubjectkeeps a single member of its own - have to call this, or a refusal below them stays invisible tohasRejectedMemberInSubtree()and an enclosingNOTnegates the resulting deny back into a match.- Parameters:
rejectedMember- the refused member as it appeared in the state, ornullwhen it was not even a JSON object; an empty object is then re-emitted in its place, which the next load refuses again and so keeps the wrapper fail-closed across a save.
-
clearMemberRejection
protected void clearMemberRejection()
Clears a recorded refusal. Called whenever the members are redefined wholesale, so that programmatic construction is unaffected by what a previous state string contained.
-
getRejectedMembers
protected List<org.json.JSONObject> getRejectedMembers()
Returns the refused members, kept verbatim for re-emission bytoJSONObject().- Returns:
- the refused members; never
null.
-
isMemberRejected
public boolean isMemberRejected()
Returns whethersetState(String)refused a member class name, leaving this wrapper with fewer members than the stored policy declares.Any subclass whose evaluation gets weaker as members are dropped must consult this before evaluating:
AndSubjectis satisfied by an empty member set, so evaluating the truncated set would grant what the stored policy restricts.OrSubjectdenies on an empty set and only gets stricter as members are dropped, so it needs no guard. A subclass that negates its member must usehasRejectedMemberInSubtree()instead.- Returns:
trueif at least one member was rejected.
-
hasRejectedMemberInSubtree
public boolean hasRejectedMemberInSubtree()
Returns whether this wrapper, or any logical subject nested below it, had a member class name refused bysetState(String).isMemberRejected()deliberately reports this wrapper's own refusal only: forAndSubject/OrSubjecta refusal further down is already handled where it happened, because the damaged member denies and a denying member can only make an AND or an OR stricter. Negation is the exception -NotSubjectturns its member's decision around, so the damaged member's deny would come back out of theNOTas a match. It has to look at the whole subtree.- Returns:
trueif a member was refused anywhere in this subtree.
-
getESubjects
public Set<EntitlementSubject> getESubjects()
Returns the nested EntitlementSubject(s)- Returns:
- the nested EntitlementSubject(s)
-
setPSubjectName
public void setPSubjectName(String pSubjectName)
Sets OpenAM policy Subject name- Parameters:
pSubjectName- subject name as used in OpenAM policy, this is relevant only when UserESubject was created from OpenAM policy Subject
-
getPSubjectName
public String getPSubjectName()
Returns OpenAM policy Subject name- Returns:
- subject name as used in OpenAM policy, this is relevant only when UserESubject was created from OpenAM policy Subject
-
toJSONObject
public org.json.JSONObject toJSONObject() throws org.json.JSONExceptionReturns JSONObject mapping of the object- Returns:
- JSONObject mapping of the object
- Throws:
org.json.JSONException- if can not map to JSONObject
-
toString
public String toString()
Returns string representation of the object
-
equals
public boolean equals(Object obj)
Returnstrueif the passed in object is equal to this object
-
hashCode
public int hashCode()
Returns hash code of the object
-
getSearchIndexAttributes
public Map<String,Set<String>> getSearchIndexAttributes()
Returns the search index attributes.- Specified by:
getSearchIndexAttributesin interfaceEntitlementSubject- Returns:
- the search index attributes.
-
getRequiredAttributeNames
public Set<String> getRequiredAttributeNames()
Returns the required attribute names.- Specified by:
getRequiredAttributeNamesin interfaceEntitlementSubject- Returns:
- the required attribute names.
-
isIdentity
public boolean isIdentity()
Returnstrueis this subject is an identity object.- Specified by:
isIdentityin interfaceEntitlementSubject- Returns:
trueis this subject is an identity object.
-
-