yhttp-auth 9.3.0__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.0/yhttp_auth.egg-info → yhttp_auth-9.3.2}/PKG-INFO +2 -2
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/setup.py +1 -1
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/tests/test_accesstoken.py +2 -1
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/tests/test_csrftoken.py +2 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/tests/test_oauth2.py +2 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/tests/test_refreshtoken.py +10 -7
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp/ext/auth/__init__.py +1 -1
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp/ext/auth/authenticator.py +3 -13
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2/yhttp_auth.egg-info}/PKG-INFO +2 -2
- yhttp_auth-9.3.2/yhttp_auth.egg-info/requires.txt +3 -0
- yhttp_auth-9.3.0/yhttp_auth.egg-info/requires.txt +0 -3
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/LICENSE +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/README.md +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/setup.cfg +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/tests/test_authenticator.py +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/tests/test_cli.py +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/tests/test_token.py +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp/ext/auth/cli.py +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp/ext/auth/exceptions.py +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp/ext/auth/install.py +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp/ext/auth/token.py +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp_auth.egg-info/SOURCES.txt +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp_auth.egg-info/dependency_links.txt +0 -0
- {yhttp_auth-9.3.0 → yhttp_auth-9.3.2}/yhttp_auth.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yhttp-auth
|
|
3
|
-
Version: 9.3.
|
|
3
|
+
Version: 9.3.2
|
|
4
4
|
Summary: A very micro http framework.
|
|
5
5
|
Home-page: http://github.com/yhttp/yhttp-auth
|
|
6
6
|
Author: Vahid Mardani
|
|
@@ -22,7 +22,7 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: yhttp<8,>=7.
|
|
25
|
+
Requires-Dist: yhttp<8,>=7.20.1
|
|
26
26
|
Requires-Dist: pyjwt
|
|
27
27
|
Requires-Dist: redis
|
|
28
28
|
Dynamic: author
|
|
@@ -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,10 +15,13 @@ 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
|
|
21
|
-
|
|
22
|
+
leeway: 20
|
|
23
|
+
cookie:
|
|
24
|
+
path: /tokens
|
|
22
25
|
''')
|
|
23
26
|
app.ready()
|
|
24
27
|
|
|
@@ -66,11 +69,11 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
66
69
|
assert status == 201
|
|
67
70
|
assert response.cookies['yhttp-accesstoken'] == \
|
|
68
71
|
f'{accesstoken_expected}; ' \
|
|
69
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
72
|
+
'Domain=example.com; HttpOnly; Max-Age=34; Path=/; ' \
|
|
70
73
|
'SameSite=Strict'
|
|
71
74
|
assert response.cookies['yhttp-refreshtoken'] == \
|
|
72
75
|
f'{refreshtoken_expected}; ' \
|
|
73
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
76
|
+
'Domain=example.com; HttpOnly; Max-Age=3620; Path=/tokens; ' \
|
|
74
77
|
'SameSite=Strict'
|
|
75
78
|
accesstoken = response.cookies['yhttp-accesstoken'].split(';', 1)[0]
|
|
76
79
|
refreshtoken = response.cookies['yhttp-refreshtoken'].split(';', 1)[0]
|
|
@@ -94,7 +97,7 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
94
97
|
cookies={
|
|
95
98
|
'yhttp-refreshtoken': refreshtoken,
|
|
96
99
|
})
|
|
97
|
-
assert status ==
|
|
100
|
+
assert status == 201
|
|
98
101
|
|
|
99
102
|
when(title='Try to refresh token with access token but without the '
|
|
100
103
|
'refreshtoken',
|
|
@@ -135,7 +138,7 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
135
138
|
'yhttp-accesstoken': accesstoken,
|
|
136
139
|
'yhttp-refreshtoken': bob_refreshtoken,
|
|
137
140
|
})
|
|
138
|
-
assert status ==
|
|
141
|
+
assert status == 201
|
|
139
142
|
|
|
140
143
|
when(title='Try to refresh the access-token',
|
|
141
144
|
path='/tokens',
|
|
@@ -147,11 +150,11 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
147
150
|
assert status == 201
|
|
148
151
|
assert response.cookies['yhttp-accesstoken'] == \
|
|
149
152
|
f'{accesstoken_expected}; ' \
|
|
150
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
153
|
+
'Domain=example.com; HttpOnly; Max-Age=34; Path=/; ' \
|
|
151
154
|
'SameSite=Strict'
|
|
152
155
|
assert response.cookies['yhttp-refreshtoken'] == \
|
|
153
156
|
f'{refreshtoken_expected}; ' \
|
|
154
|
-
'Domain=example.com; HttpOnly; Max-Age=
|
|
157
|
+
'Domain=example.com; HttpOnly; Max-Age=3620; Path=/tokens; ' \
|
|
155
158
|
'SameSite=Strict'
|
|
156
159
|
accesstoken = response.cookies['yhttp-accesstoken'].split(';', 1)[0]
|
|
157
160
|
|
|
@@ -93,7 +93,7 @@ class Authenticator:
|
|
|
93
93
|
httponly=settings.cookie.httponly,
|
|
94
94
|
domain=self._settings.domain,
|
|
95
95
|
samesite=settings.cookie.samesite,
|
|
96
|
-
path=settings.cookie.path
|
|
96
|
+
path=settings.cookie.path,
|
|
97
97
|
expires='Thu, 01 Jan 1970 00:00:00 GMT'
|
|
98
98
|
)
|
|
99
99
|
|
|
@@ -135,11 +135,11 @@ class Authenticator:
|
|
|
135
135
|
httponly=settings.cookie.httponly,
|
|
136
136
|
domain=self._settings.domain,
|
|
137
137
|
samesite=settings.cookie.samesite,
|
|
138
|
-
path=settings.cookie.path
|
|
138
|
+
path=settings.cookie.path,
|
|
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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yhttp-auth
|
|
3
|
-
Version: 9.3.
|
|
3
|
+
Version: 9.3.2
|
|
4
4
|
Summary: A very micro http framework.
|
|
5
5
|
Home-page: http://github.com/yhttp/yhttp-auth
|
|
6
6
|
Author: Vahid Mardani
|
|
@@ -22,7 +22,7 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
23
|
Description-Content-Type: text/markdown
|
|
24
24
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: yhttp<8,>=7.
|
|
25
|
+
Requires-Dist: yhttp<8,>=7.20.1
|
|
26
26
|
Requires-Dist: pyjwt
|
|
27
27
|
Requires-Dist: redis
|
|
28
28
|
Dynamic: author
|
|
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
|