ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SAML2\SubjectQuery Class Reference
+ Inheritance diagram for SAML2\SubjectQuery:
+ Collaboration diagram for SAML2\SubjectQuery:

Public Member Functions

 getNameId ()
 Retrieve the NameId of the subject in the query. More...
 
 setNameId ($nameId)
 Set the NameId of the subject in the query. More...
 
 toUnsignedXML ()
 Convert subject query message to an XML element. More...
 
- Public Member Functions inherited from SAML2\Message
 addValidator ($function, $data)
 Add a method for validating this message. More...
 
 validate (XMLSecurityKey $key)
 Validate this message against a public key. More...
 
 getId ()
 Retrieve the identifier of this message. More...
 
 setId ($id)
 Set the identifier of this message. More...
 
 getIssueInstant ()
 Retrieve the issue timestamp of this message. More...
 
 setIssueInstant ($issueInstant)
 Set the issue timestamp of this message. More...
 
 getDestination ()
 Retrieve the destination of this message. More...
 
 setDestination ($destination)
 Set the destination of this message. More...
 
 setConsent ($consent)
 Set the given consent for this message. More...
 
 getConsent ()
 Set the given consent for this message. More...
 
 getIssuer ()
 Retrieve the issuer if this message. More...
 
 setIssuer ($issuer)
 Set the issuer of this message. More...
 
 isMessageConstructedWithSignature ()
 Query whether or not the message contained a signature at the root level when the object was constructed. More...
 
 getRelayState ()
 Retrieve the RelayState associated with this message. More...
 
 setRelayState ($relayState)
 Set the RelayState associated with this message. More...
 
 toUnsignedXML ()
 Convert this message to an unsigned XML document. More...
 
 toSignedXML ()
 Convert this message to a signed XML document. More...
 
 getSignatureKey ()
 Retrieve the private key we should use to sign the message. More...
 
 setSignatureKey (XMLSecurityKey $signatureKey=null)
 Set the private key we should use to sign the message. More...
 
 setCertificates (array $certificates)
 Set the certificates that should be included in the message. More...
 
 getCertificates ()
 Retrieve the certificates that are included in the message. More...
 
 getExtensions ()
 Retrieve the Extensions. More...
 
 setExtensions ($extensions)
 Set the Extensions. More...
 
 getSignatureMethod ()
 

Protected Member Functions

 __construct ($tagName, \DOMElement $xml=null)
 Constructor for SAML 2 subject query messages. More...
 
- Protected Member Functions inherited from SAML2\Message
 __construct ($tagName, \DOMElement $xml=null)
 Initialize a message. More...
 

Private Member Functions

 parseSubject (\DOMElement $xml)
 Parse subject in query. More...
 

Private Attributes

 $nameId
 

Additional Inherited Members

- Static Public Member Functions inherited from SAML2\Message
static fromXML (\DOMElement $xml)
 Convert an XML element into a message. More...
 
- Protected Attributes inherited from SAML2\Message
 $extensions
 
 $document
 
 $messageContainedSignatureUponConstruction = false
 

Detailed Description

Definition at line 16 of file SubjectQuery.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\SubjectQuery::__construct (   $tagName,
\DOMElement  $xml = null 
)
protected

Constructor for SAML 2 subject query messages.

Parameters
string$tagNameThe tag name of the root element.
\DOMElement | null$xmlThe input message.

Definition at line 32 of file SubjectQuery.php.

References $xml.

33  {
34  parent::__construct($tagName, $xml);
35 
36  if ($xml === null) {
37  return;
38  }
39 
40  $this->parseSubject($xml);
41  }
parseSubject(\DOMElement $xml)
Parse subject in query.

Member Function Documentation

◆ getNameId()

SAML2\SubjectQuery::getNameId ( )

Retrieve the NameId of the subject in the query.

Returns
|null The name identifier of the assertion.

Definition at line 77 of file SubjectQuery.php.

References $nameId.

78  {
79  return $this->nameId;
80  }

◆ parseSubject()

SAML2\SubjectQuery::parseSubject ( \DOMElement  $xml)
private

Parse subject in query.

Parameters
\DOMElement$xmlThe SubjectQuery XML element.
Exceptions

Definition at line 50 of file SubjectQuery.php.

References $nameId.

51  {
52  $subject = Utils::xpQuery($xml, './saml_assertion:Subject');
53  if (empty($subject)) {
54  /* No Subject node. */
55  throw new \Exception('Missing subject in subject query.');
56  } elseif (count($subject) > 1) {
57  throw new \Exception('More than one <saml:Subject> in <saml:Assertion>.');
58  }
59  $subject = $subject[0];
60 
61  $nameId = Utils::xpQuery($subject, './saml_assertion:NameID');
62  if (empty($nameId)) {
63  throw new \Exception('Missing <saml:NameID> in <saml:Subject>.');
64  } elseif (count($nameId) > 1) {
65  throw new \Exception('More than one <saml:NameID> in <saml:Subject>.');
66  }
67  $nameId = $nameId[0];
68  $this->nameId = new XML\saml\NameID($nameId);
69  }
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191

◆ setNameId()

SAML2\SubjectQuery::setNameId (   $nameId)

Set the NameId of the subject in the query.

Parameters
\SAML2\XML\saml\NameID | array | null$nameIdThe name identifier of the assertion.

Definition at line 88 of file SubjectQuery.php.

References $nameId.

89  {
90  assert(is_array($nameId) || is_null($nameId) || $nameId instanceof XML\saml\NameID);
91 
92  if (is_array($nameId)) {
94  }
95  $this->nameId = $nameId;
96  }
static fromArray(array $nameId)
Create a object from an array with its contents.
Definition: NameIDType.php:87

◆ toUnsignedXML()

SAML2\SubjectQuery::toUnsignedXML ( )

Convert subject query message to an XML element.

Returns
This subject query.

Definition at line 104 of file SubjectQuery.php.

References $root.

105  {
106  $root = parent::toUnsignedXML();
107 
108  $subject = $root->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:Subject');
109  $root->appendChild($subject);
110 
111  $this->nameId->toXML($subject);
112 
113  return $root;
114  }
$root
Definition: sabredav.php:45
const NS_SAML
The namespace for the SAML 2 assertions.
Definition: Constants.php:225

Field Documentation

◆ $nameId

SAML2\SubjectQuery::$nameId
private

Definition at line 23 of file SubjectQuery.php.


The documentation for this class was generated from the following file: