diff options
| author | Theron Luhn <theron@luhn.com> | 2019-12-14 19:12:01 -0600 |
|---|---|---|
| committer | Theron Luhn <theron@luhn.com> | 2019-12-14 19:12:28 -0600 |
| commit | d699c9ace8028bf74e1c6c3ea085fdf9beeb2586 (patch) | |
| tree | e784f234a95ec288ab80b988dee0f771e7a35fac | |
| parent | eda8787d00b31dc90164e5c233bfb1cc1f94eaed (diff) | |
| download | pyramid-d699c9ace8028bf74e1c6c3ea085fdf9beeb2586.tar.gz pyramid-d699c9ace8028bf74e1c6c3ea085fdf9beeb2586.tar.bz2 pyramid-d699c9ace8028bf74e1c6c3ea085fdf9beeb2586.zip | |
Raise error on kwargs in `LegacySecurityPolicy.forget`.
| -rw-r--r-- | src/pyramid/security.py | 6 | ||||
| -rw-r--r-- | tests/test_security.py | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/pyramid/security.py b/src/pyramid/security.py index f07bc0bfe..e3a978c52 100644 --- a/src/pyramid/security.py +++ b/src/pyramid/security.py @@ -439,8 +439,12 @@ class LegacySecurityPolicy: return authn.remember(request, userid, **kw) def forget(self, request, **kw): + if kw: + raise ValueError( + 'Legacy authentication policies do not support keyword ' + 'arguments for `forget`' + ) authn = self._get_authn_policy(request) - # XXX log warning if varkwargs were passed? return authn.forget(request) def permits(self, request, context, permission): diff --git a/tests/test_security.py b/tests/test_security.py index 715d99804..1c969e305 100644 --- a/tests/test_security.py +++ b/tests/test_security.py @@ -466,6 +466,12 @@ class TestLegacySecurityPolicy(unittest.TestCase): policy.forget(request), [('X-Pyramid-Test', 'logout')] ) + def test_forget_with_kwargs(self): + from pyramid.security import LegacySecurityPolicy + + policy = LegacySecurityPolicy() + self.assertRaises(ValueError, lambda: policy.forget(None, foo='bar')) + def test_permits(self): from pyramid.security import LegacySecurityPolicy |
