Implement urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
authorRob Crittenden <rcritten@redhat.com>
Mon, 23 Mar 2015 17:57:12 +0000 (13:57 -0400)
committerSimo Sorce <simo@redhat.com>
Mon, 23 Mar 2015 22:00:21 +0000 (18:00 -0400)
Return the name the user authenticated with.

https://fedorahosted.org/ipsilon/ticket/27

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
ipsilon/providers/saml2/auth.py
ipsilon/providers/saml2/provider.py

index 4bfbc1a..d895f43 100644 (file)
@@ -202,6 +202,8 @@ class AuthenticateRequest(ProviderPageBase):
             nameid = us.get_user().email
             if not nameid:
                 nameid = '%s@%s' % (user.name, self.cfg.default_email_domain)
+        elif nameidfmt == lasso.SAML2_NAME_IDENTIFIER_FORMAT_UNSPECIFIED:
+            nameid = provider.normalize_username(user.name)
 
         if nameid:
             login.assertion.subject.nameId.format = nameidfmt
index c02d6fb..4439a0d 100644 (file)
@@ -116,8 +116,6 @@ class ServiceProvider(Log):
         self._debug('Requested NameId [%s]' % (nip.format,))
         if nip.format is None:
             return SAML2_NAMEID_MAP[self.default_nameid]
-        elif nip.format == lasso.SAML2_NAME_IDENTIFIER_FORMAT_UNSPECIFIED:
-            return SAML2_NAMEID_MAP[self.default_nameid]
         else:
             allowed = self.allowed_nameids
             self._debug('Allowed NameIds %s' % (repr(allowed)))