|
95 | 95 | ) |
96 | 96 | from mcpgateway.services.a2a_service import A2AAgentError, A2AAgentNameConflictError, A2AAgentNotFoundError, A2AAgentService |
97 | 97 | from mcpgateway.services.catalog_service import catalog_service |
| 98 | +from mcpgateway.services.encryption_service import get_encryption_service |
98 | 99 | from mcpgateway.services.export_service import ExportError, ExportService |
99 | 100 | from mcpgateway.services.gateway_service import GatewayConnectionError, GatewayNameConflictError, GatewayNotFoundError, GatewayService, GatewayUrlConflictError |
100 | 101 | from mcpgateway.services.import_service import ConflictStrategy |
|
113 | 114 | from mcpgateway.utils.create_jwt_token import create_jwt_token, get_jwt_token |
114 | 115 | from mcpgateway.utils.error_formatter import ErrorFormatter |
115 | 116 | from mcpgateway.utils.metadata_capture import MetadataCapture |
116 | | -from mcpgateway.utils.oauth_encryption import get_oauth_encryption |
117 | 117 | from mcpgateway.utils.pagination import generate_pagination_links |
118 | 118 | from mcpgateway.utils.passthrough_headers import PassthroughHeadersError |
119 | 119 | from mcpgateway.utils.retry_manager import ResilientHttpClient |
@@ -6194,7 +6194,7 @@ async def admin_add_gateway(request: Request, db: Session = Depends(get_db), use |
6194 | 6194 | oauth_config = json.loads(oauth_config_json) |
6195 | 6195 | # Encrypt the client secret if present |
6196 | 6196 | if oauth_config and "client_secret" in oauth_config: |
6197 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 6197 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
6198 | 6198 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_config["client_secret"]) |
6199 | 6199 | except (json.JSONDecodeError, ValueError) as e: |
6200 | 6200 | LOGGER.error(f"Failed to parse OAuth config: {e}") |
@@ -6231,7 +6231,7 @@ async def admin_add_gateway(request: Request, db: Session = Depends(get_db), use |
6231 | 6231 | oauth_config["client_id"] = oauth_client_id |
6232 | 6232 | if oauth_client_secret: |
6233 | 6233 | # Encrypt the client secret |
6234 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 6234 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
6235 | 6235 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_client_secret) |
6236 | 6236 |
|
6237 | 6237 | # Add username and password for password grant type |
@@ -6503,7 +6503,7 @@ async def admin_edit_gateway( |
6503 | 6503 | oauth_config = json.loads(oauth_config_json) |
6504 | 6504 | # Encrypt the client secret if present and not empty |
6505 | 6505 | if oauth_config and "client_secret" in oauth_config and oauth_config["client_secret"]: |
6506 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 6506 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
6507 | 6507 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_config["client_secret"]) |
6508 | 6508 | except (json.JSONDecodeError, ValueError) as e: |
6509 | 6509 | LOGGER.error(f"Failed to parse OAuth config: {e}") |
@@ -6540,7 +6540,7 @@ async def admin_edit_gateway( |
6540 | 6540 | oauth_config["client_id"] = oauth_client_id |
6541 | 6541 | if oauth_client_secret: |
6542 | 6542 | # Encrypt the client secret |
6543 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 6543 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
6544 | 6544 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_client_secret) |
6545 | 6545 |
|
6546 | 6546 | # Add username and password for password grant type |
@@ -9571,7 +9571,7 @@ async def admin_add_a2a_agent( |
9571 | 9571 | oauth_config = json.loads(oauth_config_json) |
9572 | 9572 | # Encrypt the client secret if present |
9573 | 9573 | if oauth_config and "client_secret" in oauth_config: |
9574 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 9574 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
9575 | 9575 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_config["client_secret"]) |
9576 | 9576 | except (json.JSONDecodeError, ValueError) as e: |
9577 | 9577 | LOGGER.error(f"Failed to parse OAuth config: {e}") |
@@ -9608,7 +9608,7 @@ async def admin_add_a2a_agent( |
9608 | 9608 | oauth_config["client_id"] = oauth_client_id |
9609 | 9609 | if oauth_client_secret: |
9610 | 9610 | # Encrypt the client secret |
9611 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 9611 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
9612 | 9612 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_client_secret) |
9613 | 9613 |
|
9614 | 9614 | # Add username and password for password grant type |
@@ -9890,7 +9890,7 @@ async def admin_edit_a2a_agent( |
9890 | 9890 | oauth_config = json.loads(oauth_config_json) |
9891 | 9891 | # Encrypt the client secret if present and not empty |
9892 | 9892 | if oauth_config and "client_secret" in oauth_config and oauth_config["client_secret"]: |
9893 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 9893 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
9894 | 9894 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_config["client_secret"]) |
9895 | 9895 | except (json.JSONDecodeError, ValueError) as e: |
9896 | 9896 | LOGGER.error(f"Failed to parse OAuth config: {e}") |
@@ -9927,7 +9927,7 @@ async def admin_edit_a2a_agent( |
9927 | 9927 | oauth_config["client_id"] = oauth_client_id |
9928 | 9928 | if oauth_client_secret: |
9929 | 9929 | # Encrypt the client secret |
9930 | | - encryption = get_oauth_encryption(settings.auth_encryption_secret) |
| 9930 | + encryption = get_encryption_service(settings.auth_encryption_secret) |
9931 | 9931 | oauth_config["client_secret"] = encryption.encrypt_secret(oauth_client_secret) |
9932 | 9932 |
|
9933 | 9933 | # Add username and password for password grant type |
|
0 commit comments