com.sun.identity.saml.assertion
Class Subject

java.lang.Object
  |
  +--com.sun.identity.saml.assertion.Subject

public class Subject
extends java.lang.Object

The 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 element SHOULD NOT identify more than one principal.


Constructor Summary
Subject(org.w3c.dom.Element subjectElement)
          This constructor builds a subject element from an existing XML block which has already been built into a DOM.
Subject(NameIdentifier nameIdentifier)
          This constructor creates a Subject object from a NameIdentifier object.
Subject(NameIdentifier nameIdentifier, SubjectConfirmation subjectConfirmation)
          This constructor creates a Subject object from a NameIdentifier object and a SubjectConfirmation object.
Subject(SubjectConfirmation subjectConfirmation)
          This constructor creates a Subject object from a SubjectConfirmation object.
 
Method Summary
 boolean equals(Subject subject)
          Checks for equality between this object and the Subject passed down as paramater.
 NameIdentifier getNameIdentifier()
          Get the NameIdentifier within the Subject element
 SubjectConfirmation getSubjectConfirmation()
          Get the SubjectConfirmation within the Subject element
 boolean removeNameIdentifier()
          Remove NameIdentifier from the subject return boolean indicating success or failure of the operation.
 boolean removeSubjectConfirmation()
          Remove subject confirmation from the subject return boolean indicating success or failure of the operation.
 boolean setNameIdentifier(NameIdentifier nameIdentifier)
          Set the NameIdentifier to the subject
 boolean setSubjectConfirmation(SubjectConfirmation subjectConfirmation)
          Set the subject confirmation to the subject
 java.lang.String toString()
          Create a String representation of the element
 java.lang.String toString(boolean includeNS, boolean declareNS)
          Create a String representation of the <Subject> element
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Subject

public Subject(NameIdentifier nameIdentifier,
               SubjectConfirmation subjectConfirmation)
        throws SAMLException
This constructor creates a Subject object from a NameIdentifier object and a SubjectConfirmation object.
Parameters:
nameIdentifier: - NameIdentifier object.
subjectConfirmation: - SubjectConfirmation object.
Throws:
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
This constructor creates a Subject object from a NameIdentifier object.
Parameters:
nameIdentifier: - NameIdentifier object.
Throws:
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(org.w3c.dom.Element subjectElement)
        throws SAMLException
This constructor builds 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
This constructor creates a Subject object from a SubjectConfirmation object.
Parameters:
subjectConfirmation: - SubjectConfirmation object to be added to the object.
Throws:
SAMLException - if subjectConfirmation is null.
Method Detail

equals

public boolean equals(Subject subject)
Checks for equality between this object and the Subject passed down as paramater. if NameIdentifier is present, checks for its equality by calling Nameidentifier.equals(). if SubjectConfirmation is present calls equals() method of SubjectConfirmation too passing in the subject's SubjectConfirmation element.
Parameters:
Subject - to be checked
Returns:
boolean represting whether the two are EXACTLY equal or not

setSubjectConfirmation

public boolean setSubjectConfirmation(SubjectConfirmation subjectConfirmation)
Set the subject confirmation to the subject
Parameters:
subjectConfirmation: - SubjectConfirmation to be set. return boolean indicating success or failure of the operation.

removeSubjectConfirmation

public boolean removeSubjectConfirmation()
Remove subject confirmation from the subject return boolean indicating success or failure of the operation.

setNameIdentifier

public boolean setNameIdentifier(NameIdentifier nameIdentifier)
Set the NameIdentifier to the subject
Parameters:
nameIdentifier: - NameIdentifier to be set. return boolean indicating success or failure of the operation.

removeNameIdentifier

public boolean removeNameIdentifier()
Remove NameIdentifier from the subject return boolean indicating success or failure of the operation.

getNameIdentifier

public NameIdentifier getNameIdentifier()
Get the NameIdentifier within the Subject element
Returns:
NameIdentifier object, within this Subject.

getSubjectConfirmation

public SubjectConfirmation getSubjectConfirmation()
Get the SubjectConfirmation within the Subject element
Returns:
SubjectConfirmation object, within this Subject if exists else null

toString

public java.lang.String toString()
Create a String representation of the element
Overrides:
toString in class java.lang.Object
Returns:
A string containing the valid XML for this element By default name space name is prepended to the element name eg <saml:Subject>

toString

public java.lang.String toString(boolean includeNS,
                                 boolean declareNS)
Create a String representation of the <Subject> element
Parameters:
boolean - includeNS if true prepends all elements by their Namspace name eg
boolean - declareNS if true includes the namespace within the generated XML.
Returns:
A string containing the valid XML for this element