yhttp-auth 9.3.2__tar.gz → 10.2.0__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.2 → yhttp_auth-10.2.0}/PKG-INFO +2 -2
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/setup.py +1 -1
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/tests/test_accesstoken.py +3 -3
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/tests/test_refreshtoken.py +4 -4
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp/ext/auth/__init__.py +1 -1
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp/ext/auth/authenticator.py +7 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp/ext/auth/install.py +2 -2
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp/ext/auth/token.py +0 -16
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp_auth.egg-info/PKG-INFO +2 -2
- yhttp_auth-10.2.0/yhttp_auth.egg-info/requires.txt +3 -0
- yhttp_auth-9.3.2/yhttp_auth.egg-info/requires.txt +0 -3
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/LICENSE +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/README.md +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/setup.cfg +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/tests/test_authenticator.py +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/tests/test_cli.py +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/tests/test_csrftoken.py +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/tests/test_oauth2.py +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/tests/test_token.py +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp/ext/auth/cli.py +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp/ext/auth/exceptions.py +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp_auth.egg-info/SOURCES.txt +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/yhttp_auth.egg-info/dependency_links.txt +0 -0
- {yhttp_auth-9.3.2 → yhttp_auth-10.2.0}/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:
|
|
3
|
+
Version: 10.2.0
|
|
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
|
|
25
|
+
Requires-Dist: yhttp<9,>=8.0.1
|
|
26
26
|
Requires-Dist: pyjwt
|
|
27
27
|
Requires-Dist: redis
|
|
28
28
|
Dynamic: author
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from bddrest import status, response, when, given
|
|
2
2
|
from freezegun import freeze_time
|
|
3
3
|
|
|
4
|
-
from yhttp.core import
|
|
4
|
+
from yhttp.core import text, statuses
|
|
5
5
|
|
|
6
6
|
from yhttp.ext.auth import install, AccessToken
|
|
7
7
|
|
|
@@ -26,14 +26,14 @@ def test_accesstoken(app, httpreq, redis):
|
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
@app.route('/tokens')
|
|
29
|
-
@
|
|
29
|
+
@statuses.created()
|
|
30
30
|
def create(req):
|
|
31
31
|
token = AccessToken('Alice')
|
|
32
32
|
app.auth.session_new(req, token)
|
|
33
33
|
|
|
34
34
|
@app.route('/tokens')
|
|
35
35
|
@app.auth()
|
|
36
|
-
@
|
|
36
|
+
@statuses.nocontent()
|
|
37
37
|
def delete(req):
|
|
38
38
|
app.auth.session_delete(req)
|
|
39
39
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from bddrest import status, response, when
|
|
2
2
|
from freezegun import freeze_time
|
|
3
3
|
|
|
4
|
-
from yhttp.core import
|
|
4
|
+
from yhttp.core import statuses, text, statuses
|
|
5
5
|
|
|
6
6
|
from yhttp.ext.auth import install, AccessToken, RefreshToken, \
|
|
7
7
|
TokenMissingError, TokenDecodeError, TokenMissmatchError, \
|
|
@@ -37,13 +37,13 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
37
37
|
)
|
|
38
38
|
|
|
39
39
|
@app.route('/tokens')
|
|
40
|
-
@
|
|
40
|
+
@statuses.created()
|
|
41
41
|
def create(req):
|
|
42
42
|
token = AccessToken('Alice')
|
|
43
43
|
app.auth.session_new(req, token)
|
|
44
44
|
|
|
45
45
|
@app.route('/tokens')
|
|
46
|
-
@
|
|
46
|
+
@statuses.created()
|
|
47
47
|
def refresh(req):
|
|
48
48
|
try:
|
|
49
49
|
app.auth.session_refresh(req)
|
|
@@ -53,7 +53,7 @@ def test_refreshtoken(app, httpreq, redis):
|
|
|
53
53
|
|
|
54
54
|
@app.route('/tokens')
|
|
55
55
|
@app.auth()
|
|
56
|
-
@
|
|
56
|
+
@statuses.nocontent()
|
|
57
57
|
def delete(req):
|
|
58
58
|
app.auth.session_delete(req)
|
|
59
59
|
|
|
@@ -183,6 +183,13 @@ class Authenticator:
|
|
|
183
183
|
)
|
|
184
184
|
|
|
185
185
|
def session_refresh(self, req):
|
|
186
|
+
"""Create and set new access-token based on cookie's refresh-token.
|
|
187
|
+
|
|
188
|
+
:raises :class:`TokenMissingError`:
|
|
189
|
+
:raises :class:`TokenDecodeError`:
|
|
190
|
+
:raises :class:`TokenExpiredError`:
|
|
191
|
+
"""
|
|
192
|
+
|
|
186
193
|
refreshtoken = self.token_fromcookie(
|
|
187
194
|
req,
|
|
188
195
|
RefreshToken
|
|
@@ -2,7 +2,7 @@ from .authenticator import Authenticator
|
|
|
2
2
|
from .cli import AuthenticatorCLI
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def install(app, cliarguments=None):
|
|
5
|
+
def install(app, cliarguments=None, **kw):
|
|
6
6
|
app.cliarguments.append(AuthenticatorCLI)
|
|
7
7
|
if cliarguments:
|
|
8
8
|
AuthenticatorCLI.__arguments__.extend(cliarguments)
|
|
@@ -20,4 +20,4 @@ def install(app, cliarguments=None):
|
|
|
20
20
|
app.auth.shutdown()
|
|
21
21
|
|
|
22
22
|
app.auth = auth
|
|
23
|
-
app.request_factory = auth.middleware(app.request_factory)
|
|
23
|
+
app.request_factory = auth.middleware(app.request_factory, **kw)
|
|
@@ -68,14 +68,6 @@ class AccessToken(JWTToken):
|
|
|
68
68
|
def __init__(self, id, roles=None, **payload):
|
|
69
69
|
super().__init__(id=id, roles=roles or ['user'], **payload)
|
|
70
70
|
|
|
71
|
-
# @property
|
|
72
|
-
# def id(self):
|
|
73
|
-
# return self.payload['id']
|
|
74
|
-
|
|
75
|
-
# @property
|
|
76
|
-
# def roles(self):
|
|
77
|
-
# return self.payload['roles']
|
|
78
|
-
|
|
79
71
|
def authorize(self, *roles):
|
|
80
72
|
return set(roles) & set(self.roles)
|
|
81
73
|
|
|
@@ -91,11 +83,3 @@ class RefreshToken(AccessToken):
|
|
|
91
83
|
class OAuth2StateToken(JWTToken):
|
|
92
84
|
def __init__(self, csrf, redirecturl, **payload):
|
|
93
85
|
super().__init__(csrf=csrf, redirecturl=redirecturl, **payload)
|
|
94
|
-
|
|
95
|
-
# @property
|
|
96
|
-
# def csrf(self):
|
|
97
|
-
# return self.payload['csrf']
|
|
98
|
-
|
|
99
|
-
# @property
|
|
100
|
-
# def redirecturl(self):
|
|
101
|
-
# return self.payload['redirecturl']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: yhttp-auth
|
|
3
|
-
Version:
|
|
3
|
+
Version: 10.2.0
|
|
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
|
|
25
|
+
Requires-Dist: yhttp<9,>=8.0.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
|