From 942c6c07a643d8f2253b190882fae72aba3f0ea8 Mon Sep 17 00:00:00 2001 From: Eric Atkin Date: Thu, 28 May 2020 13:05:26 -0600 Subject: cur_domain is effectively equivalent to '.' + cur_domain and therefore negates the effect of wild_domain --- src/pyramid/authentication.py | 2 +- tests/test_authentication.py | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pyramid/authentication.py b/src/pyramid/authentication.py index 47570d5fc..1bddc1ff3 100644 --- a/src/pyramid/authentication.py +++ b/src/pyramid/authentication.py @@ -1035,8 +1035,8 @@ class AuthTktCookieHelper: domains.append('.' + cur_domain.split('.', 1)[1]) else: domains.append(None) - domains.append(cur_domain) if self.wild_domain: + domains.append(cur_domain) domains.append('.' + cur_domain) profile = self.cookie_profile(request) diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 6d3b154e7..deeda5e78 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -1177,18 +1177,12 @@ class TestAuthTktCookieHelper(unittest.TestCase): helper = self._makeOne('secret', wild_domain=False) request = self._makeRequest() result = helper.remember(request, 'other') - self.assertEqual(len(result), 2) + self.assertEqual(len(result), 1) self.assertEqual(result[0][0], 'Set-Cookie') self.assertTrue(result[0][1].endswith('; Path=/; SameSite=Lax')) self.assertTrue(result[0][1].startswith('auth_tkt=')) - self.assertEqual(result[1][0], 'Set-Cookie') - self.assertTrue( - result[1][1].endswith('; Domain=localhost; Path=/; SameSite=Lax') - ) - self.assertTrue(result[1][1].startswith('auth_tkt=')) - def test_remember_parent_domain(self): helper = self._makeOne('secret', parent_domain=True) request = self._makeRequest() -- cgit v1.2.3