-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a8ebfb
commit 4fb4dbb
Showing
1 changed file
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,6 @@ | |
|
||
/** | ||
* | ||
* @author Gyula Szabó <[email protected]> | ||
* @author Gyula Szabó <[email protected]> | ||
* @author Gyula Szabó <[email protected]> | ||
*/ | ||
class sspmod_aa_AA_SAML2 | ||
{ | ||
|
@@ -22,8 +19,9 @@ class sspmod_aa_AA_SAML2 | |
private $attributeNameFormat; | ||
private $signAssertion; | ||
private $signResponse; | ||
private $endpointUrl; | ||
|
||
public function __construct(\SimpleSAML\Metadata\MetaDataStorageHandler $metadata) | ||
public function __construct($metadata) | ||
{ | ||
$this->config = SimpleSAML\Configuration::getConfig('module_aa.php'); | ||
|
||
|
@@ -69,7 +67,7 @@ private function getQuery() | |
return $query; | ||
} | ||
|
||
private function getEntities(\SimpleSAML\Metadata\MetaDataStorageHandler $metadata) | ||
private function getEntities($metadata) | ||
{ | ||
/* Getting the related entities metadata objects */ | ||
$aaEntityId = $metadata->getMetaDataCurrentEntityID('attributeauthority-hosted'); | ||
|
@@ -79,12 +77,23 @@ private function getEntities(\SimpleSAML\Metadata\MetaDataStorageHandler $metada | |
if ($spEntityId === null) { | ||
throw new SimpleSAML\Error\BadRequest('Missing <saml:Issuer> in <samlp:AttributeQuery>.'); | ||
} | ||
$dstMetadata = $metadata->getMetadata($spEntityId, 'saml20-sp-remote'); | ||
foreach ($dstMetadata['AssertionConsumerService'] as $acs) { | ||
if ($acs['Binding'] == SAML2\Constants::BINDING_PAOS) { | ||
$endpointUrl = $acs['Location']; | ||
} | ||
}; | ||
if (!$endpointUrl) { | ||
throw new SimpleSAML\Error\BadRequest('Missing PAOS endpointUrl in destination metadata.'); | ||
} | ||
|
||
$spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote'); | ||
|
||
$this->aaEntityId = $aaEntityId; | ||
$this->aaMetadata = $aaMetadata; | ||
$this->spEntityId = $spEntityId; | ||
$this->spMetadata = $spMetadata; | ||
$this->endpointUrl = $endpointUrl; | ||
} | ||
|
||
private function getAttributeNameFormat() | ||
|
@@ -291,6 +300,7 @@ private function buildResponse($returnAttributes) | |
$response->setIssuer($this->aaEntityId); | ||
$response->setInResponseTo($this->query->getId()); | ||
$response->setAssertions(array($assertion)); | ||
$response->setDestination($this->endpointUrl); | ||
if ($this->signResponse) { | ||
SimpleSAML\Module\saml\Message::addSign($this->aaMetadata, $this->spMetadata, $response); | ||
} | ||
|