Encryptors 2.65__tar.gz → 2.67__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.
- {encryptors-2.65 → encryptors-2.67}/PKG-INFO +1 -1
- {encryptors-2.65 → encryptors-2.67}/setup.py +1 -1
- {encryptors-2.65 → encryptors-2.67}/src/Encryptors.egg-info/PKG-INFO +1 -1
- {encryptors-2.65 → encryptors-2.67}/src/Encryptors.egg-info/SOURCES.txt +2 -2
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Decorators/SecureResolver.py +20 -7
- encryptors-2.67/src/Osdental/Enums/CipherType.py +6 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Exception/ControlledException.py +5 -19
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/AuditHelper.py +12 -3
- encryptors-2.65/src/Osdental/Helpers/ResponseDecryptor.py → encryptors-2.67/src/Osdental/Helpers/CipherHelper.py +15 -11
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Models/AuditContext.py +4 -4
- encryptors-2.67/src/Osdental/Models/Graphql.py +12 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Models/Response.py +3 -2
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Models/Token.py +0 -2
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Services/JwtAuthTokenService.py +2 -2
- encryptors-2.65/src/Osdental/Enums/ErrorSource.py +0 -5
- encryptors-2.65/src/Osdental/Models/Graphql.py +0 -14
- {encryptors-2.65 → encryptors-2.67}/README.md +0 -0
- {encryptors-2.65 → encryptors-2.67}/setup.cfg +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Encryptors.egg-info/dependency_links.txt +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Encryptors.egg-info/entry_points.txt +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Encryptors.egg-info/requires.txt +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Encryptors.egg-info/top_level.txt +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Cache/Redis.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Cache/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Cli/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Constants/Constant.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Constants/Message.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Constants/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Context/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Database/BaseRepository.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Database/Connection.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Database/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Decorators/Grpc.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Decorators/Retry.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Decorators/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Encryptor/Aes.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Encryptor/Argon2.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Encryptor/Bcrypt.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Encryptor/Jwt.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Encryptor/Rsa.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Encryptor/Sha512.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Encryptor/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Enums/AuditType.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Enums/FileType.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Enums/GrahpqlOperation.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Enums/Profile.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Enums/ResultType.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Enums/StatusCode.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Enums/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Exception/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/AuditQueue.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/AuthTokenProcessor.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/AzureClassifier.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/GrpcConnection.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/JwtTokenHelper.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/Resilience.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Helpers/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Http/APIClient.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Http/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Messaging/AzureServiceBus.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Messaging/Kafka.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Messaging/RabbitMQ.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Messaging/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Models/ApiResponse.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Models/Notification.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Models/TokenClaims.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Models/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Secrets/AzureKeyVaultProvider.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Secrets/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Services/ServiceBusAuditEmitter.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Services/WebsocketClient.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Services/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Storage/AzureBlobStorage.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Storage/S3Storage.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Storage/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/CaseConverter.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/CodeGenerator.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/DataNormalizer.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/DataUtils.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/DateUtils.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/FileMetaData.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/HashValidator.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/Mapper.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/PasswordGenerator.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/QueryGenerator.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/RsaUtils.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/TextProcessor.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/Utils/__init__.py +0 -0
- {encryptors-2.65 → encryptors-2.67}/src/Osdental/__init__.py +0 -0
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
# ANDERSON REVISAR EL CACHE LOCAL DEL KEYVAULT PARA VALIDAR SI FUNCIONA
|
|
3
3
|
setup(
|
|
4
4
|
name="Encryptors",
|
|
5
|
-
version="2.
|
|
5
|
+
version="2.67",
|
|
6
6
|
author="OSDental LLC",
|
|
7
7
|
author_email="support@osdental.ai",
|
|
8
8
|
description="End-to-end algorithm library",
|
|
@@ -29,7 +29,7 @@ src/Osdental/Encryptor/Rsa.py
|
|
|
29
29
|
src/Osdental/Encryptor/Sha512.py
|
|
30
30
|
src/Osdental/Encryptor/__init__.py
|
|
31
31
|
src/Osdental/Enums/AuditType.py
|
|
32
|
-
src/Osdental/Enums/
|
|
32
|
+
src/Osdental/Enums/CipherType.py
|
|
33
33
|
src/Osdental/Enums/FileType.py
|
|
34
34
|
src/Osdental/Enums/GrahpqlOperation.py
|
|
35
35
|
src/Osdental/Enums/Profile.py
|
|
@@ -42,10 +42,10 @@ src/Osdental/Helpers/AuditHelper.py
|
|
|
42
42
|
src/Osdental/Helpers/AuditQueue.py
|
|
43
43
|
src/Osdental/Helpers/AuthTokenProcessor.py
|
|
44
44
|
src/Osdental/Helpers/AzureClassifier.py
|
|
45
|
+
src/Osdental/Helpers/CipherHelper.py
|
|
45
46
|
src/Osdental/Helpers/GrpcConnection.py
|
|
46
47
|
src/Osdental/Helpers/JwtTokenHelper.py
|
|
47
48
|
src/Osdental/Helpers/Resilience.py
|
|
48
|
-
src/Osdental/Helpers/ResponseDecryptor.py
|
|
49
49
|
src/Osdental/Helpers/__init__.py
|
|
50
50
|
src/Osdental/Http/APIClient.py
|
|
51
51
|
src/Osdental/Http/__init__.py
|
|
@@ -4,7 +4,7 @@ from typing import Callable
|
|
|
4
4
|
from graphql import GraphQLResolveInfo
|
|
5
5
|
from Osdental.Models.Response import Response
|
|
6
6
|
from Osdental.Models.Graphql import BaseGraphQLContext
|
|
7
|
-
from Osdental.Models.TokenClaims import UserTokenClaims
|
|
7
|
+
from Osdental.Models.TokenClaims import UserTokenClaims, AccessTokenClaims
|
|
8
8
|
from Osdental.Models.Token import AuthToken
|
|
9
9
|
from Osdental.Enums.Profile import Profile
|
|
10
10
|
from Osdental.Exception.ControlledException import (
|
|
@@ -39,16 +39,27 @@ def resolver(public: bool = False, action=None):
|
|
|
39
39
|
settings = container.settings
|
|
40
40
|
|
|
41
41
|
token: type[AuthToken] | None = None
|
|
42
|
+
aes_key = None
|
|
43
|
+
claims: UserTokenClaims | AccessTokenClaims
|
|
42
44
|
|
|
43
45
|
# ── 1. AUTENTICACIÓN ──────────────────────────────
|
|
46
|
+
token_service: IAuthTokenService = container.auth_token_service
|
|
44
47
|
if not public:
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
claims: UserTokenClaims = await token_service.validate_internal_access_token(
|
|
49
|
+
user_token = extract_bearer_token(headers)
|
|
50
|
+
claims = await token_service.validate_internal_access_token(
|
|
50
51
|
user_token
|
|
51
52
|
)
|
|
53
|
+
aes_key = claims.aes_key_auth
|
|
54
|
+
|
|
55
|
+
else:
|
|
56
|
+
|
|
57
|
+
access_token = request.get("Accesstoken")
|
|
58
|
+
claims = await token_service.validate_external_access_token(
|
|
59
|
+
access_token
|
|
60
|
+
)
|
|
61
|
+
aes_key = claims.aes_key
|
|
62
|
+
context.access_token = claims
|
|
52
63
|
|
|
53
64
|
# ── 2. DECRYPT DEL PAYLOAD ────────────────────────
|
|
54
65
|
body = await request.json()
|
|
@@ -56,9 +67,9 @@ def resolver(public: bool = False, action=None):
|
|
|
56
67
|
encrypted_payload = kwargs.get("data") or variables.get("data")
|
|
57
68
|
decrypted_payload = None
|
|
58
69
|
|
|
59
|
-
if
|
|
70
|
+
if encrypted_payload is not None:
|
|
60
71
|
decrypted_payload = decrypt_and_parse_payload(
|
|
61
|
-
aes_key_auth=
|
|
72
|
+
aes_key_auth=aes_key,
|
|
62
73
|
encrypted_payload=encrypted_payload
|
|
63
74
|
)
|
|
64
75
|
|
|
@@ -73,6 +84,8 @@ def resolver(public: bool = False, action=None):
|
|
|
73
84
|
decrypted_payload=decrypted_payload,
|
|
74
85
|
operation_type=info.operation.operation.value
|
|
75
86
|
)
|
|
87
|
+
|
|
88
|
+
context.token = token
|
|
76
89
|
|
|
77
90
|
# ── 4. CONTROL DE ACCESO POR ROL ─────────────────
|
|
78
91
|
if not public and action:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
from Osdental.Enums.StatusCode import StatusCode
|
|
3
3
|
from Osdental.Constants.Message import Message
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
|
|
6
6
|
class OSDException(Exception):
|
|
7
7
|
""" Base class for all custom exceptions. """
|
|
@@ -9,29 +9,19 @@ class OSDException(Exception):
|
|
|
9
9
|
self,
|
|
10
10
|
message: str = Message.UNEXPECTED_ERROR_MSG,
|
|
11
11
|
error: str = None,
|
|
12
|
-
status_code: Any = StatusCode.INTERNAL_SERVER_ERROR
|
|
13
|
-
source: ErrorSource = ErrorSource.INTERNAL,
|
|
14
|
-
raw_status_code: Any = None,
|
|
12
|
+
status_code: Any = StatusCode.INTERNAL_SERVER_ERROR
|
|
15
13
|
):
|
|
16
14
|
super().__init__(error)
|
|
17
15
|
self.message = message
|
|
18
16
|
self.error = error
|
|
19
17
|
self.status_code = status_code
|
|
20
|
-
|
|
21
|
-
self.raw_status_code = raw_status_code
|
|
18
|
+
|
|
22
19
|
|
|
23
20
|
def __str__(self):
|
|
24
21
|
error_detail = self.error if self.error else "None"
|
|
25
|
-
return f"[{self.
|
|
22
|
+
return f"[{self.status_code}] {self.message} | {error_detail}]"
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
def is_external(self) -> bool:
|
|
29
|
-
return self.source == ErrorSource.EXTERNAL
|
|
30
|
-
|
|
31
|
-
@property
|
|
32
|
-
def audit_status_code(self) -> Any:
|
|
33
|
-
"""El que va a la auditoría: real si existe, propio si no."""
|
|
34
|
-
return self.raw_status_code if self.raw_status_code is not None else self.status_code
|
|
24
|
+
|
|
35
25
|
|
|
36
26
|
class UnauthorizedException(OSDException):
|
|
37
27
|
def __init__(
|
|
@@ -134,13 +124,9 @@ class HttpClientException(OSDException):
|
|
|
134
124
|
message: str = Message.UNEXPECTED_ERROR_MSG,
|
|
135
125
|
error: str = None,
|
|
136
126
|
status_code: str = StatusCode.INTERNAL_SERVER_ERROR,
|
|
137
|
-
source: ErrorSource = ErrorSource.EXTERNAL,
|
|
138
|
-
raw_status_code: Any = None,
|
|
139
127
|
):
|
|
140
128
|
super().__init__(
|
|
141
129
|
message=message,
|
|
142
130
|
error=error,
|
|
143
131
|
status_code=status_code,
|
|
144
|
-
source=source,
|
|
145
|
-
raw_status_code=raw_status_code
|
|
146
132
|
)
|
|
@@ -9,6 +9,7 @@ from Osdental.Exception.ControlledException import OSDException
|
|
|
9
9
|
from Osdental.Enums.StatusCode import StatusCode
|
|
10
10
|
from Osdental.Enums.AuditType import AuditType
|
|
11
11
|
from Osdental.Enums.ResultType import ResultType
|
|
12
|
+
from Osdental.Helpers.CipherHelper import decryptor_data
|
|
12
13
|
|
|
13
14
|
def build_request_payload(
|
|
14
15
|
request: Request,
|
|
@@ -77,16 +78,25 @@ def _build_final_payload(
|
|
|
77
78
|
|
|
78
79
|
def _build_success_payload(ctx: Optional[AuditContext], result: Response) -> Dict[str, Any]:
|
|
79
80
|
base = _base_payload(ctx)
|
|
81
|
+
|
|
82
|
+
key = result.key if result.key else ctx.decrypted_key
|
|
83
|
+
|
|
84
|
+
data = decryptor_data(
|
|
85
|
+
key=key,
|
|
86
|
+
data=result.data,
|
|
87
|
+
encryption_type=result.encryption_type,
|
|
88
|
+
)
|
|
89
|
+
|
|
80
90
|
return base | _build_final_payload(
|
|
81
91
|
type_=ResultType.RESPONSE,
|
|
82
92
|
status_code=result.status,
|
|
83
|
-
result=
|
|
93
|
+
result=data
|
|
84
94
|
)
|
|
85
95
|
|
|
86
96
|
def _build_error_payload(ctx: Optional[AuditContext], exc: OSDException) -> Dict[str, Any]:
|
|
87
97
|
base = _base_payload(ctx)
|
|
88
98
|
return base | _build_final_payload(
|
|
89
|
-
status_code=exc.
|
|
99
|
+
status_code=exc.status_code,
|
|
90
100
|
error=exc.error or exc.message
|
|
91
101
|
)
|
|
92
102
|
|
|
@@ -157,7 +167,6 @@ def _build_success_graphql_payload(ctx: Optional[AuditContext], result: Dict[str
|
|
|
157
167
|
result=result
|
|
158
168
|
)
|
|
159
169
|
|
|
160
|
-
|
|
161
170
|
def _build_error_graphql_payload(ctx: Optional[AuditContext], errors: List[Dict[str, Any]]) -> Dict[str, Any]:
|
|
162
171
|
base = _base_payload(ctx, AuditType.EXTERNAL)
|
|
163
172
|
return base | _build_final_payload(
|
|
@@ -2,35 +2,39 @@ import logging
|
|
|
2
2
|
from typing import Dict, Any
|
|
3
3
|
from Osdental.Encryptor.Aes import AES
|
|
4
4
|
from Osdental.Encryptor.Rsa import RSAEncryptor
|
|
5
|
+
from Osdental.Enums.CipherType import CipherType
|
|
5
6
|
|
|
6
7
|
logger = logging.getLogger(__name__)
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def encryptor_data(encryption_type: str, key: str, data: Dict[str, Any] | str) -> Any:
|
|
10
|
+
def encryptor_data(key: str, data: Dict[str, Any] | str, encryption_type: CipherType = CipherType.AES) -> Any:
|
|
12
11
|
match encryption_type:
|
|
13
12
|
|
|
14
|
-
case
|
|
13
|
+
case CipherType.AES:
|
|
15
14
|
return AES.encrypt(key, data)
|
|
16
15
|
|
|
17
|
-
case
|
|
16
|
+
case CipherType.RSA:
|
|
18
17
|
return RSAEncryptor.encrypt(data, key)
|
|
19
18
|
|
|
19
|
+
case CipherType.PLAIN:
|
|
20
|
+
return data
|
|
21
|
+
|
|
20
22
|
case _:
|
|
21
23
|
logger.warning(f"Encryption type '{encryption_type}' not supported.")
|
|
22
|
-
|
|
24
|
+
|
|
23
25
|
|
|
24
|
-
def decryptor_data(
|
|
26
|
+
def decryptor_data(key: str, data: Dict[str, Any] | str, encryption_type: CipherType = CipherType.AES) -> Any:
|
|
25
27
|
|
|
26
28
|
match encryption_type:
|
|
27
29
|
|
|
28
|
-
case
|
|
30
|
+
case CipherType.AES:
|
|
29
31
|
return AES.decrypt(key, data)
|
|
30
32
|
|
|
31
|
-
case
|
|
33
|
+
case CipherType.RSA:
|
|
32
34
|
return RSAEncryptor.decrypt(data, key)
|
|
33
35
|
|
|
36
|
+
case CipherType.PLAIN:
|
|
37
|
+
return data
|
|
38
|
+
|
|
34
39
|
case _:
|
|
35
|
-
logger.warning(f"Encryption type '{encryption_type}' not supported.")
|
|
36
|
-
return data
|
|
40
|
+
logger.warning(f"Encryption type '{encryption_type}' not supported.")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from typing import Optional, Dict, Any
|
|
3
3
|
from fastapi import Request
|
|
4
|
-
|
|
4
|
+
from Osdental.Models.Token import AuthToken
|
|
5
5
|
|
|
6
6
|
@dataclass
|
|
7
7
|
class AuditContext:
|
|
@@ -30,8 +30,8 @@ class AuditContext:
|
|
|
30
30
|
settings,
|
|
31
31
|
body: Dict,
|
|
32
32
|
operation_type: str,
|
|
33
|
-
token=None,
|
|
34
|
-
decrypted_payload=None,
|
|
33
|
+
token: AuthToken = None,
|
|
34
|
+
decrypted_payload = None,
|
|
35
35
|
) -> "AuditContext":
|
|
36
36
|
|
|
37
37
|
user_ip = request.headers.get("X-Forwarded-For")
|
|
@@ -51,7 +51,7 @@ class AuditContext:
|
|
|
51
51
|
operation_name=body.get("operationName", "UnknownOperation"),
|
|
52
52
|
query=body.get("query"),
|
|
53
53
|
variables=decrypted_payload,
|
|
54
|
-
user=token.
|
|
54
|
+
user=token.id_user if token else "00000000-0000-0000-0000-000000000000",
|
|
55
55
|
message_log_id=request.headers.get("Idmessagelog"),
|
|
56
56
|
decrypted_key=token.aes_key_auth if token else None,
|
|
57
57
|
user_ip=user_ip,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional, Any
|
|
3
|
+
from fastapi import Request
|
|
4
|
+
from Osdental.Models.Token import AuthToken
|
|
5
|
+
from Osdental.Models.TokenClaims import AccessTokenClaims
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class BaseGraphQLContext:
|
|
9
|
+
request: Request
|
|
10
|
+
container: Any
|
|
11
|
+
access_token: Optional[AccessTokenClaims] = None
|
|
12
|
+
token: Optional[AuthToken] = None
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from dataclasses import dataclass, field, asdict
|
|
2
|
-
from typing import Optional, Any
|
|
2
|
+
from typing import Optional, Any
|
|
3
3
|
from Osdental.Enums.StatusCode import StatusCode
|
|
4
4
|
from Osdental.Constants.Message import Message
|
|
5
|
+
from Osdental.Enums.CipherType import CipherType
|
|
5
6
|
|
|
6
7
|
@dataclass
|
|
7
8
|
class Response:
|
|
@@ -9,7 +10,7 @@ class Response:
|
|
|
9
10
|
message: str = field(default=Message.PROCESS_SUCCESS_MSG)
|
|
10
11
|
data: Optional[Any] = None
|
|
11
12
|
error: Optional[str] = None
|
|
12
|
-
encryption_type:
|
|
13
|
+
encryption_type: CipherType = CipherType.AES
|
|
13
14
|
key: Optional[str] = None
|
|
14
15
|
|
|
15
16
|
def send(self):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
|
|
3
3
|
from Osdental.Models.TokenClaims import (
|
|
4
|
-
AccessTokenClaims, UserTokenClaims,
|
|
4
|
+
BaseClaims, AccessTokenClaims, UserTokenClaims,
|
|
5
5
|
ActionTokenClaims, TokenValidationOptions
|
|
6
6
|
)
|
|
7
7
|
|
|
@@ -52,7 +52,7 @@ class JwtAuthTokenService(IAuthTokenService):
|
|
|
52
52
|
|
|
53
53
|
async def generate_token(
|
|
54
54
|
self,
|
|
55
|
-
claims:
|
|
55
|
+
claims: BaseClaims,
|
|
56
56
|
expiration_minutes: int,
|
|
57
57
|
) -> str:
|
|
58
58
|
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from typing import Optional, Any
|
|
3
|
-
from fastapi import Request
|
|
4
|
-
from Osdental.Models.Token import AuthToken
|
|
5
|
-
|
|
6
|
-
@dataclass
|
|
7
|
-
class BaseGraphQLContext:
|
|
8
|
-
request: Request
|
|
9
|
-
container: Any
|
|
10
|
-
# valores agregados durante ejecución (AuditExtention)
|
|
11
|
-
token: Optional[AuthToken] = None
|
|
12
|
-
decrypted_payload: Optional[dict] = None
|
|
13
|
-
aes_auth: Optional[str] = None
|
|
14
|
-
audit_plain_response: Optional[Any] = None
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|