yhttp-auth 9.3.1__tar.gz → 9.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {yhttp_auth-9.3.1/yhttp_auth.egg-info → yhttp_auth-9.3.2}/PKG-INFO +1 -1
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/tests/test_accesstoken.py +2 -1
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/tests/test_refreshtoken.py +8 -6
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp/ext/auth/__init__.py +1 -1
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp/ext/auth/authenticator.py +1 -11
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2/yhttp_auth.egg-info}/PKG-INFO +1 -1
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/LICENSE +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/README.md +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/setup.cfg +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/setup.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/tests/test_authenticator.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/tests/test_cli.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/tests/test_csrftoken.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/tests/test_oauth2.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/tests/test_token.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp/ext/auth/cli.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp/ext/auth/exceptions.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp/ext/auth/install.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp/ext/auth/token.py +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp_auth.egg-info/SOURCES.txt +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp_auth.egg-info/dependency_links.txt +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp_auth.egg-info/requires.txt +0 -0
- {yhttp_auth-9.3.1 → yhttp_auth-9.3.2}/yhttp_auth.egg-info/top_level.txt +0 -0
|
@@ -13,6 +13,7 @@ def test_accesstoken(app, httpreq, redis):
|
|
|
13
13
|
domain: example.com
|
|
14
14
|
accesstoken:
|
|
15
15
|
maxage: 30
|
|
16
|
+
leeway: 4
|
|
16
17
|
refreshtoken:
|
|
17
18
|
enabled: false
|
|
18
19
|
''')
|
|
@@ -65,7 +66,7 @@ def test_accesstoken(app, httpreq, redis):
|
|
|
65
66
|
assert status == 201
|
|
66
67
|
assert response.cookies['yhttp-accesstoken'] == \
|
|
67
68
|
f'{accesstoken_expected}; ' \
|
|
68
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
69
|
+
'Domain=example.com; HttpOnly; Max-Age=34; Path=/; ' \
|
|
69
70
|
'SameSite=Strict'
|
|
70
71
|
assert 'yhttp-refreshtoken' not in response.cookies
|
|
71
72
|
accesstoken = response.cookies['yhttp-accesstoken'].split(';', 1)[0]
|
|
@@ -15,9 +15,11 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
15
15
|
domain: example.com
|
|
16
16
|
accesstoken:
|
|
17
17
|
maxage: 30
|
|
18
|
+
leeway: 4
|
|
18
19
|
refreshtoken:
|
|
19
20
|
enabled: true
|
|
20
21
|
maxage: 3600
|
|
22
|
+
leeway: 20
|
|
21
23
|
cookie:
|
|
22
24
|
path: /tokens
|
|
23
25
|
''')
|
|
@@ -67,11 +69,11 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
67
69
|
assert status == 201
|
|
68
70
|
assert response.cookies['yhttp-accesstoken'] == \
|
|
69
71
|
f'{accesstoken_expected}; ' \
|
|
70
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
72
|
+
'Domain=example.com; HttpOnly; Max-Age=34; Path=/; ' \
|
|
71
73
|
'SameSite=Strict'
|
|
72
74
|
assert response.cookies['yhttp-refreshtoken'] == \
|
|
73
75
|
f'{refreshtoken_expected}; ' \
|
|
74
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
76
|
+
'Domain=example.com; HttpOnly; Max-Age=3620; Path=/tokens; ' \
|
|
75
77
|
'SameSite=Strict'
|
|
76
78
|
accesstoken = response.cookies['yhttp-accesstoken'].split(';', 1)[0]
|
|
77
79
|
refreshtoken = response.cookies['yhttp-refreshtoken'].split(';', 1)[0]
|
|
@@ -95,7 +97,7 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
95
97
|
cookies={
|
|
96
98
|
'yhttp-refreshtoken': refreshtoken,
|
|
97
99
|
})
|
|
98
|
-
assert status ==
|
|
100
|
+
assert status == 201
|
|
99
101
|
|
|
100
102
|
when(title='Try to refresh token with access token but without the '
|
|
101
103
|
'refreshtoken',
|
|
@@ -136,7 +138,7 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
136
138
|
'yhttp-accesstoken': accesstoken,
|
|
137
139
|
'yhttp-refreshtoken': bob_refreshtoken,
|
|
138
140
|
})
|
|
139
|
-
assert status ==
|
|
141
|
+
assert status == 201
|
|
140
142
|
|
|
141
143
|
when(title='Try to refresh the access-token',
|
|
142
144
|
path='/tokens',
|
|
@@ -148,11 +150,11 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
148
150
|
assert status == 201
|
|
149
151
|
assert response.cookies['yhttp-accesstoken'] == \
|
|
150
152
|
f'{accesstoken_expected}; ' \
|
|
151
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
153
|
+
'Domain=example.com; HttpOnly; Max-Age=34; Path=/; ' \
|
|
152
154
|
'SameSite=Strict'
|
|
153
155
|
assert response.cookies['yhttp-refreshtoken'] == \
|
|
154
156
|
f'{refreshtoken_expected}; ' \
|
|
155
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
157
|
+
'Domain=example.com; HttpOnly; Max-Age=3620; Path=/tokens; ' \
|
|
156
158
|
'SameSite=Strict'
|
|
157
159
|
accesstoken = response.cookies['yhttp-accesstoken'].split(';', 1)[0]
|
|
158
160
|
|
|
@@ -139,7 +139,7 @@ class Authenticator:
|
|
|
139
139
|
)
|
|
140
140
|
|
|
141
141
|
if hasattr(settings, 'maxage'):
|
|
142
|
-
entry['max-age'] = settings.maxage
|
|
142
|
+
entry['max-age'] = settings.maxage + settings.leeway
|
|
143
143
|
elif hasattr(settings.cookie, 'maxage'):
|
|
144
144
|
entry['max-age'] = settings.cookie.maxage
|
|
145
145
|
|
|
@@ -183,21 +183,11 @@ class Authenticator:
|
|
|
183
183
|
)
|
|
184
184
|
|
|
185
185
|
def session_refresh(self, req):
|
|
186
|
-
# ensure the access token (even expired) but not invalid
|
|
187
|
-
accesstoken = self.token_fromcookie(
|
|
188
|
-
req,
|
|
189
|
-
AccessToken,
|
|
190
|
-
verifyexp=False
|
|
191
|
-
)
|
|
192
|
-
|
|
193
186
|
refreshtoken = self.token_fromcookie(
|
|
194
187
|
req,
|
|
195
188
|
RefreshToken
|
|
196
189
|
)
|
|
197
190
|
|
|
198
|
-
if refreshtoken.id != accesstoken.id:
|
|
199
|
-
raise TokenMissmatchError()
|
|
200
|
-
|
|
201
191
|
accesstoken = AccessToken.create_from(refreshtoken)
|
|
202
192
|
self.session_new(req, accesstoken)
|
|
203
193
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|