Skip to content

Commit efe27e2

Browse files
authored
Merge pull request #454 from jkakavas/fix_authn
Quick fix for the authentication bypass due to optimizations #451
2 parents 46d24f6 + 6312a41 commit efe27e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/saml2/authn.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ def __call__(self, cookie=None, policy_url=None, logo_url=None,
146146
return resp
147147

148148
def _verify(self, pwd, user):
149-
assert is_equal(pwd, self.passwd[user])
149+
if not is_equal(pwd, self.passwd[user]):
150+
raise ValueError("Wrong password")
150151

151152
def verify(self, request, **kwargs):
152153
"""
@@ -176,7 +177,7 @@ def verify(self, request, **kwargs):
176177
return_to = create_return_url(self.return_to, _dict["query"][0],
177178
**{self.query_param: "true"})
178179
resp = Redirect(return_to, headers=[cookie])
179-
except (AssertionError, KeyError):
180+
except (ValueError, KeyError):
180181
resp = Unauthorized("Unknown user or wrong password")
181182

182183
return resp

0 commit comments

Comments
 (0)