diff options
author | Ioannis Kakavas <ikakavas@noc.grnet.gr> | 2017-09-12 12:22:47 +0300 |
---|---|---|
committer | Ioannis Kakavas <ikakavas@noc.grnet.gr> | 2017-09-12 12:22:47 +0300 |
commit | 6312a41e037954850867f29d329e5007df1424a5 (patch) | |
tree | 9b6856d188debb3649313fac818704305cc53cf1 | |
parent | 9cbbd9bd9f6bfa5e9ceace064dd1af4e2ff2f68c (diff) | |
download | pysaml2-6312a41e037954850867f29d329e5007df1424a5.tar.gz |
Quick fix for the authentication bypass due to optimizations #451
-rw-r--r-- | src/saml2/authn.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/saml2/authn.py b/src/saml2/authn.py index 1f2d02cf..1e1a220b 100644 --- a/src/saml2/authn.py +++ b/src/saml2/authn.py @@ -146,7 +146,8 @@ class UsernamePasswordMako(UserAuthnMethod): return resp def _verify(self, pwd, user): - assert is_equal(pwd, self.passwd[user]) + if not is_equal(pwd, self.passwd[user]): + raise ValueError("Wrong password") def verify(self, request, **kwargs): """ @@ -176,7 +177,7 @@ class UsernamePasswordMako(UserAuthnMethod): return_to = create_return_url(self.return_to, _dict["query"][0], **{self.query_param: "true"}) resp = Redirect(return_to, headers=[cookie]) - except (AssertionError, KeyError): + except (ValueError, KeyError): resp = Unauthorized("Unknown user or wrong password") return resp |