Package com.sun.identity.saml.assertion
Class Subject
- java.lang.Object
-
- com.sun.identity.saml.assertion.Subject
-
- Direct Known Subclasses:
FSSubject,ProxySubject
public class Subject extends Object
TheSubjectelement specifies one or more subjects. It contains either or both of the following elements:NameIdentifierAn identification of a subject by its name and security domain.SubjectConfirmationInformation that allows the subject to be authenticated. If aSubjectelement contains more than one subject specification, the issuer is asserting that the surrounding statement is true for all of the subjects specified. For example, if both aNameIdentifierand aSubjectConfirmationelement are present, the issuer is asserting that the statement is true of both subjects being identified. ASubjectelement SHOULD NOT identify more than one principal.
-
-
Field Summary
Fields Modifier and Type Field Description protected NameIdentifier_nameIdentifierprotected SubjectConfirmation_subjectConfirmation
-
Constructor Summary
Constructors Modifier Constructor Description protectedSubject()Default constructorSubject(NameIdentifier nameIdentifier)Constructs a Subject object from aNameIdentifierobject.Subject(NameIdentifier nameIdentifier, SubjectConfirmation subjectConfirmation)Constructs a Subject object from aNameIdentifierobject and aSubjectConfirmationobject.Subject(SubjectConfirmation subjectConfirmation)Constructs a Subject object from aSubjectConfirmationobject.Subject(Element subjectElement)Constructs a subject element from an existing XML block which has already been built into a DOM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected NameIdentifiercreateNameIdentifier(Element nameIdentifierElement)protected SubjectConfirmationcreateSubjectConfirmation(Element subjectConfirmationElement)booleanequals(Subject subject)Checks for equality between this object and the Subject passed down as parameter.NameIdentifiergetNameIdentifier()Gets theNameIdentifierwithin the Subject elementSubjectConfirmationgetSubjectConfirmation()Gets theSubjectConfirmationwithin the Subject elementbooleanremoveNameIdentifier()RemovesNameIdentifierfrom the subject.booleanremoveSubjectConfirmation()Removes subject confirmation from the subject.booleansetNameIdentifier(NameIdentifier nameIdentifier)Sets theNameIdentifierto the subject.booleansetSubjectConfirmation(SubjectConfirmation subjectConfirmation)Sets the subject confirmation to the subjectStringtoString()Returns a String representation of the element.StringtoString(boolean includeNS, boolean declareNS)Returns a String representation of the<Subject>element.
-
-
-
Field Detail
-
_subjectConfirmation
protected SubjectConfirmation _subjectConfirmation
-
_nameIdentifier
protected NameIdentifier _nameIdentifier
-
-
Constructor Detail
-
Subject
protected Subject()
Default constructor
-
Subject
public Subject(NameIdentifier nameIdentifier, SubjectConfirmation subjectConfirmation) throws SAMLException
Constructs a Subject object from aNameIdentifierobject and aSubjectConfirmationobject.- Parameters:
nameIdentifier-NameIdentifierobject.subjectConfirmation-SubjectConfirmationobject.- Throws:
SAMLException- if it could not process the Element properly, implying that there is an error in the sender or in the element definition.
-
Subject
public Subject(NameIdentifier nameIdentifier) throws SAMLException
Constructs a Subject object from aNameIdentifierobject.- Parameters:
nameIdentifier-NameIdentifierobject.- Throws:
SAMLException- if it could not process theElementproperly, implying that there is an error in the sender or in the element definition.
-
Subject
public Subject(Element subjectElement) throws SAMLException
Constructs a subject element from an existing XML block which has already been built into a DOM.- Parameters:
subjectElement- An Element representing DOM tree for Subject object- Throws:
SAMLException- if it could not process the Element properly, implying that there is an error in the sender or in the element definition.
-
Subject
public Subject(SubjectConfirmation subjectConfirmation) throws SAMLException
Constructs a Subject object from aSubjectConfirmationobject.- Parameters:
subjectConfirmation-SubjectConfirmationobject to be added to the object.- Throws:
SAMLException- ifsubjectConfirmationis null.
-
-
Method Detail
-
equals
public boolean equals(Subject subject)
Checks for equality between this object and the Subject passed down as parameter. IfNameIdentifieris present, checks for its equality by callingNameidentifier.equals(). ifSubjectConfirmationis present callsequals()method ofSubjectConfirmationtoo passing in the subject'sSubjectConfirmationelement.- Parameters:
subject- Subject to be checked.- Returns:
- true if this object and
subjectare equals.
-
setSubjectConfirmation
public boolean setSubjectConfirmation(SubjectConfirmation subjectConfirmation)
Sets the subject confirmation to the subject- Parameters:
subjectConfirmation-SubjectConfirmationto be set.- Returns:
- true if operation succeed.
-
removeSubjectConfirmation
public boolean removeSubjectConfirmation()
Removes subject confirmation from the subject.- Returns:
- true if the operation succeeds.
-
setNameIdentifier
public boolean setNameIdentifier(NameIdentifier nameIdentifier)
Sets theNameIdentifierto the subject.- Parameters:
nameIdentifier-NameIdentifierto be set.- Returns:
- true if the operation succeeds.
-
removeNameIdentifier
public boolean removeNameIdentifier()
RemovesNameIdentifierfrom the subject.- Returns:
- true if operation succeeds.
-
getNameIdentifier
public NameIdentifier getNameIdentifier()
Gets theNameIdentifierwithin the Subject element- Returns:
NameIdentifierobject, within this Subject.
-
getSubjectConfirmation
public SubjectConfirmation getSubjectConfirmation()
Gets theSubjectConfirmationwithin the Subject element- Returns:
SubjectConfirmationobject, within this Subject if exists else null
-
toString
public String toString()
Returns a String representation of the element.
-
toString
public String toString(boolean includeNS, boolean declareNS)
Returns a String representation of the<Subject>element.- Parameters:
includeNS- if true prepends all elements by their Namespace name example<saml:Subject>.declareNS- if true includes the namespace within the generated XML.- Returns:
- A string containing the valid XML for this element.
-
createNameIdentifier
protected NameIdentifier createNameIdentifier(Element nameIdentifierElement) throws SAMLException
- Throws:
SAMLException
-
createSubjectConfirmation
protected SubjectConfirmation createSubjectConfirmation(Element subjectConfirmationElement) throws SAMLException
- Throws:
SAMLException
-
-