#289 AttributeError: 'NoneType' object has no attribute 'format'
Closed: Duplicate 2 years ago Opened 2 years ago by dosmage.

I am not a programmer! My company is evaluating SAML2 IdP software. I've created a FreeIPA server with an Ipsilon IdP. I received the following traceback after setting everything up.

[Wed Aug 16 11:08:04.587692 2017] [:error] [pid 24336] [16/Aug/2017:11:08:04] HTTP
[Wed Aug 16 11:08:04.587708 2017] [:error] [pid 24336] Request Headers:
[Wed Aug 16 11:08:04.587713 2017] [:error] [pid 24336] COOKIE: ipsilon_default_username=admin; 77c8fec1-c9c4-48d7-91a2-4bbb6dee44ff=saml2; 8c57eef7-9d63-4732-935d-1fb7f2d68f6d=saml2; a92cdecd-c42f-4e38-baa8-449db6831705=saml2; idp_ipsilon_session_id=3fd8d0189ce29df52aeff2422e4eda63be8ce483
[Wed Aug 16 11:08:04.587718 2017] [:error] [pid 24336] ACCEPT-LANGUAGE: en-US,en;q=0.8
[Wed Aug 16 11:08:04.587722 2017] [:error] [pid 24336] USER-AGENT: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
[Wed Aug 16 11:08:04.587726 2017] [:error] [pid 24336] CONNECTION: keep-alive
[Wed Aug 16 11:08:04.587729 2017] [:error] [pid 24336] REFERER: http://www.example.com/wp-admin/admin.php?page=mo_saml_settings&tab=save
[Wed Aug 16 11:08:04.587733 2017] [:error] [pid 24336] Remote-Addr: 207.154.78.201
[Wed Aug 16 11:08:04.587736 2017] [:error] [pid 24336] HOST: idp.example.net
[Wed Aug 16 11:08:04.587740 2017] [:error] [pid 24336] UPGRADE-INSECURE-REQUESTS: 1
[Wed Aug 16 11:08:04.587744 2017] [:error] [pid 24336] ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
[Wed Aug 16 11:08:04.587747 2017] [:error] [pid 24336] ACCEPT-ENCODING: gzip, deflate, sdch, br
[Wed Aug 16 11:08:04.588092 2017] [:error] [pid 24336] [16/Aug/2017:11:08:04] HTTP Traceback (most recent call last):
[Wed Aug 16 11:08:04.588108 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond
[Wed Aug 16 11:08:04.588113 2017] [:error] [pid 24336] response.body = self.handler()
[Wed Aug 16 11:08:04.588117 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in call
[Wed Aug 16 11:08:04.588121 2017] [:error] [pid 24336] self.body = self.oldhandler(args, kwargs)
[Wed Aug 16 11:08:04.588125 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in call
[Wed Aug 16 11:08:04.588129 2017] [:error] [pid 24336] return self.callable(*self.args,
self.kwargs)
[Wed Aug 16 11:08:04.588132 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/ipsilon/util/page.py", line 91, in call
[Wed Aug 16 11:08:04.588136 2017] [:error] [pid 24336] return op(
args, kwargs)
[Wed Aug 16 11:08:04.588140 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/ipsilon/providers/common.py", line 87, in root
[Wed Aug 16 11:08:04.588143 2017] [:error] [pid 24336] return op(*args,
kwargs)
[Wed Aug 16 11:08:04.588147 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/ipsilon/providers/saml2idp.py", line 80, in GET
[Wed Aug 16 11:08:04.588151 2017] [:error] [pid 24336] return self.auth(login)
[Wed Aug 16 11:08:04.588154 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/ipsilon/providers/saml2/auth.py", line 67, in auth
[Wed Aug 16 11:08:04.588158 2017] [:error] [pid 24336] self.saml2checks(login)
[Wed Aug 16 11:08:04.588161 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/ipsilon/providers/saml2/auth.py", line 156, in saml2checks
[Wed Aug 16 11:08:04.588165 2017] [:error] [pid 24336] nameidfmt = provider.get_valid_nameid(login.request.nameIdPolicy)
[Wed Aug 16 11:08:04.588169 2017] [:error] [pid 24336] File "/usr/lib/python2.7/site-packages/ipsilon/providers/saml2/provider.py", line 198, in get_valid_nameid
[Wed Aug 16 11:08:04.588173 2017] [:error] [pid 24336] elif nip.format is None:
[Wed Aug 16 11:08:04.588176 2017] [:error] [pid 24336] AttributeError: 'NoneType' object has no attribute 'format'

I don't understand why nip is set to None, be it a configuration or another issue, but the following fixes the traceback and allowed me to continue testing. If this is a configuration issue then the documentation may need to be addressed.

ipsilon/providers/saml2/provider.py
def get_valid_nameid(self, nip):
#self.debug('Requested NameId [%s]' % (nip.format,))
if nip is None:
return SAML2_NAMEID_MAP[self.default_nameid]
elif nip.format is None:
return SAML2_NAMEID_MAP[self.default_nameid]
else:
allowed = self.allowed_nameids
self.debug('Allowed NameIds %s' % (repr(allowed)))
for nameid in allowed:
if nip.format == SAML2_NAMEID_MAP[nameid]:
return nip.format
raise NameIdNotAllowed(nip.format)


This has been fixed with commit 992492e and is a duplicate of #189.
This should be fixed in a more recent release of Ipsilon.

Metadata Update from @puiterwijk:
- Custom field component adjusted to None
- Custom field type adjusted to None
- Custom field version adjusted to None

2 years ago

Metadata Update from @puiterwijk:
- Issue close_status updated to: Duplicate
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata