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

Public Member Functions

 send (Message $message)
 Send a SAML 2 message using the HTTP-POST binding. More...
 
 receive ()
 Receive a SAML 2 message sent using the HTTP-POST binding. More...
 
- Public Member Functions inherited from SAML2\Binding
 getDestination ()
 Retrieve the destination of a message. More...
 
 setDestination ($destination)
 Override the destination of a message. More...
 
 send (Message $message)
 Send a SAML 2 message. More...
 
 receive ()
 Receive a SAML 2 message. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SAML2\Binding
static getBinding ($urn)
 Retrieve a binding with the given URN. More...
 
static getCurrentBinding ()
 Guess the current binding. More...
 
- Protected Attributes inherited from SAML2\Binding
 $destination
 The destination of messages. More...
 

Detailed Description

Definition at line 10 of file HTTPPost.php.

Member Function Documentation

◆ receive()

SAML2\HTTPPost::receive ( )

Receive a SAML 2 message sent using the HTTP-POST binding.

Throws an exception if it is unable receive the message.

Returns
\SAML2\Message The received message.
Exceptions

Exception

Reimplemented from SAML2\Binding.

Definition at line 59 of file HTTPPost.php.

60 {
61 if (array_key_exists('SAMLRequest', $_POST)) {
62 $msg = $_POST['SAMLRequest'];
63 } elseif (array_key_exists('SAMLResponse', $_POST)) {
64 $msg = $_POST['SAMLResponse'];
65 } else {
66 throw new \Exception('Missing SAMLRequest or SAMLResponse parameter.');
67 }
68
69 $msg = base64_decode($msg);
70
71 Utils::getContainer()->debugMessage($msg, 'in');
72
73 $document = DOMDocumentFactory::fromString($msg);
74 $xml = $document->firstChild;
75
76 $msg = Message::fromXML($xml);
77
78 if (array_key_exists('RelayState', $_POST)) {
79 $msg->setRelayState($_POST['RelayState']);
80 }
81
82 return $msg;
83 }
$_POST["username"]
static fromXML(\DOMElement $xml)
Convert an XML element into a message.
Definition: Message.php:562
static getContainer()
Definition: Utils.php:752

References $_POST, and $xml.

◆ send()

SAML2\HTTPPost::send ( Message  $message)

Send a SAML 2 message using the HTTP-POST binding.

Note: This function never returns.

Parameters
\SAML2\Message$messageThe message we should send.

Reimplemented from SAML2\Binding.

Definition at line 19 of file HTTPPost.php.

20 {
21 if ($this->destination === null) {
22 $destination = $message->getDestination();
23 } else {
25 }
26 $relayState = $message->getRelayState();
27
28 $msgStr = $message->toSignedXML();
29 $msgStr = $msgStr->ownerDocument->saveXML($msgStr);
30
31 Utils::getContainer()->debugMessage($msgStr, 'out');
32
33 $msgStr = base64_encode($msgStr);
34
35 if ($message instanceof Request) {
36 $msgType = 'SAMLRequest';
37 } else {
38 $msgType = 'SAMLResponse';
39 }
40
41 $post = array();
42 $post[$msgType] = $msgStr;
43
44 if ($relayState !== null) {
45 $post['RelayState'] = $relayState;
46 }
47
48 Utils::getContainer()->postRedirect($destination, $post);
49 }
$destination
The destination of messages.
Definition: Binding.php:17
catch(Exception $e) $message
$relayState
$post
Definition: post.php:34

References $destination, $message, $post, and $relayState.


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