mcp-proxy-adapter 6.9.17__py3-none-any.whl → 6.9.19__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.
- mcp_proxy_adapter/api/app.py +52 -52
- mcp_proxy_adapter/api/handlers.py +5 -5
- mcp_proxy_adapter/api/middleware/__init__.py +8 -8
- mcp_proxy_adapter/api/middleware/base.py +14 -14
- mcp_proxy_adapter/api/middleware/command_permission_middleware.py +7 -7
- mcp_proxy_adapter/api/middleware/error_handling.py +9 -9
- mcp_proxy_adapter/api/middleware/factory.py +17 -17
- mcp_proxy_adapter/api/middleware/logging.py +6 -6
- mcp_proxy_adapter/api/middleware/performance.py +3 -3
- mcp_proxy_adapter/api/middleware/protocol_middleware.py +19 -19
- mcp_proxy_adapter/api/middleware/transport_middleware.py +3 -3
- mcp_proxy_adapter/api/middleware/unified_security.py +11 -11
- mcp_proxy_adapter/api/middleware/user_info_middleware.py +21 -21
- mcp_proxy_adapter/api/tool_integration.py +3 -2
- mcp_proxy_adapter/api/tools.py +4 -3
- mcp_proxy_adapter/commands/auth_validation_command.py +6 -5
- mcp_proxy_adapter/commands/base.py +10 -10
- mcp_proxy_adapter/commands/builtin_commands.py +6 -6
- mcp_proxy_adapter/commands/catalog_manager.py +74 -74
- mcp_proxy_adapter/commands/cert_monitor_command.py +13 -12
- mcp_proxy_adapter/commands/certificate_management_command.py +20 -19
- mcp_proxy_adapter/commands/command_registry.py +68 -67
- mcp_proxy_adapter/commands/config_command.py +3 -1
- mcp_proxy_adapter/commands/dependency_manager.py +10 -10
- mcp_proxy_adapter/commands/help_command.py +21 -20
- mcp_proxy_adapter/commands/hooks.py +27 -27
- mcp_proxy_adapter/commands/key_management_command.py +19 -18
- mcp_proxy_adapter/commands/plugins_command.py +2 -1
- mcp_proxy_adapter/commands/protocol_management_command.py +6 -6
- mcp_proxy_adapter/commands/proxy_registration_command.py +9 -9
- mcp_proxy_adapter/commands/registration_status_command.py +4 -4
- mcp_proxy_adapter/commands/reload_command.py +5 -5
- mcp_proxy_adapter/commands/role_test_command.py +2 -1
- mcp_proxy_adapter/commands/roles_management_command.py +9 -8
- mcp_proxy_adapter/commands/security_command.py +3 -2
- mcp_proxy_adapter/commands/ssl_setup_command.py +7 -6
- mcp_proxy_adapter/commands/token_management_command.py +12 -11
- mcp_proxy_adapter/commands/transport_management_command.py +2 -2
- mcp_proxy_adapter/config.py +3 -3
- mcp_proxy_adapter/core/__init__.py +1 -1
- mcp_proxy_adapter/core/app_runner.py +3 -3
- mcp_proxy_adapter/core/auth_validator.py +9 -9
- mcp_proxy_adapter/core/certificate_utils.py +27 -27
- mcp_proxy_adapter/core/client_manager.py +13 -13
- mcp_proxy_adapter/core/client_security.py +26 -26
- mcp_proxy_adapter/core/config_converter.py +18 -18
- mcp_proxy_adapter/core/config_validator.py +5 -1
- mcp_proxy_adapter/core/crl_utils.py +22 -22
- mcp_proxy_adapter/core/logging.py +21 -13
- mcp_proxy_adapter/core/mtls_asgi.py +7 -7
- mcp_proxy_adapter/core/mtls_asgi_app.py +9 -9
- mcp_proxy_adapter/core/mtls_proxy.py +9 -9
- mcp_proxy_adapter/core/mtls_server.py +18 -18
- mcp_proxy_adapter/core/protocol_manager.py +29 -29
- mcp_proxy_adapter/core/proxy_registration.py +67 -67
- mcp_proxy_adapter/core/security_adapter.py +18 -18
- mcp_proxy_adapter/core/security_factory.py +16 -16
- mcp_proxy_adapter/core/security_integration.py +6 -6
- mcp_proxy_adapter/core/server_adapter.py +12 -12
- mcp_proxy_adapter/core/server_engine.py +17 -17
- mcp_proxy_adapter/core/signal_handler.py +12 -12
- mcp_proxy_adapter/core/ssl_utils.py +12 -12
- mcp_proxy_adapter/core/transport_manager.py +14 -14
- mcp_proxy_adapter/core/unified_config_adapter.py +6 -6
- mcp_proxy_adapter/core/utils.py +5 -5
- mcp_proxy_adapter/custom_openapi.py +7 -7
- mcp_proxy_adapter/examples/cert_manager_bugfix.py +2 -2
- mcp_proxy_adapter/examples/full_application/commands/__init__.py +6 -5
- mcp_proxy_adapter/examples/full_application/commands/echo_command.py +44 -0
- mcp_proxy_adapter/examples/full_application/commands/help_command.py +66 -0
- mcp_proxy_adapter/examples/full_application/commands/list_command.py +64 -0
- mcp_proxy_adapter/examples/full_application/hooks/application_hooks.py +21 -21
- mcp_proxy_adapter/examples/full_application/hooks/builtin_command_hooks.py +6 -6
- mcp_proxy_adapter/examples/full_application/main.py +28 -0
- mcp_proxy_adapter/examples/proxy_registration_example.py +38 -38
- mcp_proxy_adapter/examples/test_framework_complete.py +35 -35
- mcp_proxy_adapter/examples/test_mcp_server.py +2 -2
- mcp_proxy_adapter/examples/validate_generator_compatibility.py +386 -0
- mcp_proxy_adapter/examples/validate_generator_compatibility_simple.py +248 -0
- mcp_proxy_adapter/main.py +3 -0
- mcp_proxy_adapter/version.py +1 -1
- {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.19.dist-info}/METADATA +1 -1
- mcp_proxy_adapter-6.9.19.dist-info/RECORD +149 -0
- mcp_proxy_adapter-6.9.17.dist-info/RECORD +0 -144
- {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.19.dist-info}/WHEEL +0 -0
- {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.19.dist-info}/entry_points.txt +0 -0
- {mcp_proxy_adapter-6.9.17.dist-info → mcp_proxy_adapter-6.9.19.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@ from typing import Any, Dict, Optional
|
|
9
9
|
|
10
10
|
from mcp_proxy_adapter.commands.base import Command
|
11
11
|
from mcp_proxy_adapter.commands.command_registry import registry
|
12
|
-
from mcp_proxy_adapter.core.logging import
|
12
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
13
13
|
|
14
14
|
|
15
15
|
class ReloadResult:
|
@@ -156,12 +156,12 @@ class ReloadCommand(Command):
|
|
156
156
|
ReloadResult with reload information
|
157
157
|
"""
|
158
158
|
try:
|
159
|
-
|
159
|
+
get_global_logger().info("🔄 Starting configuration and commands reload...")
|
160
160
|
|
161
161
|
# Get config path from parameters
|
162
162
|
config_path = params.get("config_path")
|
163
163
|
if not config_path:
|
164
|
-
|
164
|
+
get_global_logger().warning("No config_path provided, using default configuration")
|
165
165
|
|
166
166
|
# Perform reload using unified initialization
|
167
167
|
reload_info = await registry.reload_system(config_path=config_path)
|
@@ -178,11 +178,11 @@ class ReloadCommand(Command):
|
|
178
178
|
success=True,
|
179
179
|
)
|
180
180
|
|
181
|
-
|
181
|
+
get_global_logger().info(f"✅ Reload completed successfully: {result.to_dict()}")
|
182
182
|
return result
|
183
183
|
|
184
184
|
except Exception as e:
|
185
|
-
|
185
|
+
get_global_logger().error(f"❌ Reload failed: {str(e)}")
|
186
186
|
return ReloadResult(
|
187
187
|
config_reloaded=False,
|
188
188
|
builtin_commands=0,
|
@@ -13,6 +13,7 @@ from mcp_proxy_adapter.commands.base import Command
|
|
13
13
|
from mcp_proxy_adapter.commands.result import SuccessResult
|
14
14
|
|
15
15
|
|
16
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
16
17
|
logger = logging.getLogger(__name__)
|
17
18
|
|
18
19
|
|
@@ -104,7 +105,7 @@ class RoleTestCommand(Command):
|
|
104
105
|
# Check if action is allowed
|
105
106
|
allowed = self._check_permission(action, permissions)
|
106
107
|
|
107
|
-
|
108
|
+
get_global_logger().info(f"Role test: user={user_role}, action={action}, allowed={allowed}")
|
108
109
|
|
109
110
|
return RoleTestCommandResult(user_role, permissions, action, allowed)
|
110
111
|
|
@@ -18,6 +18,7 @@ from .result import CommandResult, SuccessResult, ErrorResult
|
|
18
18
|
from ..core.role_utils import RoleUtils
|
19
19
|
from ..core.errors import ValidationError, NotFoundError, InternalError
|
20
20
|
|
21
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
21
22
|
logger = logging.getLogger(__name__)
|
22
23
|
|
23
24
|
|
@@ -319,7 +320,7 @@ class RolesManagementCommand(Command):
|
|
319
320
|
try:
|
320
321
|
config_path = Path(self.roles_config_path)
|
321
322
|
if not config_path.exists():
|
322
|
-
|
323
|
+
get_global_logger().warning(f"Roles config file not found: {self.roles_config_path}")
|
323
324
|
return {"roles": {}, "server_roles": {}, "role_hierarchy": {}}
|
324
325
|
|
325
326
|
with open(config_path, "r", encoding="utf-8") as f:
|
@@ -328,7 +329,7 @@ class RolesManagementCommand(Command):
|
|
328
329
|
return config
|
329
330
|
|
330
331
|
except Exception as e:
|
331
|
-
|
332
|
+
get_global_logger().error(f"Failed to load roles configuration: {e}")
|
332
333
|
return {"roles": {}, "server_roles": {}, "role_hierarchy": {}}
|
333
334
|
|
334
335
|
def _save_roles_config(self) -> None:
|
@@ -342,10 +343,10 @@ class RolesManagementCommand(Command):
|
|
342
343
|
with open(config_path, "w", encoding="utf-8") as f:
|
343
344
|
json.dump(self.roles_config, f, indent=2, ensure_ascii=False)
|
344
345
|
|
345
|
-
|
346
|
+
get_global_logger().info(f"Roles configuration saved to {self.roles_config_path}")
|
346
347
|
|
347
348
|
except Exception as e:
|
348
|
-
|
349
|
+
get_global_logger().error(f"Failed to save roles configuration: {e}")
|
349
350
|
raise InternalError(f"Failed to save roles configuration: {e}")
|
350
351
|
|
351
352
|
async def execute(self, **kwargs) -> CommandResult:
|
@@ -378,7 +379,7 @@ class RolesManagementCommand(Command):
|
|
378
379
|
)
|
379
380
|
|
380
381
|
except Exception as e:
|
381
|
-
|
382
|
+
get_global_logger().error(f"Roles management command failed: {e}")
|
382
383
|
return ErrorResult(str(e))
|
383
384
|
|
384
385
|
async def roles_list(self, **kwargs) -> RolesListResult:
|
@@ -473,7 +474,7 @@ class RolesManagementCommand(Command):
|
|
473
474
|
# Save configuration
|
474
475
|
self._save_roles_config()
|
475
476
|
|
476
|
-
|
477
|
+
get_global_logger().info(f"Role {role_name} created successfully")
|
477
478
|
return RolesCreateResult(role_name, role_config)
|
478
479
|
|
479
480
|
async def roles_update(self, **kwargs) -> RolesUpdateResult:
|
@@ -522,7 +523,7 @@ class RolesManagementCommand(Command):
|
|
522
523
|
# Save configuration
|
523
524
|
self._save_roles_config()
|
524
525
|
|
525
|
-
|
526
|
+
get_global_logger().info(f"Role {role_name} updated successfully")
|
526
527
|
return RolesUpdateResult(role_name, updated_config)
|
527
528
|
|
528
529
|
async def roles_delete(self, **kwargs) -> RolesDeleteResult:
|
@@ -563,7 +564,7 @@ class RolesManagementCommand(Command):
|
|
563
564
|
# Save configuration
|
564
565
|
self._save_roles_config()
|
565
566
|
|
566
|
-
|
567
|
+
get_global_logger().info(f"Role {role_name} deleted successfully")
|
567
568
|
return RolesDeleteResult(role_name)
|
568
569
|
|
569
570
|
async def roles_validate(self, **kwargs) -> RolesValidateResult:
|
@@ -16,6 +16,7 @@ from .base import Command
|
|
16
16
|
from .result import CommandResult, SuccessResult, ErrorResult
|
17
17
|
from mcp_proxy_adapter.core.security_integration import create_security_integration
|
18
18
|
|
19
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
19
20
|
logger = logging.getLogger(__name__)
|
20
21
|
|
21
22
|
|
@@ -101,7 +102,7 @@ class SecurityCommand(Command):
|
|
101
102
|
self.security_integration = create_security_integration(config)
|
102
103
|
|
103
104
|
if not self.security_integration:
|
104
|
-
|
105
|
+
get_global_logger().warning(
|
105
106
|
"Security framework not available, security command will fail"
|
106
107
|
)
|
107
108
|
|
@@ -151,7 +152,7 @@ class SecurityCommand(Command):
|
|
151
152
|
)
|
152
153
|
|
153
154
|
except Exception as e:
|
154
|
-
|
155
|
+
get_global_logger().error(f"Security command error: {e}")
|
155
156
|
return SecurityResult(
|
156
157
|
operation=action,
|
157
158
|
success=False,
|
@@ -11,6 +11,7 @@ import logging
|
|
11
11
|
import ssl
|
12
12
|
from typing import Dict, Any, Optional
|
13
13
|
|
14
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
14
15
|
# Import mcp_security_framework
|
15
16
|
try:
|
16
17
|
from mcp_security_framework.core.ssl_manager import SSLManager
|
@@ -84,7 +85,7 @@ class SSLSetupCommand(Command):
|
|
84
85
|
)
|
85
86
|
|
86
87
|
except Exception as e:
|
87
|
-
|
88
|
+
get_global_logger().error(f"SSL setup command failed: {e}")
|
88
89
|
return ErrorResult(message=f"SSL setup command failed: {str(e)}")
|
89
90
|
|
90
91
|
async def _get_ssl_config(self) -> SuccessResult | ErrorResult:
|
@@ -99,7 +100,7 @@ class SSLSetupCommand(Command):
|
|
99
100
|
return SuccessResult(data={"ssl_config": ssl_config})
|
100
101
|
|
101
102
|
except Exception as e:
|
102
|
-
|
103
|
+
get_global_logger().error(f"Failed to get SSL config: {e}")
|
103
104
|
return ErrorResult(message=f"Failed to get SSL config: {str(e)}")
|
104
105
|
|
105
106
|
async def _set_ssl_config(
|
@@ -127,7 +128,7 @@ class SSLSetupCommand(Command):
|
|
127
128
|
)
|
128
129
|
|
129
130
|
except Exception as e:
|
130
|
-
|
131
|
+
get_global_logger().error(f"Failed to set SSL config: {e}")
|
131
132
|
return ErrorResult(message=f"Failed to set SSL config: {str(e)}")
|
132
133
|
|
133
134
|
async def _update_ssl_config(
|
@@ -163,7 +164,7 @@ class SSLSetupCommand(Command):
|
|
163
164
|
)
|
164
165
|
|
165
166
|
except Exception as e:
|
166
|
-
|
167
|
+
get_global_logger().error(f"Failed to update SSL config: {e}")
|
167
168
|
return ErrorResult(message=f"Failed to update SSL config: {str(e)}")
|
168
169
|
|
169
170
|
async def _reset_ssl_config(self) -> SuccessResult | ErrorResult:
|
@@ -190,7 +191,7 @@ class SSLSetupCommand(Command):
|
|
190
191
|
)
|
191
192
|
|
192
193
|
except Exception as e:
|
193
|
-
|
194
|
+
get_global_logger().error(f"Failed to reset SSL config: {e}")
|
194
195
|
return ErrorResult(message=f"Failed to reset SSL config: {str(e)}")
|
195
196
|
|
196
197
|
async def _test_ssl_config(
|
@@ -218,7 +219,7 @@ class SSLSetupCommand(Command):
|
|
218
219
|
return await self._test_ssl_config_fallback(cert_file, key_file)
|
219
220
|
|
220
221
|
except Exception as e:
|
221
|
-
|
222
|
+
get_global_logger().error(f"Failed to test SSL config: {e}")
|
222
223
|
return ErrorResult(message=f"Failed to test SSL config: {str(e)}")
|
223
224
|
|
224
225
|
async def _test_ssl_config_with_framework(
|
@@ -25,6 +25,7 @@ from .result import SuccessResult, ErrorResult, CommandResult
|
|
25
25
|
from ..core.auth_validator import AuthValidator
|
26
26
|
|
27
27
|
|
28
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
28
29
|
class TokenManagementCommand(Command):
|
29
30
|
"""
|
30
31
|
Token management commands.
|
@@ -87,7 +88,7 @@ class TokenManagementCommand(Command):
|
|
87
88
|
return ErrorResult(message=f"Unknown method: {method}", code=-32601)
|
88
89
|
|
89
90
|
except Exception as e:
|
90
|
-
self.
|
91
|
+
self.get_global_logger().error(f"Token management command execution error: {e}")
|
91
92
|
return ErrorResult(
|
92
93
|
message=f"Token management command failed: {str(e)}", code=-32603
|
93
94
|
)
|
@@ -121,7 +122,7 @@ class TokenManagementCommand(Command):
|
|
121
122
|
return await self._create_api_token(token_data)
|
122
123
|
|
123
124
|
except Exception as e:
|
124
|
-
self.
|
125
|
+
self.get_global_logger().error(f"Token creation error: {e}")
|
125
126
|
return ErrorResult(message=f"Token creation failed: {str(e)}", code=-32603)
|
126
127
|
|
127
128
|
async def token_validate(
|
@@ -164,7 +165,7 @@ class TokenManagementCommand(Command):
|
|
164
165
|
)
|
165
166
|
|
166
167
|
except Exception as e:
|
167
|
-
self.
|
168
|
+
self.get_global_logger().error(f"Token validation error: {e}")
|
168
169
|
return ErrorResult(
|
169
170
|
message=f"Token validation failed: {str(e)}", code=-32603
|
170
171
|
)
|
@@ -207,7 +208,7 @@ class TokenManagementCommand(Command):
|
|
207
208
|
)
|
208
209
|
|
209
210
|
except Exception as e:
|
210
|
-
self.
|
211
|
+
self.get_global_logger().error(f"Token revocation error: {e}")
|
211
212
|
return ErrorResult(
|
212
213
|
message=f"Token revocation failed: {str(e)}", code=-32603
|
213
214
|
)
|
@@ -260,7 +261,7 @@ class TokenManagementCommand(Command):
|
|
260
261
|
)
|
261
262
|
|
262
263
|
except Exception as e:
|
263
|
-
self.
|
264
|
+
self.get_global_logger().error(f"Token listing error: {e}")
|
264
265
|
return ErrorResult(message=f"Token listing failed: {str(e)}", code=-32603)
|
265
266
|
|
266
267
|
async def token_refresh(self, token: str) -> Union[SuccessResult, ErrorResult]:
|
@@ -326,7 +327,7 @@ class TokenManagementCommand(Command):
|
|
326
327
|
)
|
327
328
|
|
328
329
|
except Exception as e:
|
329
|
-
self.
|
330
|
+
self.get_global_logger().error(f"Token refresh error: {e}")
|
330
331
|
return ErrorResult(message=f"Token refresh failed: {str(e)}", code=-32603)
|
331
332
|
|
332
333
|
async def _create_jwt_token(
|
@@ -371,7 +372,7 @@ class TokenManagementCommand(Command):
|
|
371
372
|
)
|
372
373
|
|
373
374
|
except Exception as e:
|
374
|
-
self.
|
375
|
+
self.get_global_logger().error(f"JWT token creation error: {e}")
|
375
376
|
return ErrorResult(
|
376
377
|
message=f"JWT token creation failed: {str(e)}", code=-32603
|
377
378
|
)
|
@@ -420,7 +421,7 @@ class TokenManagementCommand(Command):
|
|
420
421
|
)
|
421
422
|
|
422
423
|
except Exception as e:
|
423
|
-
self.
|
424
|
+
self.get_global_logger().error(f"API token creation error: {e}")
|
424
425
|
return ErrorResult(
|
425
426
|
message=f"API token creation failed: {str(e)}", code=-32603
|
426
427
|
)
|
@@ -460,7 +461,7 @@ class TokenManagementCommand(Command):
|
|
460
461
|
return None
|
461
462
|
|
462
463
|
except Exception as e:
|
463
|
-
self.
|
464
|
+
self.get_global_logger().error(f"Failed to get token expiry: {e}")
|
464
465
|
return None
|
465
466
|
|
466
467
|
def _load_tokens(self) -> Dict[str, Any]:
|
@@ -478,7 +479,7 @@ class TokenManagementCommand(Command):
|
|
478
479
|
return json.load(f)
|
479
480
|
|
480
481
|
except Exception as e:
|
481
|
-
self.
|
482
|
+
self.get_global_logger().error(f"Failed to load tokens: {e}")
|
482
483
|
return {}
|
483
484
|
|
484
485
|
def _save_tokens(self, tokens: Dict[str, Any]) -> None:
|
@@ -496,5 +497,5 @@ class TokenManagementCommand(Command):
|
|
496
497
|
json.dump(tokens, f, indent=2, ensure_ascii=False)
|
497
498
|
|
498
499
|
except Exception as e:
|
499
|
-
self.
|
500
|
+
self.get_global_logger().error(f"Failed to save tokens: {e}")
|
500
501
|
raise
|
@@ -8,7 +8,7 @@ from typing import Dict, Any, ClassVar
|
|
8
8
|
from mcp_proxy_adapter.commands.base import Command
|
9
9
|
from mcp_proxy_adapter.commands.result import SuccessResult, ErrorResult
|
10
10
|
from mcp_proxy_adapter.core.transport_manager import transport_manager
|
11
|
-
from mcp_proxy_adapter.core.logging import
|
11
|
+
from mcp_proxy_adapter.core.logging import get_global_logger
|
12
12
|
|
13
13
|
|
14
14
|
class TransportManagementResult(SuccessResult):
|
@@ -85,7 +85,7 @@ class TransportManagementCommand(Command):
|
|
85
85
|
)
|
86
86
|
|
87
87
|
except Exception as e:
|
88
|
-
|
88
|
+
get_global_logger().error(f"Transport management command error: {e}")
|
89
89
|
return TransportManagementResult(
|
90
90
|
transport_info={"error": str(e)},
|
91
91
|
message=f"Transport management failed: {e}",
|
mcp_proxy_adapter/config.py
CHANGED
@@ -507,11 +507,11 @@ class Config:
|
|
507
507
|
# Log validation results
|
508
508
|
for result in self.validation_results:
|
509
509
|
if result.level == ValidationLevel.ERROR:
|
510
|
-
|
510
|
+
get_global_logger().error(f"Configuration error: {result.message}")
|
511
511
|
elif result.level == ValidationLevel.WARNING:
|
512
|
-
|
512
|
+
get_global_logger().warning(f"Configuration warning: {result.message}")
|
513
513
|
else:
|
514
|
-
|
514
|
+
get_global_logger().info(f"Configuration info: {result.message}")
|
515
515
|
|
516
516
|
# Raise ConfigError if there are critical errors
|
517
517
|
errors = [r for r in self.validation_results if r.level == ValidationLevel.ERROR]
|
@@ -228,15 +228,15 @@ class ApplicationRunner:
|
|
228
228
|
# Add startup event
|
229
229
|
@self.app.on_event("startup")
|
230
230
|
async def startup_event():
|
231
|
-
|
232
|
-
|
231
|
+
get_global_logger().info("Application starting up")
|
232
|
+
get_global_logger().info(
|
233
233
|
f"Configuration validation passed with {len(self.errors)} errors"
|
234
234
|
)
|
235
235
|
|
236
236
|
# Add shutdown event
|
237
237
|
@self.app.on_event("shutdown")
|
238
238
|
async def shutdown_event():
|
239
|
-
|
239
|
+
get_global_logger().info("Application shutting down")
|
240
240
|
|
241
241
|
def run(self) -> None:
|
242
242
|
"""
|
@@ -182,7 +182,7 @@ class AuthValidator:
|
|
182
182
|
return self.validate_ssl(auth_data.get("server_cert"))
|
183
183
|
|
184
184
|
except Exception as e:
|
185
|
-
self.
|
185
|
+
self.get_global_logger().error(f"Authentication validation error: {e}")
|
186
186
|
return AuthValidationResult(
|
187
187
|
is_valid=False,
|
188
188
|
error_code=-32603,
|
@@ -256,7 +256,7 @@ class AuthValidator:
|
|
256
256
|
return AuthValidationResult(is_valid=True, roles=roles)
|
257
257
|
|
258
258
|
except Exception as e:
|
259
|
-
self.
|
259
|
+
self.get_global_logger().error(f"Certificate validation error: {e}")
|
260
260
|
return AuthValidationResult(
|
261
261
|
is_valid=False,
|
262
262
|
error_code=-32003,
|
@@ -296,7 +296,7 @@ class AuthValidator:
|
|
296
296
|
)
|
297
297
|
|
298
298
|
except Exception as e:
|
299
|
-
self.
|
299
|
+
self.get_global_logger().error(f"Token validation error: {e}")
|
300
300
|
return AuthValidationResult(
|
301
301
|
is_valid=False,
|
302
302
|
error_code=-32004,
|
@@ -345,7 +345,7 @@ class AuthValidator:
|
|
345
345
|
return AuthValidationResult(is_valid=True, roles=client_result.roles)
|
346
346
|
|
347
347
|
except Exception as e:
|
348
|
-
self.
|
348
|
+
self.get_global_logger().error(f"mTLS validation error: {e}")
|
349
349
|
return AuthValidationResult(
|
350
350
|
is_valid=False,
|
351
351
|
error_code=-32005,
|
@@ -374,7 +374,7 @@ class AuthValidator:
|
|
374
374
|
return self.validate_certificate(server_cert, "server")
|
375
375
|
|
376
376
|
except Exception as e:
|
377
|
-
self.
|
377
|
+
self.get_global_logger().error(f"SSL validation error: {e}")
|
378
378
|
return AuthValidationResult(
|
379
379
|
is_valid=False,
|
380
380
|
error_code=-32006,
|
@@ -444,7 +444,7 @@ class AuthValidator:
|
|
444
444
|
return []
|
445
445
|
|
446
446
|
except Exception as e:
|
447
|
-
self.
|
447
|
+
self.get_global_logger().error(f"Failed to extract roles from certificate: {e}")
|
448
448
|
return []
|
449
449
|
|
450
450
|
def _validate_server_certificate(self, cert: x509.Certificate) -> bool:
|
@@ -467,7 +467,7 @@ class AuthValidator:
|
|
467
467
|
return True
|
468
468
|
|
469
469
|
except Exception as e:
|
470
|
-
self.
|
470
|
+
self.get_global_logger().error(f"Server certificate validation error: {e}")
|
471
471
|
return False
|
472
472
|
|
473
473
|
def _validate_client_certificate(self, cert: x509.Certificate) -> bool:
|
@@ -492,7 +492,7 @@ class AuthValidator:
|
|
492
492
|
return True
|
493
493
|
|
494
494
|
except Exception as e:
|
495
|
-
self.
|
495
|
+
self.get_global_logger().error(f"Client certificate validation error: {e}")
|
496
496
|
return False
|
497
497
|
|
498
498
|
def _validate_jwt_token(self, token: str) -> AuthValidationResult:
|
@@ -596,5 +596,5 @@ class AuthValidator:
|
|
596
596
|
return True
|
597
597
|
|
598
598
|
except Exception as e:
|
599
|
-
self.
|
599
|
+
self.get_global_logger().error(f"Certificate chain verification error: {e}")
|
600
600
|
return False
|