sanic-security 1.12.5__tar.gz → 1.12.6__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.
- {sanic_security-1.12.5/sanic_security.egg-info → sanic_security-1.12.6}/PKG-INFO +15 -15
- {sanic_security-1.12.5 → sanic_security-1.12.6}/README.md +13 -13
- {sanic_security-1.12.5 → sanic_security-1.12.6}/pyproject.toml +2 -2
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/utils.py +4 -1
- {sanic_security-1.12.5 → sanic_security-1.12.6/sanic_security.egg-info}/PKG-INFO +15 -15
- {sanic_security-1.12.5 → sanic_security-1.12.6}/LICENSE +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/__init__.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/authentication.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/authorization.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/configuration.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/exceptions.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/models.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/test/__init__.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/test/server.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/test/tests.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security/verification.py +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security.egg-info/SOURCES.txt +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security.egg-info/dependency_links.txt +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security.egg-info/requires.txt +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security.egg-info/top_level.txt +0 -0
- {sanic_security-1.12.5 → sanic_security-1.12.6}/setup.cfg +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sanic-security
|
3
|
-
Version: 1.12.
|
3
|
+
Version: 1.12.6
|
4
4
|
Summary: An async security library for the Sanic framework.
|
5
|
-
Author-email: Aidan Stewart <na.
|
5
|
+
Author-email: Aidan Stewart <me@na-stewart.com>
|
6
6
|
Project-URL: Documentation, https://security.na-stewart.com/
|
7
7
|
Project-URL: Repository, https://github.com/na-stewart/sanic-security
|
8
8
|
Keywords: security,authentication,authorization,verification,async,sanic
|
@@ -197,7 +197,7 @@ async def on_register(request):
|
|
197
197
|
account = await register(request)
|
198
198
|
two_step_session = await request_two_step_verification(request, account)
|
199
199
|
await email_code(
|
200
|
-
account.email, two_step_session.code # Code =
|
200
|
+
account.email, two_step_session.code # Code = 24KF19
|
201
201
|
) # Custom method for emailing verification code.
|
202
202
|
response = json(
|
203
203
|
"Registration successful! Email verification required.",
|
@@ -213,7 +213,7 @@ Verifies the client's account via two-step session code.
|
|
213
213
|
|
214
214
|
| Key | Value |
|
215
215
|
|----------|--------|
|
216
|
-
| **code** |
|
216
|
+
| **code** | 24KF19 |
|
217
217
|
|
218
218
|
```python
|
219
219
|
@app.post("api/security/verify")
|
@@ -237,7 +237,7 @@ async def on_login(request):
|
|
237
237
|
request, authentication_session.bearer
|
238
238
|
)
|
239
239
|
await email_code(
|
240
|
-
authentication_session.bearer.email, two_step_session.code # Code =
|
240
|
+
authentication_session.bearer.email, two_step_session.code # Code = XGED2U
|
241
241
|
) # Custom method for emailing verification code.
|
242
242
|
response = json(
|
243
243
|
"Login successful! Two-factor authentication required.",
|
@@ -256,7 +256,7 @@ Fulfills client authentication session's second factor requirement via two-step
|
|
256
256
|
|
257
257
|
| Key | Value |
|
258
258
|
|----------|--------|
|
259
|
-
| **code** |
|
259
|
+
| **code** | XGED2U |
|
260
260
|
|
261
261
|
```python
|
262
262
|
@app.post("api/security/fulfill-2fa")
|
@@ -323,8 +323,8 @@ async def on_authenticate(request):
|
|
323
323
|
|
324
324
|
* Refresh Encoder
|
325
325
|
|
326
|
-
A new/refreshed session is returned during authentication
|
327
|
-
requires encoding.
|
326
|
+
A new/refreshed session is returned during authentication when the client's current session expires and it
|
327
|
+
requires encoding. This should be be done automatically via middleware.
|
328
328
|
|
329
329
|
```python
|
330
330
|
attach_refresh_encoder(app)
|
@@ -347,7 +347,7 @@ downloading a .ttf font and defining the file's path in the configuration.
|
|
347
347
|
@app.get("api/security/captcha")
|
348
348
|
async def on_captcha_img_request(request):
|
349
349
|
captcha_session = await request_captcha(request)
|
350
|
-
response = captcha_session.get_image() # Captcha:
|
350
|
+
response = captcha_session.get_image() # Captcha: LJ0F3U
|
351
351
|
captcha_session.encode(response)
|
352
352
|
return response
|
353
353
|
```
|
@@ -356,7 +356,7 @@ async def on_captcha_img_request(request):
|
|
356
356
|
|
357
357
|
| Key | Value |
|
358
358
|
|-------------|--------|
|
359
|
-
| **captcha** |
|
359
|
+
| **captcha** | LJ0F3U |
|
360
360
|
|
361
361
|
```python
|
362
362
|
@app.post("api/security/captcha")
|
@@ -369,7 +369,7 @@ async def on_captcha(request):
|
|
369
369
|
|
370
370
|
| Key | Value |
|
371
371
|
|-------------|--------|
|
372
|
-
| **captcha** |
|
372
|
+
| **captcha** | LJ0F3U |
|
373
373
|
|
374
374
|
```python
|
375
375
|
@app.post("api/security/captcha")
|
@@ -391,7 +391,7 @@ Two-step verification should be integrated with other custom functionality. For
|
|
391
391
|
```python
|
392
392
|
@app.post("api/security/two-step/request")
|
393
393
|
async def on_two_step_request(request):
|
394
|
-
two_step_session = await request_two_step_verification(request) # Code =
|
394
|
+
two_step_session = await request_two_step_verification(request) # Code = T2I58I
|
395
395
|
await email_code(
|
396
396
|
two_step_session.bearer.email, two_step_session.code
|
397
397
|
) # Custom method for emailing verification code.
|
@@ -405,7 +405,7 @@ async def on_two_step_request(request):
|
|
405
405
|
```python
|
406
406
|
@app.post("api/security/two-step/resend")
|
407
407
|
async def on_two_step_resend(request):
|
408
|
-
two_step_session = await TwoStepSession.decode(request) # Code =
|
408
|
+
two_step_session = await TwoStepSession.decode(request) # Code = T2I58I
|
409
409
|
await email_code(
|
410
410
|
two_step_session.bearer.email, two_step_session.code
|
411
411
|
) # Custom method for emailing verification code.
|
@@ -416,7 +416,7 @@ async def on_two_step_resend(request):
|
|
416
416
|
|
417
417
|
| Key | Value |
|
418
418
|
|----------|--------|
|
419
|
-
| **code** |
|
419
|
+
| **code** | T2I58I |
|
420
420
|
|
421
421
|
```python
|
422
422
|
@app.post("api/security/two-step")
|
@@ -430,7 +430,7 @@ async def on_two_step_verification(request):
|
|
430
430
|
|
431
431
|
| Key | Value |
|
432
432
|
|----------|--------|
|
433
|
-
| **code** |
|
433
|
+
| **code** | T2I58I |
|
434
434
|
|
435
435
|
```python
|
436
436
|
@app.post("api/security/two-step")
|
@@ -166,7 +166,7 @@ async def on_register(request):
|
|
166
166
|
account = await register(request)
|
167
167
|
two_step_session = await request_two_step_verification(request, account)
|
168
168
|
await email_code(
|
169
|
-
account.email, two_step_session.code # Code =
|
169
|
+
account.email, two_step_session.code # Code = 24KF19
|
170
170
|
) # Custom method for emailing verification code.
|
171
171
|
response = json(
|
172
172
|
"Registration successful! Email verification required.",
|
@@ -182,7 +182,7 @@ Verifies the client's account via two-step session code.
|
|
182
182
|
|
183
183
|
| Key | Value |
|
184
184
|
|----------|--------|
|
185
|
-
| **code** |
|
185
|
+
| **code** | 24KF19 |
|
186
186
|
|
187
187
|
```python
|
188
188
|
@app.post("api/security/verify")
|
@@ -206,7 +206,7 @@ async def on_login(request):
|
|
206
206
|
request, authentication_session.bearer
|
207
207
|
)
|
208
208
|
await email_code(
|
209
|
-
authentication_session.bearer.email, two_step_session.code # Code =
|
209
|
+
authentication_session.bearer.email, two_step_session.code # Code = XGED2U
|
210
210
|
) # Custom method for emailing verification code.
|
211
211
|
response = json(
|
212
212
|
"Login successful! Two-factor authentication required.",
|
@@ -225,7 +225,7 @@ Fulfills client authentication session's second factor requirement via two-step
|
|
225
225
|
|
226
226
|
| Key | Value |
|
227
227
|
|----------|--------|
|
228
|
-
| **code** |
|
228
|
+
| **code** | XGED2U |
|
229
229
|
|
230
230
|
```python
|
231
231
|
@app.post("api/security/fulfill-2fa")
|
@@ -292,8 +292,8 @@ async def on_authenticate(request):
|
|
292
292
|
|
293
293
|
* Refresh Encoder
|
294
294
|
|
295
|
-
A new/refreshed session is returned during authentication
|
296
|
-
requires encoding.
|
295
|
+
A new/refreshed session is returned during authentication when the client's current session expires and it
|
296
|
+
requires encoding. This should be be done automatically via middleware.
|
297
297
|
|
298
298
|
```python
|
299
299
|
attach_refresh_encoder(app)
|
@@ -316,7 +316,7 @@ downloading a .ttf font and defining the file's path in the configuration.
|
|
316
316
|
@app.get("api/security/captcha")
|
317
317
|
async def on_captcha_img_request(request):
|
318
318
|
captcha_session = await request_captcha(request)
|
319
|
-
response = captcha_session.get_image() # Captcha:
|
319
|
+
response = captcha_session.get_image() # Captcha: LJ0F3U
|
320
320
|
captcha_session.encode(response)
|
321
321
|
return response
|
322
322
|
```
|
@@ -325,7 +325,7 @@ async def on_captcha_img_request(request):
|
|
325
325
|
|
326
326
|
| Key | Value |
|
327
327
|
|-------------|--------|
|
328
|
-
| **captcha** |
|
328
|
+
| **captcha** | LJ0F3U |
|
329
329
|
|
330
330
|
```python
|
331
331
|
@app.post("api/security/captcha")
|
@@ -338,7 +338,7 @@ async def on_captcha(request):
|
|
338
338
|
|
339
339
|
| Key | Value |
|
340
340
|
|-------------|--------|
|
341
|
-
| **captcha** |
|
341
|
+
| **captcha** | LJ0F3U |
|
342
342
|
|
343
343
|
```python
|
344
344
|
@app.post("api/security/captcha")
|
@@ -360,7 +360,7 @@ Two-step verification should be integrated with other custom functionality. For
|
|
360
360
|
```python
|
361
361
|
@app.post("api/security/two-step/request")
|
362
362
|
async def on_two_step_request(request):
|
363
|
-
two_step_session = await request_two_step_verification(request) # Code =
|
363
|
+
two_step_session = await request_two_step_verification(request) # Code = T2I58I
|
364
364
|
await email_code(
|
365
365
|
two_step_session.bearer.email, two_step_session.code
|
366
366
|
) # Custom method for emailing verification code.
|
@@ -374,7 +374,7 @@ async def on_two_step_request(request):
|
|
374
374
|
```python
|
375
375
|
@app.post("api/security/two-step/resend")
|
376
376
|
async def on_two_step_resend(request):
|
377
|
-
two_step_session = await TwoStepSession.decode(request) # Code =
|
377
|
+
two_step_session = await TwoStepSession.decode(request) # Code = T2I58I
|
378
378
|
await email_code(
|
379
379
|
two_step_session.bearer.email, two_step_session.code
|
380
380
|
) # Custom method for emailing verification code.
|
@@ -385,7 +385,7 @@ async def on_two_step_resend(request):
|
|
385
385
|
|
386
386
|
| Key | Value |
|
387
387
|
|----------|--------|
|
388
|
-
| **code** |
|
388
|
+
| **code** | T2I58I |
|
389
389
|
|
390
390
|
```python
|
391
391
|
@app.post("api/security/two-step")
|
@@ -399,7 +399,7 @@ async def on_two_step_verification(request):
|
|
399
399
|
|
400
400
|
| Key | Value |
|
401
401
|
|----------|--------|
|
402
|
-
| **code** |
|
402
|
+
| **code** | T2I58I |
|
403
403
|
|
404
404
|
```python
|
405
405
|
@app.post("api/security/two-step")
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "sanic-security"
|
7
|
-
version = "1.12.
|
7
|
+
version = "1.12.6"
|
8
8
|
requires-python = ">=3.8"
|
9
9
|
dependencies = [
|
10
10
|
"tortoise-orm>=0.17.0",
|
@@ -16,7 +16,7 @@ dependencies = [
|
|
16
16
|
]
|
17
17
|
description = "An async security library for the Sanic framework."
|
18
18
|
authors = [
|
19
|
-
{ name="Aidan Stewart", email="na.
|
19
|
+
{ name="Aidan Stewart", email="me@na-stewart.com" },
|
20
20
|
]
|
21
21
|
readme = "README.md"
|
22
22
|
keywords = ["security", "authentication", "authorization", "verification", "async", "sanic"]
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import datetime
|
2
2
|
import random
|
3
|
+
import string
|
3
4
|
|
4
5
|
from sanic.request import Request
|
5
6
|
from sanic.response import json as sanic_json, HTTPResponse
|
@@ -47,7 +48,9 @@ def get_code() -> str:
|
|
47
48
|
Returns:
|
48
49
|
code
|
49
50
|
"""
|
50
|
-
return
|
51
|
+
return "".join(
|
52
|
+
random.choice(string.ascii_uppercase + string.digits) for _ in range(6)
|
53
|
+
)
|
51
54
|
|
52
55
|
|
53
56
|
def json(
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sanic-security
|
3
|
-
Version: 1.12.
|
3
|
+
Version: 1.12.6
|
4
4
|
Summary: An async security library for the Sanic framework.
|
5
|
-
Author-email: Aidan Stewart <na.
|
5
|
+
Author-email: Aidan Stewart <me@na-stewart.com>
|
6
6
|
Project-URL: Documentation, https://security.na-stewart.com/
|
7
7
|
Project-URL: Repository, https://github.com/na-stewart/sanic-security
|
8
8
|
Keywords: security,authentication,authorization,verification,async,sanic
|
@@ -197,7 +197,7 @@ async def on_register(request):
|
|
197
197
|
account = await register(request)
|
198
198
|
two_step_session = await request_two_step_verification(request, account)
|
199
199
|
await email_code(
|
200
|
-
account.email, two_step_session.code # Code =
|
200
|
+
account.email, two_step_session.code # Code = 24KF19
|
201
201
|
) # Custom method for emailing verification code.
|
202
202
|
response = json(
|
203
203
|
"Registration successful! Email verification required.",
|
@@ -213,7 +213,7 @@ Verifies the client's account via two-step session code.
|
|
213
213
|
|
214
214
|
| Key | Value |
|
215
215
|
|----------|--------|
|
216
|
-
| **code** |
|
216
|
+
| **code** | 24KF19 |
|
217
217
|
|
218
218
|
```python
|
219
219
|
@app.post("api/security/verify")
|
@@ -237,7 +237,7 @@ async def on_login(request):
|
|
237
237
|
request, authentication_session.bearer
|
238
238
|
)
|
239
239
|
await email_code(
|
240
|
-
authentication_session.bearer.email, two_step_session.code # Code =
|
240
|
+
authentication_session.bearer.email, two_step_session.code # Code = XGED2U
|
241
241
|
) # Custom method for emailing verification code.
|
242
242
|
response = json(
|
243
243
|
"Login successful! Two-factor authentication required.",
|
@@ -256,7 +256,7 @@ Fulfills client authentication session's second factor requirement via two-step
|
|
256
256
|
|
257
257
|
| Key | Value |
|
258
258
|
|----------|--------|
|
259
|
-
| **code** |
|
259
|
+
| **code** | XGED2U |
|
260
260
|
|
261
261
|
```python
|
262
262
|
@app.post("api/security/fulfill-2fa")
|
@@ -323,8 +323,8 @@ async def on_authenticate(request):
|
|
323
323
|
|
324
324
|
* Refresh Encoder
|
325
325
|
|
326
|
-
A new/refreshed session is returned during authentication
|
327
|
-
requires encoding.
|
326
|
+
A new/refreshed session is returned during authentication when the client's current session expires and it
|
327
|
+
requires encoding. This should be be done automatically via middleware.
|
328
328
|
|
329
329
|
```python
|
330
330
|
attach_refresh_encoder(app)
|
@@ -347,7 +347,7 @@ downloading a .ttf font and defining the file's path in the configuration.
|
|
347
347
|
@app.get("api/security/captcha")
|
348
348
|
async def on_captcha_img_request(request):
|
349
349
|
captcha_session = await request_captcha(request)
|
350
|
-
response = captcha_session.get_image() # Captcha:
|
350
|
+
response = captcha_session.get_image() # Captcha: LJ0F3U
|
351
351
|
captcha_session.encode(response)
|
352
352
|
return response
|
353
353
|
```
|
@@ -356,7 +356,7 @@ async def on_captcha_img_request(request):
|
|
356
356
|
|
357
357
|
| Key | Value |
|
358
358
|
|-------------|--------|
|
359
|
-
| **captcha** |
|
359
|
+
| **captcha** | LJ0F3U |
|
360
360
|
|
361
361
|
```python
|
362
362
|
@app.post("api/security/captcha")
|
@@ -369,7 +369,7 @@ async def on_captcha(request):
|
|
369
369
|
|
370
370
|
| Key | Value |
|
371
371
|
|-------------|--------|
|
372
|
-
| **captcha** |
|
372
|
+
| **captcha** | LJ0F3U |
|
373
373
|
|
374
374
|
```python
|
375
375
|
@app.post("api/security/captcha")
|
@@ -391,7 +391,7 @@ Two-step verification should be integrated with other custom functionality. For
|
|
391
391
|
```python
|
392
392
|
@app.post("api/security/two-step/request")
|
393
393
|
async def on_two_step_request(request):
|
394
|
-
two_step_session = await request_two_step_verification(request) # Code =
|
394
|
+
two_step_session = await request_two_step_verification(request) # Code = T2I58I
|
395
395
|
await email_code(
|
396
396
|
two_step_session.bearer.email, two_step_session.code
|
397
397
|
) # Custom method for emailing verification code.
|
@@ -405,7 +405,7 @@ async def on_two_step_request(request):
|
|
405
405
|
```python
|
406
406
|
@app.post("api/security/two-step/resend")
|
407
407
|
async def on_two_step_resend(request):
|
408
|
-
two_step_session = await TwoStepSession.decode(request) # Code =
|
408
|
+
two_step_session = await TwoStepSession.decode(request) # Code = T2I58I
|
409
409
|
await email_code(
|
410
410
|
two_step_session.bearer.email, two_step_session.code
|
411
411
|
) # Custom method for emailing verification code.
|
@@ -416,7 +416,7 @@ async def on_two_step_resend(request):
|
|
416
416
|
|
417
417
|
| Key | Value |
|
418
418
|
|----------|--------|
|
419
|
-
| **code** |
|
419
|
+
| **code** | T2I58I |
|
420
420
|
|
421
421
|
```python
|
422
422
|
@app.post("api/security/two-step")
|
@@ -430,7 +430,7 @@ async def on_two_step_verification(request):
|
|
430
430
|
|
431
431
|
| Key | Value |
|
432
432
|
|----------|--------|
|
433
|
-
| **code** |
|
433
|
+
| **code** | T2I58I |
|
434
434
|
|
435
435
|
```python
|
436
436
|
@app.post("api/security/two-step")
|
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
|
{sanic_security-1.12.5 → sanic_security-1.12.6}/sanic_security.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|