Skip to content
Snippets Groups Projects
Commit ad7058ac authored by Olav Morken's avatar Olav Morken
Browse files

modules/saml2: Add NameIDFormat to SP metadata.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1018 44740490-163a-0410-bde0-09ae8108e29a
parent 48cd6e0c
No related branches found
No related tags found
No related merge requests found
...@@ -127,6 +127,24 @@ class sspmod_saml2_Auth_Source_SP extends SimpleSAML_Auth_Source { ...@@ -127,6 +127,24 @@ class sspmod_saml2_Auth_Source_SP extends SimpleSAML_Auth_Source {
} }
/**
* Retrieve the NameIDFormat used by this SP.
*
* @return string NameIDFormat used by this SP.
*/
public function getNameIDFormat() {
$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
$spmeta = $metadata->getMetadata($this->entityID, 'saml20-sp-hosted');
if (array_key_exists('NameIDFormat', $spmeta)) {
return $spmeta['NameIDFormat'];
} else {
return 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient';
}
}
/** /**
* Check if the IdP entity id is allowed to authenticate users for this authentication source. * Check if the IdP entity id is allowed to authenticate users for this authentication source.
* *
......
...@@ -19,8 +19,10 @@ $entityId = $source->getEntityId(); ...@@ -19,8 +19,10 @@ $entityId = $source->getEntityId();
$metaArray = array( $metaArray = array(
'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml2/sp/acs.php'), 'AssertionConsumerService' => SimpleSAML_Module::getModuleURL('saml2/sp/acs.php'),
'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml2/sp/logout.php/' . $sourceId), 'SingleLogoutService' => SimpleSAML_Module::getModuleURL('saml2/sp/logout.php/' . $sourceId),
'NameIDFormat' => $source->getNameIDFormat(),
); );
$metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($entityId); $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($entityId);
$metaBuilder->addMetadataSP20($metaArray); $metaBuilder->addMetadataSP20($metaArray);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment