Encryptors 2.50__tar.gz → 2.51__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.50 → encryptors-2.51}/PKG-INFO +1 -1
- {encryptors-2.50 → encryptors-2.51}/setup.py +1 -1
- {encryptors-2.50 → encryptors-2.51}/src/Encryptors.egg-info/PKG-INFO +1 -1
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Database/Connection.py +11 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/JwtTokenHelper.py +28 -40
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/TokenClaims.py +0 -1
- {encryptors-2.50 → encryptors-2.51}/README.md +0 -0
- {encryptors-2.50 → encryptors-2.51}/setup.cfg +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Encryptors.egg-info/SOURCES.txt +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Encryptors.egg-info/dependency_links.txt +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Encryptors.egg-info/entry_points.txt +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Encryptors.egg-info/requires.txt +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Encryptors.egg-info/top_level.txt +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Cache/Redis.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Cache/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Cli/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Database/BaseRepository.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Database/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Decorators/Grpc.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Decorators/PublicResolver.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Decorators/Retry.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Decorators/SecureResolver.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Decorators/SqlDataNormalizer.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Decorators/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Encryptor/Aes.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Encryptor/Argon2.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Encryptor/Bcrypt.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Encryptor/Jwt.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Encryptor/Rsa.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Encryptor/Sha512.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Encryptor/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Exception/ControlledException.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Exception/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/Extensions/AuditExtension.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/Extensions/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/Models/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/_Exceptions/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/_Helpers/_AuditHelper.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/_Helpers/_ExtractAuthToken.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/_Helpers/_TenantPolicy.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/_Helpers/_TokenService.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/_Helpers/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Graphql/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/AuditDispatcher.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/AzureClassifier.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/GrpcConnection.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/JwtAuthTokenService.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/KeyVaultService.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/Resilience.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/ResponseDecryptor.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/WebsocketClient.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/_AuthTokenProcessor.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/_Ports.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Helpers/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Http/APIClient.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Http/_Helpers.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Http/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Messaging/AzureServiceBus.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Messaging/Kafka.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Messaging/RabbitMQ.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Messaging/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/ApiResponse.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/AuditConfig.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/Notification.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/Response.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/Token.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/_Audit.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Models/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Rest/Context/RequestContext.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Rest/Context/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Rest/Middlewares/RequestContextMiddleware.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Rest/Middlewares/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Rest/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Enums/Constant.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Enums/FileType.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Enums/GrahpqlOperation.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Enums/Message.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Enums/Profile.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Enums/StatusCode.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Enums/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Logger.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/CaseConverter.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/CodeGenerator.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/DataNormalizer.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/DataUtils.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/DateUtils.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/FileMetaData.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/HashValidator.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/Mapper.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/PasswordGenerator.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/QueryGenerator.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/RsaUtils.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/TextProcessor.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/Utils/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Shared/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Storage/AzureBlobStorage.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Storage/S3Storage.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/src/Osdental/Storage/__init__.py +0 -0
- {encryptors-2.50 → encryptors-2.51}/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.51",
|
|
6
6
|
author="OSDental LLC",
|
|
7
7
|
author_email="support@osdental.ai",
|
|
8
8
|
description="End-to-end algorithm library",
|
|
@@ -74,6 +74,17 @@ class Connection:
|
|
|
74
74
|
self.initialized = True
|
|
75
75
|
logger.info("db.connection_ready url=%s", self._safe_url(db_url))
|
|
76
76
|
|
|
77
|
+
@staticmethod
|
|
78
|
+
def _safe_url(db_url: str) -> str:
|
|
79
|
+
"""Enmascara contraseñas del connection string para logging seguro."""
|
|
80
|
+
import re
|
|
81
|
+
return re.sub(
|
|
82
|
+
r"(password|pwd)=[^;]+",
|
|
83
|
+
r"\1=***",
|
|
84
|
+
db_url,
|
|
85
|
+
flags=re.IGNORECASE
|
|
86
|
+
)
|
|
87
|
+
|
|
77
88
|
def _ensure_connection_resiliency(self, db_url: str) -> str:
|
|
78
89
|
"""
|
|
79
90
|
Agrega parámetros resilientes por defecto para Azure SQL
|
|
@@ -3,8 +3,10 @@ from datetime import datetime, timedelta, timezone
|
|
|
3
3
|
from jwcrypto import jwk
|
|
4
4
|
from jwcrypto import jwt
|
|
5
5
|
from jwcrypto import jwe
|
|
6
|
+
from jwcrypto.jwt import JWTExpired
|
|
6
7
|
from Osdental.Models.TokenClaims import TokenValidationOptions
|
|
7
|
-
|
|
8
|
+
from Osdental.Exception.ControlledException import UnauthorizedException
|
|
9
|
+
from Osdental.Shared.Enums.StatusCode import StatusCode
|
|
8
10
|
|
|
9
11
|
class JwtTokenHelper:
|
|
10
12
|
|
|
@@ -78,37 +80,43 @@ class JwtTokenHelper:
|
|
|
78
80
|
Desencripta y verifica firma.
|
|
79
81
|
|
|
80
82
|
NO valida:
|
|
81
|
-
- expiration
|
|
82
83
|
- issuer
|
|
83
84
|
- audience
|
|
84
85
|
|
|
85
86
|
Retorna claims incluso si el token está expirado.
|
|
86
87
|
"""
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
try:
|
|
90
|
+
encrypted = jwe.JWE()
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
encrypted.deserialize(
|
|
93
|
+
token
|
|
94
|
+
)
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
encrypted.decrypt(
|
|
97
|
+
self._private_key
|
|
98
|
+
)
|
|
97
99
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
inner_token = (
|
|
101
|
+
encrypted.payload.decode()
|
|
102
|
+
)
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
verified = jwt.JWT()
|
|
103
105
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
verified.deserialize(
|
|
107
|
+
jwt=inner_token,
|
|
108
|
+
key=self._public_key,
|
|
109
|
+
)
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
return json.loads(
|
|
112
|
+
verified.claims
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
except JWTExpired:
|
|
116
|
+
raise UnauthorizedException(
|
|
117
|
+
message="Token expired",
|
|
118
|
+
status_code=StatusCode.UNAUTHORIZED
|
|
119
|
+
)
|
|
112
120
|
|
|
113
121
|
def validate_claims(
|
|
114
122
|
self,
|
|
@@ -143,26 +151,6 @@ class JwtTokenHelper:
|
|
|
143
151
|
)
|
|
144
152
|
|
|
145
153
|
|
|
146
|
-
if options.validate_expiration:
|
|
147
|
-
|
|
148
|
-
exp = claims.get("exp")
|
|
149
|
-
|
|
150
|
-
if exp is None:
|
|
151
|
-
raise ValueError(
|
|
152
|
-
"exp claim not found"
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
now = int(
|
|
156
|
-
datetime.now(
|
|
157
|
-
timezone.utc
|
|
158
|
-
).timestamp()
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
if now > exp:
|
|
162
|
-
raise ValueError(
|
|
163
|
-
"Token expired"
|
|
164
|
-
)
|
|
165
|
-
|
|
166
154
|
def validate_token(
|
|
167
155
|
self,
|
|
168
156
|
token: str,
|
|
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
|
{encryptors-2.50 → encryptors-2.51}/src/Osdental/Rest/Middlewares/RequestContextMiddleware.py
RENAMED
|
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
|