public class Subject extends Object
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.Modifier | Constructor and Description |
---|---|
protected |
Subject()
Default constructor
|
|
Subject(Element subjectElement)
Constructs a subject element from an existing XML block
which has already been built into a DOM.
|
|
Subject(NameIdentifier nameIdentifier)
Constructs a Subject object from a
NameIdentifier object. |
|
Subject(NameIdentifier nameIdentifier,
SubjectConfirmation subjectConfirmation)
Constructs a Subject object from a
NameIdentifier
object and a SubjectConfirmation object. |
|
Subject(SubjectConfirmation subjectConfirmation)
Constructs a Subject object from a
SubjectConfirmation
object. |
Modifier and Type | Method and Description |
---|---|
protected NameIdentifier |
createNameIdentifier(Element nameIdentifierElement) |
protected SubjectConfirmation |
createSubjectConfirmation(Element subjectConfirmationElement) |
boolean |
equals(Subject subject)
Checks for equality between this object and the Subject
passed down as parameter.
|
NameIdentifier |
getNameIdentifier()
Gets the
NameIdentifier within the Subject element |
SubjectConfirmation |
getSubjectConfirmation()
Gets the
SubjectConfirmation within the Subject element |
boolean |
removeNameIdentifier()
Removes
NameIdentifier from the subject. |
boolean |
removeSubjectConfirmation()
Removes subject confirmation from the subject.
|
boolean |
setNameIdentifier(NameIdentifier nameIdentifier)
Sets the
NameIdentifier to the subject. |
boolean |
setSubjectConfirmation(SubjectConfirmation subjectConfirmation)
Sets the subject confirmation to the subject
|
String |
toString()
Returns a String representation of the element.
|
String |
toString(boolean includeNS,
boolean declareNS)
Returns a String representation of the
<Subject>
element. |
protected Subject()
public Subject(NameIdentifier nameIdentifier, SubjectConfirmation subjectConfirmation) throws SAMLException
NameIdentifier
object and a SubjectConfirmation
object.nameIdentifier
- NameIdentifier
object.subjectConfirmation
- SubjectConfirmation
object.SAMLException
- if it could not process the
Element properly, implying that there is an error in the
sender or in the element definition.public Subject(NameIdentifier nameIdentifier) throws SAMLException
NameIdentifier
object.nameIdentifier
- NameIdentifier
object.SAMLException
- if it could not process the Element
properly, implying that there is an error in the sender or in
the element definition.public Subject(Element subjectElement) throws SAMLException
subjectElement
- An Element representing DOM tree for Subject objectSAMLException
- if it could not process the Element properly,
implying that there is an error in the sender or in the
element definition.public Subject(SubjectConfirmation subjectConfirmation) throws SAMLException
SubjectConfirmation
object.subjectConfirmation
- SubjectConfirmation
object to
be added to the object.SAMLException
- if subjectConfirmation
is null.public boolean equals(Subject subject)
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.subject
- Subject to be checked.subject
are equals.public boolean setSubjectConfirmation(SubjectConfirmation subjectConfirmation)
subjectConfirmation
- SubjectConfirmation
to be set.public boolean removeSubjectConfirmation()
public boolean setNameIdentifier(NameIdentifier nameIdentifier)
NameIdentifier
to the subject.nameIdentifier
- NameIdentifier
to be set.public boolean removeNameIdentifier()
NameIdentifier
from the subject.public NameIdentifier getNameIdentifier()
NameIdentifier
within the Subject elementNameIdentifier
object, within this Subject.public SubjectConfirmation getSubjectConfirmation()
SubjectConfirmation
within the Subject elementSubjectConfirmation
object, within this Subject if
exists else nullpublic String toString()
public String toString(boolean includeNS, boolean declareNS)
<Subject>
element.includeNS
- if true prepends all elements by their Namespace
name example <saml:Subject>
.declareNS
- if true includes the namespace within the
generated XML.protected NameIdentifier createNameIdentifier(Element nameIdentifierElement) throws SAMLException
SAMLException
protected SubjectConfirmation createSubjectConfirmation(Element subjectConfirmationElement) throws SAMLException
SAMLException
Copyright © 2010-2018, ForgeRock All Rights Reserved.