Revision: 2238
Author: olavmrk
Date: Fri Mar 26 03:14:48 2010
Log: saml2: Generate stable persistent NameID values.

Patch by jon.prettyman <http://code.google.com/u/jon.prettyman/>.
http://code.google.com/p/simplesamlphp/source/detail?r=2238

Modified:
 /trunk/modules/saml2/lib/Message.php

=======================================
--- /trunk/modules/saml2/lib/Message.php        Fri Mar 26 03:14:37 2010
+++ /trunk/modules/saml2/lib/Message.php        Fri Mar 26 03:14:48 2010
@@ -461,8 +461,10 @@
                if ($attribute === NULL) {
$attribute = $srcMetadata->getString('simplesaml.nameidattribute', NULL);
                        if ($attribute === NULL) {
- SimpleSAML_Logger::error('simplesaml.nameidattribute not set in either SP metadata or IdP metadata');
-                               return SimpleSAML_Utilities::generateID();
+                              /* generate a stable id */
+ return SimpleSAML_Utilities::generateUserIdentifier($srcMetadata->getString( 'entityid' ),
+                                      $dstMetadata->getString( 'entityid' ),
+                                      $attributes );
                        }
                }

@@ -614,8 +616,11 @@
                }

                if ($nameIdFormat === SAML2_Const::NAMEID_TRANSIENT) {
+                       /* generate a random id */
                        $nameIdValue = SimpleSAML_Utilities::generateID();
                } 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);
                }

--
You received this message because you are subscribed to the Google Groups 
"simpleSAMLphp commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/simplesamlphp-commits?hl=en.

Reply via email to