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

Public Member Functions

 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...
 

Static Public Member Functions

static getBinding ($urn)
 Retrieve a binding with the given URN. More...
 
static getCurrentBinding ()
 Guess the current binding. More...
 

Protected Attributes

 $destination
 The destination of messages. More...
 

Detailed Description

Definition at line 10 of file Binding.php.

Member Function Documentation

◆ getBinding()

static SAML2\Binding::getBinding (   $urn)
static

Retrieve a binding with the given URN.

Will throw an exception if it is unable to locate the binding.

Parameters
string$urnThe URN of the binding.
Returns
\SAML2\Binding The binding.
Exceptions

Exception

Definition at line 28 of file Binding.php.

29 {
30 assert(is_string($urn));
31
32 switch ($urn) {
34 return new HTTPPost();
36 return new HTTPRedirect();
38 return new HTTPArtifact();
40 return new HTTPPost();
41 // ECP ACS is defined with the PAOS binding, but as the IdP, we
42 // talk to the ECP using SOAP -- if support for ECP as an SP is
43 // implemented, this logic may need to change
45 return new SOAP();
46 default:
47 throw new \Exception('Unsupported binding: ' . var_export($urn, true));
48 }
49 }
const BINDING_HOK_SSO
The URN for the Holder-of-Key Web Browser SSO Profile binding.
Definition: Constants.php:55
const BINDING_HTTP_ARTIFACT
The URN for the HTTP-ARTIFACT binding.
Definition: Constants.php:40
const BINDING_HTTP_REDIRECT
The URN for the HTTP-Redirect binding.
Definition: Constants.php:35
const BINDING_PAOS
The URN for the PAOS binding.
Definition: Constants.php:50
const BINDING_HTTP_POST
The URN for the HTTP-POST binding.
Definition: Constants.php:30

Referenced by sspmod_saml_IdP_SAML2\handleAuthError(), sspmod_saml_IdP_SAML2\sendLogoutRequest(), sspmod_saml_IdP_SAML2\sendLogoutResponse(), sspmod_saml_IdP_SAML2\sendResponse(), sspmod_saml_Auth_Source_SP\startSLO2(), and sspmod_saml_Auth_Source_SP\startSSO2().

+ Here is the caller graph for this function:

◆ getCurrentBinding()

static SAML2\Binding::getCurrentBinding ( )
static

Guess the current binding.

This function guesses the current binding and creates an instance of \SAML2\Binding matching that binding.

An exception will be thrown if it is unable to guess the binding.

Returns
\SAML2\Binding The binding.
Exceptions

Exception

Definition at line 62 of file Binding.php.

63 {
64 switch ($_SERVER['REQUEST_METHOD']) {
65 case 'GET':
66 if (array_key_exists('SAMLRequest', $_GET) || array_key_exists('SAMLResponse', $_GET)) {
67 return new HTTPRedirect();
68 } elseif (array_key_exists('SAMLart', $_GET)) {
69 return new HTTPArtifact();
70 }
71 break;
72
73 case 'POST':
74 if (isset($_SERVER['CONTENT_TYPE'])) {
75 $contentType = $_SERVER['CONTENT_TYPE'];
76 $contentType = explode(';', $contentType);
77 $contentType = $contentType[0]; /* Remove charset. */
78 } else {
79 $contentType = null;
80 }
81 if (array_key_exists('SAMLRequest', $_POST) || array_key_exists('SAMLResponse', $_POST)) {
82 return new HTTPPost();
83 } elseif (array_key_exists('SAMLart', $_POST)) {
84 return new HTTPArtifact();
85 } elseif ($contentType === 'text/xml') {
86 return new SOAP();
87 }
88 break;
89 }
90
91 $logger = Utils::getContainer()->getLogger();
92 $logger->warning('Unable to find the SAML 2 binding used for this request.');
93 $logger->warning('Request method: ' . var_export($_SERVER['REQUEST_METHOD'], true));
94 if (!empty($_GET)) {
95 $logger->warning("GET parameters: '" . implode("', '", array_map('addslashes', array_keys($_GET))) . "'");
96 }
97 if (!empty($_POST)) {
98 $logger->warning("POST parameters: '" . implode("', '", array_map('addslashes', array_keys($_POST))) . "'");
99 }
100 if (isset($_SERVER['CONTENT_TYPE'])) {
101 $logger->warning('Content-Type: ' . var_export($_SERVER['CONTENT_TYPE'], true));
102 }
103
104 throw new \Exception('Unable to find the current binding.');
105 }
$_GET["client_id"]
$_POST["username"]
static getContainer()
Definition: Utils.php:752
if( $path[strlen( $path) - 1]==='/') if(is_dir($path)) if(!file_exists( $path)) if(preg_match('#\.php$#D', mb_strtolower($path, 'UTF-8'))) $contentType
Definition: module.php:144
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_GET, $_POST, $_SERVER, and $contentType.

Referenced by sspmod_saml_IdP_SAML2\receiveAuthnRequest(), and sspmod_saml_IdP_SAML2\receiveLogoutMessage().

+ Here is the caller graph for this function:

◆ getDestination()

SAML2\Binding::getDestination ( )

Retrieve the destination of a message.

Returns
string|null $destination The destination the message will be delivered to.

Definition at line 112 of file Binding.php.

113 {
114 return $this->destination;
115 }
$destination
The destination of messages.
Definition: Binding.php:17

References $destination.

◆ receive()

SAML2\Binding::receive ( )
abstract

Receive a SAML 2 message.

This function will extract the message from the current request. An exception will be thrown if we are unable to process the message.

Returns
\SAML2\Message The received message.

Reimplemented in SAML2\HTTPPost, SAML2\HTTPRedirect, and SAML2\SOAP.

◆ send()

SAML2\Binding::send ( Message  $message)
abstract

Send a SAML 2 message.

This function will send a message using the specified binding. The message will be delivered to the destination set in the message.

Parameters
\SAML2\Message$messageThe message which should be sent.

Reimplemented in SAML2\HTTPArtifact, SAML2\HTTPPost, SAML2\HTTPRedirect, and SAML2\SOAP.

◆ setDestination()

SAML2\Binding::setDestination (   $destination)

Override the destination of a message.

Set to null to use the destination set in the message.

Parameters
string | null$destinationThe destination the message should be delivered to.

Definition at line 124 of file Binding.php.

125 {
126 assert(is_string($destination) || is_null($destination));
127
128 $this->destination = $destination;
129 }

References $destination.

Field Documentation

◆ $destination

SAML2\Binding::$destination
protected

The destination of messages.

This can be null, in which case the destination in the message is used.

Definition at line 17 of file Binding.php.


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