sanic-security 1.16.9__py3-none-any.whl → 1.16.10__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/models.py +1 -2
- {sanic_security-1.16.9.dist-info → sanic_security-1.16.10.dist-info}/METADATA +9 -12
- {sanic_security-1.16.9.dist-info → sanic_security-1.16.10.dist-info}/RECORD +6 -6
- {sanic_security-1.16.9.dist-info → sanic_security-1.16.10.dist-info}/WHEEL +1 -1
- {sanic_security-1.16.9.dist-info → sanic_security-1.16.10.dist-info}/licenses/LICENSE +0 -0
- {sanic_security-1.16.9.dist-info → sanic_security-1.16.10.dist-info}/top_level.txt +0 -0
sanic_security/models.py
CHANGED
@@ -369,8 +369,7 @@ class Session(BaseModel):
|
|
369
369
|
samesite=config.SESSION_SAMESITE,
|
370
370
|
secure=config.SESSION_SECURE,
|
371
371
|
domain=config.SESSION_DOMAIN,
|
372
|
-
expires=getattr(self, "refresh_expiration_date",
|
373
|
-
or self.expiration_date,
|
372
|
+
expires=getattr(self, "refresh_expiration_date", self.expiration_date),
|
374
373
|
)
|
375
374
|
|
376
375
|
@property
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: sanic-security
|
3
|
-
Version: 1.16.
|
3
|
+
Version: 1.16.10
|
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/
|
@@ -122,19 +122,16 @@ pip3 install sanic-security --upgrade
|
|
122
122
|
|
123
123
|
### Configuration
|
124
124
|
|
125
|
-
Sanic Security configuration is merely
|
126
|
-
|
125
|
+
Sanic Security configuration is merely a `SimpleNamespace` that can be modified using dot-notation.
|
127
126
|
For example:
|
128
127
|
|
129
128
|
```python
|
130
129
|
from sanic_security.configuration import config as security_config
|
131
130
|
|
132
131
|
security_config.SECRET = "This is a big secret. Shhhhh"
|
133
|
-
security_config
|
132
|
+
security_config.CAPTCHA_FONT = "resources/captcha-font.ttf"
|
134
133
|
```
|
135
134
|
|
136
|
-
You can also use the update() method like on regular dictionaries.
|
137
|
-
|
138
135
|
Any environment variables defined with the SANIC_SECURITY_ prefix will be applied to the config. For example, setting
|
139
136
|
SANIC_SECURITY_SECRET will be loaded by the application automatically and fed into the SECRET config variable.
|
140
137
|
|
@@ -295,9 +292,7 @@ Verifies the client's account via two-step session code.
|
|
295
292
|
@app.put("api/security/verify")
|
296
293
|
async def on_verify(request):
|
297
294
|
two_step_session = await verify_account(request)
|
298
|
-
return json(
|
299
|
-
"You have verified your account and may login!", two_step_session.bearer.json
|
300
|
-
)
|
295
|
+
return json("You have verified your account and may login!", two_step_session.json)
|
301
296
|
```
|
302
297
|
|
303
298
|
* Login (with two-factor authentication)
|
@@ -319,7 +314,7 @@ async def on_login(request):
|
|
319
314
|
) # Custom method for emailing verification code.
|
320
315
|
response = json(
|
321
316
|
"Login successful! Two-factor authentication required.",
|
322
|
-
authentication_session.
|
317
|
+
authentication_session.json,
|
323
318
|
)
|
324
319
|
authentication_session.encode(response)
|
325
320
|
two_step_session.encode(response)
|
@@ -342,7 +337,7 @@ async def on_two_factor_authentication(request):
|
|
342
337
|
authentication_session = await fulfill_second_factor(request)
|
343
338
|
response = json(
|
344
339
|
"Authentication session second-factor fulfilled! You are now authenticated.",
|
345
|
-
authentication_session.
|
340
|
+
authentication_session.json,
|
346
341
|
)
|
347
342
|
return response
|
348
343
|
```
|
@@ -368,7 +363,9 @@ async def on_anonymous_login(request):
|
|
368
363
|
@app.post("api/security/logout")
|
369
364
|
async def on_logout(request):
|
370
365
|
authentication_session = await logout(request)
|
371
|
-
token_info = await oauth_revoke(
|
366
|
+
token_info = await oauth_revoke(
|
367
|
+
request, google_oauth
|
368
|
+
) # Remove if not utilizing OAuth
|
372
369
|
response = json(
|
373
370
|
"Logout successful!",
|
374
371
|
{"token_info": token_info, "auth_session": authentication_session.json},
|
@@ -3,15 +3,15 @@ sanic_security/authentication.py,sha256=APs_YkwQCAEKyQo76ukKazQLGcm9fYrve6CUNxK2
|
|
3
3
|
sanic_security/authorization.py,sha256=Hj1TXWppq7KDH-BQXFNihpZTbaimxnVCbif_Zb5W1bA,8232
|
4
4
|
sanic_security/configuration.py,sha256=HxlKWe1vrQsxNtpoOx86RuHtkZz7Mjo88hMCMhTDvfo,6162
|
5
5
|
sanic_security/exceptions.py,sha256=b_E6wbbtk9ziFfH3jZstp2E01hTm6V1yjTltANYAuMY,5582
|
6
|
-
sanic_security/models.py,sha256=
|
6
|
+
sanic_security/models.py,sha256=nA4QqmYEMga4ufVTNggJiIuzZtTOYGOquOSlrKMeVdw,22076
|
7
7
|
sanic_security/oauth.py,sha256=X1fx5KwvtWOa9ABGj7-MZ82ztlVeEuDz55yOh1Vtkes,8405
|
8
8
|
sanic_security/utils.py,sha256=WlPOEEQGcfZk-GbPNu6OiysNXAo9mw80TitDV7XxWMc,3762
|
9
9
|
sanic_security/verification.py,sha256=vr_64HLC7TfOwhki7B4Xn3XQJ0V6OoVgh8fR4DISZ44,8085
|
10
10
|
sanic_security/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
sanic_security/test/server.py,sha256=bVltV-AB_CEz9xrnVIft88FU6IYPgOOWuoSHDijeTDs,13717
|
12
12
|
sanic_security/test/tests.py,sha256=YXyn9aJmYg7vCjUuAs8FcI_lGIgzhmMe4AYTzu47_18,22618
|
13
|
-
sanic_security-1.16.
|
14
|
-
sanic_security-1.16.
|
15
|
-
sanic_security-1.16.
|
16
|
-
sanic_security-1.16.
|
17
|
-
sanic_security-1.16.
|
13
|
+
sanic_security-1.16.10.dist-info/licenses/LICENSE,sha256=sXlJs9_mG-dCkPfWsDnuzydJWagS82E2gYtkVH9enHA,1100
|
14
|
+
sanic_security-1.16.10.dist-info/METADATA,sha256=_3h-20wix8oJ_Aeyv7IFYJFh7Vjxh8YTkVwnpsOR-gY,25532
|
15
|
+
sanic_security-1.16.10.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
16
|
+
sanic_security-1.16.10.dist-info/top_level.txt,sha256=ZybkhHXSjfzhmv8XeqLvnNmLmv21Z0oPX6Ep4DJN8b0,15
|
17
|
+
sanic_security-1.16.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|