arpakitlib 1.7.77__py3-none-any.whl → 1.7.78__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.
- arpakitlib/_arpakit_project_template/src/api/auth.py +19 -3
- arpakitlib/_arpakit_project_template/src/core/settings.py +2 -0
- arpakitlib/ar_fastapi_util.py +9 -1
- {arpakitlib-1.7.77.dist-info → arpakitlib-1.7.78.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.77.dist-info → arpakitlib-1.7.78.dist-info}/RECORD +9 -9
- {arpakitlib-1.7.77.dist-info → arpakitlib-1.7.78.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.77.dist-info → arpakitlib-1.7.78.dist-info}/NOTICE +0 -0
- {arpakitlib-1.7.77.dist-info → arpakitlib-1.7.78.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.77.dist-info → arpakitlib-1.7.78.dist-info}/entry_points.txt +0 -0
@@ -1,6 +1,22 @@
|
|
1
|
-
from arpakitlib.ar_fastapi_util import
|
1
|
+
from arpakitlib.ar_fastapi_util import base_api_auth
|
2
2
|
from src.core.settings import get_cached_settings
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
api_key_with_settings_api_auth = base_api_auth(
|
5
|
+
correct_api_keys=get_cached_settings().api_correct_api_key,
|
6
|
+
require_correct_api_key=False
|
7
|
+
)
|
8
|
+
|
9
|
+
correct_api_key_with_settings_api_auth = base_api_auth(
|
10
|
+
correct_api_keys=get_cached_settings().api_correct_api_key,
|
11
|
+
require_correct_api_key=True
|
12
|
+
)
|
13
|
+
|
14
|
+
token_with_settings_api_auth = base_api_auth(
|
15
|
+
correct_api_keys=get_cached_settings().api_correct_token,
|
16
|
+
require_correct_token=False
|
17
|
+
)
|
18
|
+
|
19
|
+
correct_token_with_settings_api_auth = base_api_auth(
|
20
|
+
correct_api_keys=get_cached_settings().api_correct_token,
|
21
|
+
require_correct_token=True
|
6
22
|
)
|
arpakitlib/ar_fastapi_util.py
CHANGED
@@ -34,7 +34,7 @@ from arpakitlib.ar_json_util import safely_transfer_obj_to_json_str_to_json_obj
|
|
34
34
|
from arpakitlib.ar_logging_util import setup_normal_logging
|
35
35
|
from arpakitlib.ar_sqlalchemy_model_util import StoryLogDBM
|
36
36
|
from arpakitlib.ar_sqlalchemy_util import SQLAlchemyDB
|
37
|
-
from arpakitlib.ar_type_util import raise_for_type
|
37
|
+
from arpakitlib.ar_type_util import raise_for_type, raise_if_none
|
38
38
|
|
39
39
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
40
40
|
|
@@ -498,6 +498,14 @@ def base_api_auth(
|
|
498
498
|
raise_for_type(correct_tokens, list)
|
499
499
|
validate_token_func = lambda *args, **kwargs: kwargs["token_string"] in correct_tokens
|
500
500
|
|
501
|
+
if require_correct_api_key:
|
502
|
+
raise_if_none(validate_api_key_func)
|
503
|
+
require_api_key_string = True
|
504
|
+
|
505
|
+
if require_correct_token:
|
506
|
+
raise_if_none(validate_token_func)
|
507
|
+
require_token_string = True
|
508
|
+
|
501
509
|
async def func(
|
502
510
|
*,
|
503
511
|
ac: fastapi.security.HTTPAuthorizationCredentials | None = fastapi.Security(
|
@@ -73,7 +73,7 @@ arpakitlib/_arpakit_project_template/src/additional_model/__init__.py,sha256=47D
|
|
73
73
|
arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py,sha256=4KCOvto9Hj5eMYpvfaJChghhR9bkCvKluGGPWrTezoY,134
|
74
74
|
arpakitlib/_arpakit_project_template/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
75
75
|
arpakitlib/_arpakit_project_template/src/api/asgi.py,sha256=a5UBxOyNC8NG3E0ayhiDo3t5tPoB3WtOf2gbZJFWBAA,74
|
76
|
-
arpakitlib/_arpakit_project_template/src/api/auth.py,sha256=
|
76
|
+
arpakitlib/_arpakit_project_template/src/api/auth.py,sha256=bf5DtYA3q7HgyIIrzr1-X-AUfNfYe41mGV6Si977nxg,701
|
77
77
|
arpakitlib/_arpakit_project_template/src/api/const.py,sha256=7d4qD5hedqr7QxVzbfsA7E1bNZn2Pm2U8joXGtpANu0,287
|
78
78
|
arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=lDE77W6WkeAeRB_vJY3TXRTa3HeiO-t26eTtG7v8j6U,4594
|
79
79
|
arpakitlib/_arpakit_project_template/src/api/event.py,sha256=58wCVyVSIe_kydWi44M0Wvp7bTnV8xvO30gMXzjbFYc,750
|
@@ -93,7 +93,7 @@ arpakitlib/_arpakit_project_template/src/api/util.py,sha256=47DEQpj8HBSa-_TImW-5
|
|
93
93
|
arpakitlib/_arpakit_project_template/src/business_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
94
94
|
arpakitlib/_arpakit_project_template/src/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
95
95
|
arpakitlib/_arpakit_project_template/src/core/const.py,sha256=CZZew674y7LhCAlYhvuF5cV4Zb9nQ17j2Tcuj2GEBf4,1232
|
96
|
-
arpakitlib/_arpakit_project_template/src/core/settings.py,sha256=
|
96
|
+
arpakitlib/_arpakit_project_template/src/core/settings.py,sha256=S1WPgnFWiRNjCXLllZHq6xp3AiyzzqnRBubg02iRkvo,2238
|
97
97
|
arpakitlib/_arpakit_project_template/src/core/util.py,sha256=5R8gvcZdvuDQes45FBnLC2IDv2Jhajp1VhJJYNKYjMQ,1539
|
98
98
|
arpakitlib/_arpakit_project_template/src/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
99
99
|
arpakitlib/_arpakit_project_template/src/db/sqlalchemy_model.py,sha256=nXtayUkBaVb6tWx5qJgXZLbLOTVAjnSLpSDxBm7yZLc,234
|
@@ -148,7 +148,7 @@ arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css,sha256=jzPZlgJTFwSdSphk9C
|
|
148
148
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map,sha256=5wq8eXMLU6Zxb45orZPL1zAsBFJReFw6GjYqGpUX3hg,262650
|
149
149
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js,sha256=ffrLZHHEQ_g84A-ul3yWa10Kk09waOAxHcQXPuZuavg,339292
|
150
150
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map,sha256=9UhIW7MqCOZPAz1Sl1IKfZUuhWU0p-LJqrnjjJD9Xhc,1159454
|
151
|
-
arpakitlib/ar_fastapi_util.py,sha256=
|
151
|
+
arpakitlib/ar_fastapi_util.py,sha256=7VwkGwH2YXTx5i5HgX6sFg16wH3YyFSu8yNyP_4Sxtc,27078
|
152
152
|
arpakitlib/ar_file_storage_in_dir_util.py,sha256=D3e3rGuHoI6xqAA5mVvEpVVpOWY1jyjNsjj2UhyHRbE,3674
|
153
153
|
arpakitlib/ar_file_util.py,sha256=GUdJYm1tUZnYpY-SIPRHAZBHGra8NKy1eYEI0D5AfhY,489
|
154
154
|
arpakitlib/ar_func_util.py,sha256=aqcweSuaY73FbCly844sSnlud63g4TRkKhSwUUN-QM0,1239
|
@@ -178,9 +178,9 @@ arpakitlib/ar_str_util.py,sha256=tFoGSDYoGpfdVHWor5Li9pEOFmDFlHkX-Z8iOy1LK7Y,353
|
|
178
178
|
arpakitlib/ar_type_util.py,sha256=s0NsTM7mV3HuwyRwyYLdNn7Ep2HbyI4FIr-dd8x0lfI,3734
|
179
179
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
|
180
180
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
181
|
-
arpakitlib-1.7.
|
182
|
-
arpakitlib-1.7.
|
183
|
-
arpakitlib-1.7.
|
184
|
-
arpakitlib-1.7.
|
185
|
-
arpakitlib-1.7.
|
186
|
-
arpakitlib-1.7.
|
181
|
+
arpakitlib-1.7.78.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
182
|
+
arpakitlib-1.7.78.dist-info/METADATA,sha256=dMQB2b6Psj0ky04X33tUTYPkNADnuFbNEMWVBgLKfvk,2824
|
183
|
+
arpakitlib-1.7.78.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
|
184
|
+
arpakitlib-1.7.78.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
185
|
+
arpakitlib-1.7.78.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
186
|
+
arpakitlib-1.7.78.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|