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

saml2: Generate stable persistent NameID values.

Patch by jon.prettyman <http://code.google.com/u/jon.prettyman/>.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2238 44740490-163a-0410-bde0-09ae8108e29a
parent bc16ada5
No related branches found
No related tags found
No related merge requests found
...@@ -461,8 +461,10 @@ class sspmod_saml2_Message { ...@@ -461,8 +461,10 @@ class sspmod_saml2_Message {
if ($attribute === NULL) { if ($attribute === NULL) {
$attribute = $srcMetadata->getString('simplesaml.nameidattribute', NULL); $attribute = $srcMetadata->getString('simplesaml.nameidattribute', NULL);
if ($attribute === NULL) { if ($attribute === NULL) {
SimpleSAML_Logger::error('simplesaml.nameidattribute not set in either SP metadata or IdP metadata'); /* generate a stable id */
return SimpleSAML_Utilities::generateID(); return SimpleSAML_Utilities::generateUserIdentifier($srcMetadata->getString( 'entityid' ),
$dstMetadata->getString( 'entityid' ),
$attributes );
} }
} }
...@@ -614,8 +616,11 @@ class sspmod_saml2_Message { ...@@ -614,8 +616,11 @@ class sspmod_saml2_Message {
} }
if ($nameIdFormat === SAML2_Const::NAMEID_TRANSIENT) { if ($nameIdFormat === SAML2_Const::NAMEID_TRANSIENT) {
/* generate a random id */
$nameIdValue = SimpleSAML_Utilities::generateID(); $nameIdValue = SimpleSAML_Utilities::generateID();
} else { } else {
/* this code will end up generating either a fixed assigned id (via nameid.attribute)
or random id if not assigned/configured */
$nameIdValue = self::generateNameIdValue($srcMetadata, $dstMetadata, $attributes); $nameIdValue = self::generateNameIdValue($srcMetadata, $dstMetadata, $attributes);
} }
......
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