Added ConnectionStateError handler in authentication policy
authorThierry Florac <tflorac@ulthar.net>
Mon, 11 Jan 2021 16:34:41 +0100
changeset 166 f4a5148d4068
parent 165 9268824f88fc
child 167 1b5af7709862
Added ConnectionStateError handler in authentication policy
src/pyams_security/utility.py
--- a/src/pyams_security/utility.py	Wed Jul 15 11:52:09 2020 +0200
+++ b/src/pyams_security/utility.py	Mon Jan 11 16:34:41 2021 +0100
@@ -265,12 +265,12 @@
         principal_id = self.unauthenticated_userid(request)
         if principal_id:
             return principal_id
-        manager = self._get_security_manager(request)
-        if manager is not None:
-            try:
+        try:
+            manager = self._get_security_manager(request)
+            if manager is not None:
                 return manager.authenticated_userid(request)
-            except ConnectionStateError:
-                pass
+        except ConnectionStateError:
+            pass
         return None
 
     @request_property(key=None)