Encryptors 2.66__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.66 → encryptors-2.67}/PKG-INFO +1 -1
- {encryptors-2.66 → encryptors-2.67}/setup.py +1 -1
- {encryptors-2.66 → encryptors-2.67}/src/Encryptors.egg-info/PKG-INFO +1 -1
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Decorators/SecureResolver.py +20 -7
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/AuditHelper.py +2 -2
- encryptors-2.67/src/Osdental/Models/Graphql.py +12 -0
- encryptors-2.66/src/Osdental/Models/Graphql.py +0 -14
- {encryptors-2.66 → encryptors-2.67}/README.md +0 -0
- {encryptors-2.66 → encryptors-2.67}/setup.cfg +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Encryptors.egg-info/SOURCES.txt +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Encryptors.egg-info/dependency_links.txt +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Encryptors.egg-info/entry_points.txt +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Encryptors.egg-info/requires.txt +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Encryptors.egg-info/top_level.txt +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Cache/Redis.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Cache/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Cli/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Constants/Constant.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Constants/Message.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Constants/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Context/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Database/BaseRepository.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Database/Connection.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Database/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Decorators/Grpc.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Decorators/Retry.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Decorators/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Encryptor/Aes.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Encryptor/Argon2.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Encryptor/Bcrypt.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Encryptor/Jwt.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Encryptor/Rsa.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Encryptor/Sha512.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Encryptor/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/AuditType.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/CipherType.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/FileType.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/GrahpqlOperation.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/Profile.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/ResultType.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/StatusCode.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Enums/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Exception/ControlledException.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Exception/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/AuditQueue.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/AuthTokenProcessor.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/AzureClassifier.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/CipherHelper.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/GrpcConnection.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/JwtTokenHelper.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/Resilience.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Helpers/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Http/APIClient.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Http/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Messaging/AzureServiceBus.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Messaging/Kafka.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Messaging/RabbitMQ.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Messaging/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Models/ApiResponse.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Models/AuditContext.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Models/Notification.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Models/Response.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Models/Token.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Models/TokenClaims.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Models/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Secrets/AzureKeyVaultProvider.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Secrets/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Services/JwtAuthTokenService.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Services/ServiceBusAuditEmitter.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Services/WebsocketClient.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Services/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Storage/AzureBlobStorage.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Storage/S3Storage.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Storage/__init__.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/CaseConverter.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/CodeGenerator.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/DataNormalizer.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/DataUtils.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/DateUtils.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/FileMetaData.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/HashValidator.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/Mapper.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/PasswordGenerator.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/QueryGenerator.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/RsaUtils.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/TextProcessor.py +0 -0
- {encryptors-2.66 → encryptors-2.67}/src/Osdental/Utils/__init__.py +0 -0
- {encryptors-2.66 → 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",
|
|
@@ -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:
|
|
@@ -81,7 +81,7 @@ def _build_success_payload(ctx: Optional[AuditContext], result: Response) -> Dic
|
|
|
81
81
|
|
|
82
82
|
key = result.key if result.key else ctx.decrypted_key
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
data = decryptor_data(
|
|
85
85
|
key=key,
|
|
86
86
|
data=result.data,
|
|
87
87
|
encryption_type=result.encryption_type,
|
|
@@ -90,7 +90,7 @@ def _build_success_payload(ctx: Optional[AuditContext], result: Response) -> Dic
|
|
|
90
90
|
return base | _build_final_payload(
|
|
91
91
|
type_=ResultType.RESPONSE,
|
|
92
92
|
status_code=result.status,
|
|
93
|
-
result=
|
|
93
|
+
result=data
|
|
94
94
|
)
|
|
95
95
|
|
|
96
96
|
def _build_error_payload(ctx: Optional[AuditContext], exc: OSDException) -> Dict[str, Any]:
|
|
@@ -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,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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|