Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent SP Metadata to be saved in Session #1053

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions lib/SimpleSAML/IdP.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,14 @@ public function getConfig()
return $this->config;
}


/**
* Get SP name.
* Get SP object.
*
* @param string $assocId The association identifier.
*
* @return array|null The name of the SP, as an associative array of language => text, or null if this isn't an SP.
* @return SimpleSAML_Configuration The SP, as a configuration object or null if this isn't an SP.
*/
public function getSPName($assocId)
{
public static function getSP($assocId) {
assert('is_string($assocId)');

$prefix = substr($assocId, 0, 4);
Expand All @@ -201,6 +199,25 @@ public function getSPName($assocId)
}
}

return $spMetadata;
}


/**
* Get SP name.
*
* @param string $assocId The association identifier.
*
* @return array|null The name of the SP, as an associative array of language => text, or null if this isn't an SP.
*/
public function getSPName($assocId)
{
assert('is_string($assocId)');
$prefix = substr($assocId, 0, 4);
$spEntityId = substr($assocId, strlen($prefix) + 1);

$spMetadata = self::getSP($assocId);

if ($spMetadata->hasValue('name')) {
return $spMetadata->getLocalizedString('name');
} elseif ($spMetadata->hasValue('OrganizationDisplayName')) {
Expand Down Expand Up @@ -308,6 +325,10 @@ public static function postAuth(array $state)

if (isset($state['SPMetadata'])) {
$spMetadata = $state['SPMetadata'];
} elseif (isset($state['SPAssocId'])) {
$spMetadata = self::getSP($state['SPAssocId'])->toArray();
// rehydrate state for authproc
$state['SPMetadata'] = $spMetadata;
} else {
$spMetadata = array();
}
Expand Down
2 changes: 1 addition & 1 deletion modules/saml/lib/IdP/SAML2.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public static function receiveAuthnRequest(SimpleSAML_IdP $idp)
SimpleSAML_Auth_State::EXCEPTION_HANDLER_FUNC => array('sspmod_saml_IdP_SAML2', 'handleAuthError'),
SimpleSAML_Auth_State::RESTART => $sessionLostURL,

'SPMetadata' => $spMetadata->toArray(),
'SPAssocId' => 'saml:' . $spEntityId,
'saml:RelayState' => $relayState,
'saml:RequestId' => $requestId,
'saml:IDPList' => $IDPList,
Expand Down