Skip to content

Commit

Permalink
Add usernamemixed endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Oct 22, 2024
1 parent 643e000 commit 4b3dd3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 35 deletions.
3 changes: 1 addition & 2 deletions src/Controller/Adfs.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace SimpleSAML\Module\adfs\Controller;

use Exception;
use SimpleSAML\Assert\Assert;
use SimpleSAML\{Configuration, IdP, Logger, Metadata, Module, Session, Utils};
use SimpleSAML\Error as SspError;
use SimpleSAML\Metadata\MetaDataStorageHandler;
Expand Down Expand Up @@ -231,7 +230,7 @@ public function usernamemixed(Request $request): Response
$domDocument = DOMDocumentFactory::fromString($soapMessage);
$soapEnvelope = Envelope::fromXML($domDocument->documentElement);

$idpEntityId = $this->metadata->getMetaDataCurrentEntityID('adfs-idp-hosted')
$idpEntityId = $this->metadata->getMetaDataCurrentEntityID('adfs-idp-hosted');
$idp = IdP::getById('adfs:' . $idpEntityId);

return ADFS_IDP::receivePassiveAuthnRequest($request, $soapEnvelope, $idp);
Expand Down
47 changes: 14 additions & 33 deletions src/IdP/ADFS.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use DateTimeImmutable;
use DateTimeZone;
use Exception;
use SimpleSAML\Assert\Assert;
use SimpleSAML\Configuration;
use SimpleSAML\Error;
use SimpleSAML\IdP;
Expand Down Expand Up @@ -59,44 +60,24 @@ public static function receivePassiveAuthnRequest(
Envelope $soapEnvelope,
IdP $idp,
): StreamedResponse {
// Parse the SOAP-header
$header = $soapEnvelope->getHeader();
$body = $soapEnvelope->getBody();

$to = $action = $messageid = $security = null;
foreach ($header->getElements() as $elt) {
if ($elt instanceof To) {
$to = $elt;
} elseif ($elt instanceof Action) {
$action = $elt;
} elseif ($elt instanceof MessageID) {
$messageid = $elt;
} elseif ($elt instanceof Security) {
$security = $elt;
}
}
$to = To::getChildrenOfClass($header->toXML());
Assert::count($to, 1, 'Missing To in SOAP Header.');
$to = array_pop($to);

/*
$requestSecurityToken = null;
foreach ($body->getElements() as $elt) {
if ($elt instanceof RequestSecurityToken) {
$requestSecurityToken = $elt;
}
}
$action = Action::getChildrenOfClass($header->toXML());
Assert::count($action, 1, 'Missing Action in SOAP Header.');
$action = array_pop($action);

$appliesTo = null;
foreach ($requestSecurityToken->getElements() as $elt) {
if ($elt instanceof AppliesTo) {
$appliesTo = $elt;
}
}
$messageid = MessageID::getChildrenOfClass($header->toXML());
Assert::count($messageid, 1, 'Missing MessageID in SOAP Header.');
$messageid = array_pop($messageid);

// Parse the SOAP-body
$body = $soapEnvelope->getBody();

$endpointReference = null;
foreach ($appliesTo->getElements() as $elt) {
if ($elt instanceof EndpointReference) {
$endpointReference = $elt;
}
}
*/
$requestSecurityToken = RequestSecurityToken::getChildrenOfClass($body->toXML());
Assert::count($requestSecurityToken, 1, 'Missing RequestSecurityToken in SOAP Body.');
$requestSecurityToken = array_pop($requestSecurityToken);
Expand Down

0 comments on commit 4b3dd3a

Please sign in to comment.