Package com.sun.identity.saml.assertion
Class Subject
java.lang.Object
com.sun.identity.saml.assertion.Subject
The
Subject
element specifies one or more subjects. It contains
either or both of the following elements:
NameIdentifier
An identification of a subject by its name and security domain.
SubjectConfirmation
Information that allows the subject to be authenticated.
If a Subject
element 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 a
NameIdentifier
and a SubjectConfirmation
element
are present, the issuer is asserting that the statement is true of both
subjects being identified. A Subject
element SHOULD NOT identify
more than one principal.-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
Subject()
Default constructorSubject
(NameIdentifier nameIdentifier) Constructs a Subject object from aNameIdentifier
object.Subject
(NameIdentifier nameIdentifier, SubjectConfirmation subjectConfirmation) Constructs a Subject object from aNameIdentifier
object and aSubjectConfirmation
object.Subject
(SubjectConfirmation subjectConfirmation) Constructs a Subject object from aSubjectConfirmation
object.Constructs a subject element from an existing XML block which has already been built into a DOM. -
Method Summary
Modifier and TypeMethodDescriptionprotected NameIdentifier
createNameIdentifier
(Element nameIdentifierElement) protected SubjectConfirmation
createSubjectConfirmation
(Element subjectConfirmationElement) boolean
Checks for equality between this object and the Subject passed down as parameter.Gets theNameIdentifier
within the Subject elementGets theSubjectConfirmation
within the Subject elementboolean
RemovesNameIdentifier
from the subject.boolean
Removes subject confirmation from the subject.boolean
setNameIdentifier
(NameIdentifier nameIdentifier) Sets theNameIdentifier
to the subject.boolean
setSubjectConfirmation
(SubjectConfirmation subjectConfirmation) Sets the subject confirmation to the subjecttoString()
Returns a String representation of the element.toString
(boolean includeNS, boolean declareNS) Returns a String representation of the<Subject>
element.
-
Field Details
-
_subjectConfirmation
-
_nameIdentifier
-
-
Constructor Details
-
Subject
protected Subject()Default constructor -
Subject
public Subject(NameIdentifier nameIdentifier, SubjectConfirmation subjectConfirmation) throws SAMLException Constructs a Subject object from aNameIdentifier
object and aSubjectConfirmation
object.- Parameters:
nameIdentifier
-NameIdentifier
object.subjectConfirmation
-SubjectConfirmation
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
Constructs a Subject object from aNameIdentifier
object.- Parameters:
nameIdentifier
-NameIdentifier
object.- Throws:
SAMLException
- if it could not process theElement
properly, implying that there is an error in the sender or in the element definition.
-
Subject
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
Constructs a Subject object from aSubjectConfirmation
object.- Parameters:
subjectConfirmation
-SubjectConfirmation
object to be added to the object.- Throws:
SAMLException
- ifsubjectConfirmation
is null.
-
-
Method Details
-
equals
Checks for equality between this object and the Subject passed down as parameter. IfNameIdentifier
is present, checks for its equality by callingNameidentifier.equals()
. ifSubjectConfirmation
is present callsequals()
method ofSubjectConfirmation
too passing in the subject'sSubjectConfirmation
element.- Parameters:
subject
- Subject to be checked.- Returns:
- true if this object and
subject
are equals.
-
setSubjectConfirmation
Sets the subject confirmation to the subject- Parameters:
subjectConfirmation
-SubjectConfirmation
to be set.- Returns:
- true if operation succeed.
-
removeSubjectConfirmation
public boolean removeSubjectConfirmation()Removes subject confirmation from the subject.- Returns:
- true if the operation succeeds.
-
setNameIdentifier
Sets theNameIdentifier
to the subject.- Parameters:
nameIdentifier
-NameIdentifier
to be set.- Returns:
- true if the operation succeeds.
-
removeNameIdentifier
public boolean removeNameIdentifier()RemovesNameIdentifier
from the subject.- Returns:
- true if operation succeeds.
-
getNameIdentifier
Gets theNameIdentifier
within the Subject element- Returns:
NameIdentifier
object, within this Subject.
-
getSubjectConfirmation
Gets theSubjectConfirmation
within the Subject element- Returns:
SubjectConfirmation
object, within this Subject if exists else null
-
toString
Returns a String representation of the element. -
toString
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
- Throws:
SAMLException
-
createSubjectConfirmation
protected SubjectConfirmation createSubjectConfirmation(Element subjectConfirmationElement) throws SAMLException - Throws:
SAMLException
-