Skip to content

Commit

Permalink
Merge pull request #4 from lrowe/master
Browse files Browse the repository at this point in the history
Make authenticated_userid None when groupfinder returns None.
  • Loading branch information
almet committed Oct 8, 2013
2 parents 9bbb93f + 31e9593 commit f7af518
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pyramid_multiauth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def authenticated_userid(self, request):
break
if self._callback(userid, request) is not None:
break
else:
userid = None
return userid

def unauthenticated_userid(self, request):
Expand Down
2 changes: 1 addition & 1 deletion pyramid_multiauth/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def test_authenticated_userid_unauthenticated_with_groupfinder(self):
policies = [TestAuthnPolicy2()]
policy = MultiAuthenticationPolicy(policies, testgroupfinder)
request = DummyRequest()
self.assertEquals(policy.authenticated_userid(request), "test2")
self.assertEquals(policy.authenticated_userid(request), None)
self.assertEquals(sorted(policy.effective_principals(request)),
[Everyone, 'test2'])

Expand Down

0 comments on commit f7af518

Please sign in to comment.