Class NotSubject
- java.lang.Object
-
- com.sun.identity.entitlement.LogicalSubject
-
- com.sun.identity.entitlement.NotSubject
-
- All Implemented Interfaces:
EntitlementSubject
public class NotSubject extends LogicalSubject
This class wrapped on an Entitlement Subject object to provide boolean NOT. Membership ofNotSubjectis satisfied in the user is not a member of the nestedEntitlementSubject. We @JsonIgnore getESubjects and setESubjects (NOTE the 's' on the end) so that we don't indicate via JSON schema exposed that we take multiple subject types. We extend LogicalSubject but ensure that we are only allowing a singleEntitlementSubjectto be referenced by this class.
-
-
Constructor Summary
Constructors Constructor Description NotSubject()Constructs NotSubjectNotSubject(EntitlementSubject eSubject)Constructs NotSubjectNotSubject(EntitlementSubject eSubject, String pSubjectName)Constructs NotSubject
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Returnstrueif the passed in object is equal to this objectSubjectDecisionevaluate(String realm, SubjectAttributesManager mgr, Subject subject, String resourceName, Map<String,Set<String>> environment)ReturnsSubjectDecisionofEntitlementSubjectevaluation.EntitlementSubjectgetESubject()Returns nested EntitlementSubject.Set<EntitlementSubject>getESubjects()Returns the nested EntitlementSubject(s)StringgetPSubjectName()Returns OpenAM policy Subject nameSet<String>getRequiredAttributeNames()Returns required attribute names.Map<String,Set<String>>getSearchIndexAttributes()Returns search index attributes.StringgetState()Returns state of the object.inthashCode()Returns hash code of the objectbooleanhasRejectedMemberInSubtree()Returns whether this wrapper, or any logical subject nested below it, had a member class name refused byLogicalSubject.setState(String).booleanisIdentity()Returnstrueis this subject is an identity object.voidsetESubject(EntitlementSubject eSubject)Sets nested EntitlementSubject.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 com.sun.identity.entitlement.LogicalSubject
clearMemberRejection, getRejectedMembers, isMemberRejected, markMemberRejected
-
-
-
-
Constructor Detail
-
NotSubject
public NotSubject()
Constructs NotSubject
-
NotSubject
public NotSubject(EntitlementSubject eSubject)
Constructs NotSubject- Parameters:
eSubject- nested EntitlementSubject
-
NotSubject
public NotSubject(EntitlementSubject eSubject, String pSubjectName)
Constructs NotSubject- Parameters:
eSubject- eSubject nested EntitlementSubjectpSubjectName- subject name as used in OpenAM policy, this is relevant only when NotrESubject was created from OpenAM policy Subject
-
-
Method Detail
-
setState
public void setState(String state)
Sets state of the object- Specified by:
setStatein interfaceEntitlementSubject- Overrides:
setStatein classLogicalSubject- Parameters:
state- State of the object encoded as string
-
getState
public String getState()
Returns state of the object.- Specified by:
getStatein interfaceEntitlementSubject- Overrides:
getStatein classLogicalSubject- Returns:
- state of the object encoded as string.
-
evaluate
public SubjectDecision evaluate(String realm, SubjectAttributesManager mgr, Subject subject, String resourceName, Map<String,Set<String>> environment) throws EntitlementException
ReturnsSubjectDecisionofEntitlementSubjectevaluation.- Parameters:
realm- Realm name.subject- EntitlementSubject who is under evaluation.resourceName- Resource name.environment- Environment parameters.- Returns:
SubjectDecisionofEntitlementSubjectevaluation- Throws:
EntitlementException- if any errors occur.
-
setESubject
public void setESubject(EntitlementSubject eSubject)
Sets nested EntitlementSubject.- Parameters:
eSubject- nested EntitlementSubject.
-
setESubjects
public void setESubjects(Set<EntitlementSubject> eSubjects)
Sets the nested EntitlementSubject(s)- Overrides:
setESubjectsin classLogicalSubject- Parameters:
eSubjects- the nested EntitlementSubject(s)
-
getESubject
public EntitlementSubject getESubject()
Returns nested EntitlementSubject.- Returns:
- nested EntitlementSubject.
-
getESubjects
public Set<EntitlementSubject> getESubjects()
Returns the nested EntitlementSubject(s)- Overrides:
getESubjectsin classLogicalSubject- Returns:
- the nested EntitlementSubject(s)
-
hasRejectedMemberInSubtree
public boolean hasRejectedMemberInSubtree()
Returns whether this wrapper, or any logical subject nested below it, had a member class name refused byLogicalSubject.setState(String).LogicalSubject.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.A
NotSubjectwith no member at all counts as damaged too, not only one whose membersetState(String)refused. Its ownevaluate(java.lang.String, com.sun.identity.entitlement.SubjectAttributesManager, javax.security.auth.Subject, java.lang.String, java.util.Map<java.lang.String, java.util.Set<java.lang.String>>)already denies on the missing member, but an enclosingNotSubjectwould negate that deny into a match for everyone. The two are indistinguishable from the outside anyway: a policy stored by a version that dropped the refused member instead of re-emitting it comes back with the member simply absent, and aNOTwithout a member is not a policy statement to begin with - it already denies on its own.- Overrides:
hasRejectedMemberInSubtreein classLogicalSubject- Returns:
trueif a member was refused anywhere in this subtree.
-
setPSubjectName
public void setPSubjectName(String pSubjectName)
Sets OpenAM policy Subject name- Overrides:
setPSubjectNamein classLogicalSubject- Parameters:
pSubjectName- subject name as used in OpenAM policy, this is relevant only when NotrESubject was created from OpenAM policy Subject
-
getPSubjectName
public String getPSubjectName()
Returns OpenAM policy Subject name- Overrides:
getPSubjectNamein classLogicalSubject- Returns:
- subject name as used in OpenAM policy, this is relevant only when NotrESubject was created from OpenAM policy Subject
-
toJSONObject
public org.json.JSONObject toJSONObject() throws org.json.JSONExceptionReturns JSONObject mapping of the object- Overrides:
toJSONObjectin classLogicalSubject- 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.- Overrides:
toStringin classLogicalSubject- Returns:
- string representation of the object.
-
equals
public boolean equals(Object obj)
Returnstrueif the passed in object is equal to this object- Overrides:
equalsin classLogicalSubject- Parameters:
obj- object to check for equality- Returns:
trueif the passed in object is equal to this object
-
hashCode
public int hashCode()
Returns hash code of the object- Overrides:
hashCodein classLogicalSubject- Returns:
- hash code of the object
-
getSearchIndexAttributes
public Map<String,Set<String>> getSearchIndexAttributes()
Returns search index attributes.- Specified by:
getSearchIndexAttributesin interfaceEntitlementSubject- Overrides:
getSearchIndexAttributesin classLogicalSubject- Returns:
- search index attributes.
-
getRequiredAttributeNames
public Set<String> getRequiredAttributeNames()
Returns required attribute names.- Specified by:
getRequiredAttributeNamesin interfaceEntitlementSubject- Overrides:
getRequiredAttributeNamesin classLogicalSubject- Returns:
- required attribute names.
-
isIdentity
public boolean isIdentity()
Returnstrueis this subject is an identity object.- Specified by:
isIdentityin interfaceEntitlementSubject- Overrides:
isIdentityin classLogicalSubject- Returns:
trueis this subject is an identity object.
-
-