ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
HTTPPost.php
Go to the documentation of this file.
1
<?
php
2
3
namespace
SAML2
;
4
10
class
HTTPPost
extends
Binding
11
{
19
public
function
send
(
Message
$message
)
20
{
21
if
($this->destination === null) {
22
$destination
= $message->
getDestination
();
23
}
else
{
24
$destination
=
$this->destination
;
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
}
50
59
public
function
receive
()
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
}
84
}
SAML2\Request
Definition:
Request.php:14
SAML2
Definition:
ArtifactResolve.php:3
SAML2\Message\getRelayState
getRelayState()
Retrieve the RelayState associated with this message.
Definition:
Message.php:411
$destination
$destination
Definition:
saml2-logout.php:50
SAML2\Message\toSignedXML
toSignedXML()
Convert this message to a signed XML document.
Definition:
Message.php:481
SAML2\Message
Base class for all SAML 2 messages.
Definition:
Message.php:18
SAML2\HTTPPost\send
send(Message $message)
Send a SAML 2 message using the HTTP-POST binding.
Definition:
HTTPPost.php:19
$message
catch(Exception $e) $message
Definition:
saml2-logout.php:34
SAML2\HTTPPost\receive
receive()
Receive a SAML 2 message sent using the HTTP-POST binding.
Definition:
HTTPPost.php:59
$relayState
$relayState
Definition:
logout-iframe-post.php:14
$post
$post
Definition:
post.php:34
SAML2\HTTPPost
Definition:
HTTPPost.php:10
SAML2\Binding
Definition:
Binding.php:10
$xml
$xml
Definition:
fetch_windows_zones.php:11
php
SAML2\Message\getDestination
getDestination()
Retrieve the destination of this message.
Definition:
Message.php:323
$_POST
$_POST["username"]
Definition:
cfg.phpunit.template.php:11
libs
composer
vendor
simplesamlphp
saml2
src
SAML2
HTTPPost.php
Generated on Thu Jan 30 2025 19:01:31 for ILIAS by
1.8.13 (using
Doxyfile
)