sanic-security 1.14.0__py3-none-any.whl → 1.14.1__py3-none-any.whl
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.
- sanic_security/authentication.py +10 -7
- sanic_security/test/server.py +0 -1
- {sanic_security-1.14.0.dist-info → sanic_security-1.14.1.dist-info}/METADATA +5 -6
- {sanic_security-1.14.0.dist-info → sanic_security-1.14.1.dist-info}/RECORD +7 -7
- {sanic_security-1.14.0.dist-info → sanic_security-1.14.1.dist-info}/WHEEL +1 -1
- {sanic_security-1.14.0.dist-info → sanic_security-1.14.1.dist-info}/LICENSE +0 -0
- {sanic_security-1.14.0.dist-info → sanic_security-1.14.1.dist-info}/top_level.txt +0 -0
sanic_security/authentication.py
CHANGED
@@ -291,13 +291,6 @@ def initialize_security(app: Sanic, create_root=True) -> None:
|
|
291
291
|
create_root (bool): Determines root account creation on initialization.
|
292
292
|
"""
|
293
293
|
|
294
|
-
@app.on_response
|
295
|
-
async def response_handler_middleware(request, response):
|
296
|
-
if hasattr(request.ctx, "session"):
|
297
|
-
secure_headers.set_headers(response)
|
298
|
-
if request.ctx.session.is_refresh:
|
299
|
-
request.ctx.session.encode(response)
|
300
|
-
|
301
294
|
@app.listener("before_server_start")
|
302
295
|
async def audit_configuration(app, loop):
|
303
296
|
if security_config.SECRET == DEFAULT_CONFIG["SECRET"]:
|
@@ -361,3 +354,13 @@ def initialize_security(app: Sanic, create_root=True) -> None:
|
|
361
354
|
)
|
362
355
|
await account.roles.add(role)
|
363
356
|
logger.info("Initial admin account created.")
|
357
|
+
|
358
|
+
@app.on_response
|
359
|
+
async def response_handler_middleware(request, response):
|
360
|
+
if hasattr(request.ctx, "session"):
|
361
|
+
secure_headers.set_headers(response)
|
362
|
+
if (
|
363
|
+
hasattr(request.ctx.session, "is_refresh")
|
364
|
+
and request.ctx.session.is_refresh
|
365
|
+
):
|
366
|
+
request.ctx.session.encode(response)
|
sanic_security/test/server.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sanic-security
|
3
|
-
Version: 1.14.
|
3
|
+
Version: 1.14.1
|
4
4
|
Summary: An async security library for the Sanic framework.
|
5
5
|
Author-email: Aidan Stewart <me@na-stewart.com>
|
6
6
|
Project-URL: Documentation, https://security.na-stewart.com/
|
@@ -21,14 +21,14 @@ Requires-Dist: pillow>=9.5.0
|
|
21
21
|
Requires-Dist: argon2-cffi>=20.1.0
|
22
22
|
Requires-Dist: sanic>=21.3.0
|
23
23
|
Requires-Dist: secure>=1.0.1
|
24
|
-
Provides-Extra: crypto
|
25
|
-
Requires-Dist: cryptography>=3.3.1; extra == "crypto"
|
26
24
|
Provides-Extra: dev
|
27
25
|
Requires-Dist: httpx; extra == "dev"
|
28
26
|
Requires-Dist: black; extra == "dev"
|
29
27
|
Requires-Dist: blacken-docs; extra == "dev"
|
30
28
|
Requires-Dist: pdoc3; extra == "dev"
|
31
29
|
Requires-Dist: cryptography; extra == "dev"
|
30
|
+
Provides-Extra: crypto
|
31
|
+
Requires-Dist: cryptography>=3.3.1; extra == "crypto"
|
32
32
|
|
33
33
|
<!-- PROJECT SHIELDS -->
|
34
34
|
<!--
|
@@ -212,7 +212,7 @@ Verifies the client's account via two-step session code.
|
|
212
212
|
| **code** | 24KF19 |
|
213
213
|
|
214
214
|
```python
|
215
|
-
@app.
|
215
|
+
@app.put("api/security/verify")
|
216
216
|
async def on_verify(request):
|
217
217
|
two_step_session = await verify_account(request)
|
218
218
|
return json("You have verified your account and may login!", two_step_session.json)
|
@@ -255,14 +255,13 @@ Fulfills client authentication session's second factor requirement via two-step
|
|
255
255
|
| **code** | XGED2U |
|
256
256
|
|
257
257
|
```python
|
258
|
-
@app.
|
258
|
+
@app.put("api/security/fulfill-2fa")
|
259
259
|
async def on_two_factor_authentication(request):
|
260
260
|
authentication_session = await fulfill_second_factor(request)
|
261
261
|
response = json(
|
262
262
|
"Authentication session second-factor fulfilled! You are now authenticated.",
|
263
263
|
authentication_session.json,
|
264
264
|
)
|
265
|
-
authentication_session.encode(response)
|
266
265
|
return response
|
267
266
|
```
|
268
267
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
sanic_security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
sanic_security/authentication.py,sha256=
|
2
|
+
sanic_security/authentication.py,sha256=ksHa4E82kNXNRKGSqeO28xfQWdF2pJDxUaaQy9snKwU,13299
|
3
3
|
sanic_security/authorization.py,sha256=QvLsaOWu3te0Y75tqChrEXQP5CR92nsRU7LXiUWy5cw,7541
|
4
4
|
sanic_security/configuration.py,sha256=h-Kh4PalJpjbDcZvVHCzxX5l-GnldP3Fr8OlgGCZNHY,5680
|
5
5
|
sanic_security/exceptions.py,sha256=JiCaBR2kjE1Cj0fc_08y-32fqJJXa_1UCw205T4_RTY,5493
|
@@ -7,10 +7,10 @@ sanic_security/models.py,sha256=bK5daR6Iq7V7aqNSzksH6DGrCXMj2e4feNRhlxlFQMg,2272
|
|
7
7
|
sanic_security/utils.py,sha256=tgewsCAkNl_NkobHaDlZNIgVopQPiD8SWb6UC6tBYNs,3151
|
8
8
|
sanic_security/verification.py,sha256=olmpP2AwXKILRVRnDf7AMRJuK5Fs_i5ESHXSH94A-Yk,8694
|
9
9
|
sanic_security/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
sanic_security/test/server.py,sha256=
|
10
|
+
sanic_security/test/server.py,sha256=RjL9Kfvkfqpm5TXWwFQKKa0J4hfTKgwI6U0s_TAKO8w,11984
|
11
11
|
sanic_security/test/tests.py,sha256=bW5fHJfsCrg8eBmcSqVMLm0R5XRL1ou-XJJRgz09GOE,21993
|
12
|
-
sanic_security-1.14.
|
13
|
-
sanic_security-1.14.
|
14
|
-
sanic_security-1.14.
|
15
|
-
sanic_security-1.14.
|
16
|
-
sanic_security-1.14.
|
12
|
+
sanic_security-1.14.1.dist-info/LICENSE,sha256=sXlJs9_mG-dCkPfWsDnuzydJWagS82E2gYtkVH9enHA,1100
|
13
|
+
sanic_security-1.14.1.dist-info/METADATA,sha256=It9-aEffADsbk5GJGO0SEG2DUd1wTq7FRl64l5oMcdA,23259
|
14
|
+
sanic_security-1.14.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
15
|
+
sanic_security-1.14.1.dist-info/top_level.txt,sha256=ZybkhHXSjfzhmv8XeqLvnNmLmv21Z0oPX6Ep4DJN8b0,15
|
16
|
+
sanic_security-1.14.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|