Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions mcpgateway/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12394,10 +12394,13 @@ async def admin_edit_gateway(
oauth_config["redirect_uri"] = oauth_redirect_uri
if oauth_client_id:
oauth_config["client_id"] = oauth_client_id
if oauth_client_secret:
# Encrypt the client secret
if oauth_client_secret and oauth_client_secret != settings.masked_auth_value:
# Encrypt the new client secret
encryption = get_encryption_service(settings.auth_encryption_secret)
oauth_config["client_secret"] = await encryption.encrypt_secret_async(oauth_client_secret)
elif oauth_client_id:
# client_id present but secret left blank or masked β€” preserve existing secret
oauth_config["client_secret"] = settings.masked_auth_value

# Add username and password for password grant type
if oauth_username:
Expand Down Expand Up @@ -15719,10 +15722,13 @@ async def admin_edit_a2a_agent(
oauth_config["redirect_uri"] = oauth_redirect_uri
if oauth_client_id:
oauth_config["client_id"] = oauth_client_id
if oauth_client_secret:
# Encrypt the client secret
if oauth_client_secret and oauth_client_secret != settings.masked_auth_value:
# Encrypt the new client secret
encryption = get_encryption_service(settings.auth_encryption_secret)
oauth_config["client_secret"] = await encryption.encrypt_secret_async(oauth_client_secret)
elif oauth_client_id:
# client_id present but secret left blank or masked β€” preserve existing secret
oauth_config["client_secret"] = settings.masked_auth_value

# Add username and password for password grant type
if oauth_username:
Expand Down
2 changes: 1 addition & 1 deletion mcpgateway/admin_ui/a2aAgents.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export const editA2AAgent = async function (agentId) {
oauthClientIdField.value = config.client_id || "";
}
if (oauthClientSecretField) {
oauthClientSecretField.value = ""; // Don't populate secret for security
oauthClientSecretField.value = config.client_secret ? MASKED_AUTH_VALUE : "";
}
if (oauthTokenUrlField) {
oauthTokenUrlField.value = config.token_url || "";
Expand Down
2 changes: 1 addition & 1 deletion mcpgateway/admin_ui/gateways.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ export const editGateway = async function (gatewayId) {
oauthClientIdField.value = config.client_id || "";
}
if (oauthClientSecretField) {
oauthClientSecretField.value = ""; // Don't populate secret for security
oauthClientSecretField.value = config.client_secret ? MASKED_AUTH_VALUE : "";
}
if (oauthTokenUrlField) {
oauthTokenUrlField.value = config.token_url || "";
Expand Down
11 changes: 11 additions & 0 deletions mcpgateway/admin_ui/servers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AppState } from "./appState.js";
import { getCatalogUrl } from "./configExport.js";
import { MASKED_AUTH_VALUE } from "./constants.js";
import { toggleViewPublic } from "./filters.js";
import { initGatewaySelect } from "./gateways.js";
import { openModal } from "./modals.js";
Expand Down Expand Up @@ -857,6 +858,16 @@ export const editServer = async function (serverId) {
if (oauthTokenEndpointField) {
oauthTokenEndpointField.value = server.oauthConfig.token_endpoint || "";
}

// Extract client_id for DCR bypass (pre-registered client)
const oauthClientIdField = safeGetElement("edit-server-oauth-client-id");
if (oauthClientIdField) {
oauthClientIdField.value = server.oauthConfig.client_id || "";
}
const oauthClientSecretField = safeGetElement("edit-server-oauth-client-secret");
if (oauthClientSecretField) {
oauthClientSecretField.value = server.oauthConfig.client_secret ? MASKED_AUTH_VALUE : "";
}
} else {
// Clear OAuth config fields when no config exists
if (oauthAuthServerField) oauthAuthServerField.value = "";
Expand Down