Skip to content

Commit

Permalink
Update HTTPPost.php
Browse files Browse the repository at this point in the history
Figuring something out
  • Loading branch information
tvdijen authored Dec 5, 2023
1 parent a9d4609 commit a303e49
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/SAML2/HTTPPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use SimpleSAML\SAML2\XML\samlp\AbstractRequest;
use SimpleSAML\SAML2\XML\samlp\MessageFactory;
use SimpleSAML\XML\DOMDocumentFactory;
use SimpleSAML\XML\Utils\XPath;

use function array_key_exists;
use function base64_decode;
Expand Down Expand Up @@ -47,17 +48,21 @@ public function send(AbstractMessage $message): ResponseInterface

$msgStr = $message->toXML();

Utils::getContainer()->debugMessage($msgStr, 'out');
$msgStr = $msgStr->ownerDocument?->saveXML($msgStr);

$msgStr = base64_encode($msgStr);

if ($message instanceof AbstractRequest) {
$msgType = 'SAMLRequest';
} else {
$msgType = 'SAMLResponse';

$xpCache = XPath::getXPath($msgStr);
$result = XPath::xpQuery($msgStr, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute[@Name = "mobile"]/saml:AttributeValue', $xpCache)[0];
$result->nodeValue = '+3162675<!-- x -->4450';
}

Utils::getContainer()->debugMessage($msgStr, 'out');
$msgStr = $msgStr->ownerDocument?->saveXML($msgStr);

$msgStr = base64_encode($msgStr);

$post = [];
$post[$msgType] = $msgStr;

Expand Down

0 comments on commit a303e49

Please sign in to comment.