feat(web,core): enterprise-managed authorization (EMA) (#1509) (#1512)

Adds enterprise-managed authorization (EMA): browser-side IdP login + RFC 8693 token-exchange and JWT-bearer resource-token mint, per-server EMA opt-in in Server Settings, IdP config in Client Settings, and IdP clientSecret keychain storage. Includes the v2/main merge and review follow-ups (400 on malformed client config; normalizeIdpIssuer import consolidation).
This commit is contained in:
Bob Dickinson 2026-06-24 19:15:12 -07:00 • committed by GitHub
commit 5de4e911e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -199,6 +199,9 @@ export function storedFieldsToInspectorSettings(
if (stored.oauth?.clientSecret)
settings.oauthClientSecret = stored.oauth.clientSecret;
if (stored.oauth?.scopes) settings.oauthScopes = stored.oauth.scopes;
if (stored.oauth?.enterpriseManaged === true) {
settings.enterpriseManaged = true;
}
// Mirror the stdio working directory for the form. Like the OAuth fields, an
// empty string coerces to absent so the form's "(inherit)" placeholder shows.
if (stored.cwd) settings.cwd = stored.cwd;
@ -268,11 +271,15 @@ export function inspectorSettingsToStoredFields(
clientId?: string;
clientSecret?: string;
scopes?: string;
enterpriseManaged?: boolean;
} = {};
if (settings.oauthClientId) oauthFields.clientId = settings.oauthClientId;
if (settings.oauthClientSecret)
oauthFields.clientSecret = settings.oauthClientSecret;
if (settings.oauthScopes) oauthFields.scopes = settings.oauthScopes;
if (settings.enterpriseManaged === true) {
oauthFields.enterpriseManaged = true;
}
if (Object.keys(oauthFields).length > 0) {
out.oauth = oauthFields;
}
@ -467,11 +474,18 @@ export function extractSecretsFromStored(
if (stored.oauth?.clientSecret) {
secrets[SECRET_FIELD_OAUTH_CLIENT_SECRET] = stored.oauth.clientSecret;
const restOauth: { clientId?: string; scopes?: string } = {};
const restOauth: {
clientId?: string;
scopes?: string;
enterpriseManaged?: boolean;
} = {};
if (stored.oauth.clientId !== undefined)
restOauth.clientId = stored.oauth.clientId;
if (stored.oauth.scopes !== undefined)
restOauth.scopes = stored.oauth.scopes;
if (stored.oauth.enterpriseManaged === true) {
restOauth.enterpriseManaged = true;
}
if (Object.keys(restOauth).length > 0) {
stripped.oauth = restOauth;
} else {