Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: polish styles of idp pages (#16529)

boojackab193c59f6a8
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue b/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
new file mode 100644
index 0000000000..47b71c4aab
--- /dev/null
+++ b/frontend/src/components/IdentityProvider/IdentityProviderCreateWizard.vue
@@ -0,0 +1,988 @@
+<template>
+ <div class="w-full max-w-4xl mx-auto space-y-6">
+ <!-- Steps Navigation -->
+ <div class="bg-white">
+ <NSteps :current="currentStep" size="medium">
+ <NStep :title="$t('settings.sso.form.type')" />
+ <NStep
+ v-if="selectedType === IdentityProviderType.OAUTH2"
+ :title="$t('settings.sso.form.use-template')"
+ />
+ <NStep :title="$t('common.general')" />
+ <NStep :title="$t('settings.sso.form.configuration')" />
+ <NStep :title="$t('settings.sso.form.user-information-mapping')" />
+ </NSteps>
+ </div>
+
+ <!-- Step Content -->
+ <div
+ class="bg-white rounded-lg border border-gray-200 px-2 sm:px-6 pt-6 pb-10"
+ >
+ <!-- Step 1: Select Provider Type -->
+ <div v-if="currentStep === 1" class="space-y-6">
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.type") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.type-description") }}
+ </p>
+ </div>
+
+ <div class="max-w-2xl mx-auto">
+ <NRadioGroup
+ v-model:value="selectedType"
+ size="large"
+ class="space-y-4 w-full"
+ >
+ <div
+ v-for="item in identityProviderTypeList"
+ :key="item.type"
+ class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
+ :class="{
+ 'border-blue-500 bg-blue-50': selectedType === item.type,
+ }"
+ >
+ <NRadio
+ :value="item.type"
+ :disabled="!subscriptionStore.hasFeature(item.feature)"
+ class="w-full"
+ >
+ <div class="flex items-start space-x-3 w-full">
+ <component
+ :is="getProviderIcon(item.type)"
+ class="w-6 h-6 mt-1 flex-shrink-0"
+ :stroke-width="1.5"
+ />
+ <div class="flex-1">
+ <div class="flex items-center space-x-2">
+ <span class="text-lg font-medium text-gray-900">
+ {{ identityProviderTypeToString(item.type) }}
+ </span>
+ <FeatureBadge :feature="item.feature" />
+ </div>
+ <p class="text-sm text-gray-600 mt-1">
+ {{ getProviderDescription(item.type) }}
+ </p>
+ </div>
+ </div>
+ </NRadio>
+ </div>
+ </NRadioGroup>
+
+ <!-- External URL Warning -->
+ <BBAttention
+ v-if="
+ !externalUrl &&
+ (selectedType === IdentityProviderType.OAUTH2 ||
+ selectedType === IdentityProviderType.OIDC)
+ "
+ class="mt-6"
+ type="error"
+ :title="$t('banner.external-url')"
+ :description="
+ $t('settings.general.workspace.external-url.description')
+ "
+ >
+ <template #action>
+ <NButton type="primary" @click="configureSetting">
+ {{ $t("common.configure-now") }}
+ </NButton>
+ </template>
+ </BBAttention>
+ </div>
+ </div>
+
+ <!-- Step 2: Select OAuth2 Template (only for OAuth2) -->
+ <div
+ v-else-if="
+ currentStep === 2 && selectedType === IdentityProviderType.OAUTH2
+ "
+ class="space-y-6"
+ >
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.use-template") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.template-description") }}
+ </p>
+ </div>
+
+ <div class="max-w-3xl mx-auto">
+ <NRadioGroup
+ :value="selectedTemplate?.title"
+ @update:value="
+ (value) => {
+ const template = templateList.find((t) => t.title === value);
+ if (template) handleTemplateSelect(template);
+ }
+ "
+ size="large"
+ class="!grid grid-cols-1 sm:grid-cols-2 gap-4"
+ >
+ <div
+ v-for="template in templateList"
+ :key="template.title"
+ class="border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors"
+ :class="{
+ 'border-blue-500 bg-blue-50':
+ selectedTemplate?.title === template.title,
+ }"
+ >
+ <NRadio
+ :value="template.title"
+ :disabled="!subscriptionStore.hasFeature(template.feature)"
+ class="w-full"
+ >
+ <div class="flex items-center space-x-3">
+ <component
+ :is="getTemplateIcon(template.title)"
+ class="w-8 h-8 flex-shrink-0"
+ :stroke-width="1"
+ />
+ <div class="flex-1">
+ <div class="flex items-center space-x-2">
+ <span class="text-base font-medium text-gray-900">
+ {{ template.title }}
+ </span>
+ <FeatureBadge :feature="template.feature" />
+ </div>
+ <p class="text-sm text-gray-600">
+ {{ getTemplateDescription(template.title) }}
+ </p>
+ </div>
+ </div>
+ </NRadio>
+ </div>
+ </NRadioGroup>
+ </div>
+ </div>
+
+ <!-- Step 3: Basic Information -->
+ <div
+ v-else-if="
+ currentStep === (selectedType === IdentityProviderType.OAUTH2 ? 3 : 2)
+ "
+ class="space-y-6"
+ >
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("common.general") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.general-setting-description") }}
+ </p>
+ </div>
+
+ <div class="max-w-2xl mx-auto space-y-6">
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.name") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ v-model:value="identityProvider.title"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.name-description')"
+ />
+ </div>
+
+ <ResourceIdField
+ ref="resourceIdField"
+ resource-type="idp"
+ v-model:value="resourceIdValue"
+ :suffix="true"
+ :resource-title="identityProvider.title"
+ :fetch-resource="
+ (id) =>
+ identityProviderStore.getOrFetchIdentityProviderByName(
+ `${idpNamePrefix}${id}`,
+ true /* silent */
+ )
+ "
+ />
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.domain") }}
+ </label>
+ <BBTextField
+ v-model:value="identityProvider.domain"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.domain-description')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.domain-optional-hint") }}
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <!-- Step 4: Provider Configuration -->
+ <div
+ v-else-if="
+ currentStep === (selectedType === IdentityProviderType.OAUTH2 ? 4 : 3)
+ "
+ class="space-y-6"
+ >
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.configuration") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.configuration-description") }}
+ </p>
+ </div>
+
+ <div class="max-w-3xl mx-auto">
+ <!-- External URL Info -->
+ <IdentityProviderExternalURL
+ v-if="
+ selectedType === IdentityProviderType.OAUTH2 ||
+ selectedType === IdentityProviderType.OIDC
+ "
+ :type="selectedType"
+ class="mb-6"
+ />
+
+ <!-- Configuration Form based on type -->
+ <IdentityProviderForm
+ :identity-provider="identityProvider"
+ :provider-type="selectedType"
+ :config-for-oauth2="configForOAuth2"
+ :config-for-oidc="configForOIDC"
+ :config-for-ldap="configForLDAP"
+ :scopes-string="scopesStringOfConfig"
+ @update:config-for-oauth2="configForOAuth2 = $event"
+ @update:config-for-oidc="configForOIDC = $event"
+ @update:config-for-ldap="configForLDAP = $event"
+ @update:scopes-string="scopesStringOfConfig = $event"
+ />
+ </div>
+ </div>
+
+ <!-- Step 5: User Information Mapping -->
+ <div
+ v-else-if="
+ currentStep === (selectedType === IdentityProviderType.OAUTH2 ? 5 : 4)
+ "
+ class="space-y-6"
+ >
+ <div class="text-center space-y-2">
+ <h2 class="text-2xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.user-information-mapping") }}
+ </h2>
+ <p class="text-gray-600">
+ {{ $t("settings.sso.form.user-information-mapping-description") }}
+ <a
+ href="https://docs.bytebase.com/administration/sso/oauth2#user-information-field-mapping?source=console"
+ class="text-blue-600 hover:text-blue-800 underline"
+ target="_blank"
+ >
+ {{ $t("common.learn-more") }}
+ </a>
+ </p>
+ </div>
+
+ <div class="max-w-2xl mx-auto space-y-6">
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.identifier"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.identifier-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p
+ class="flex flex-row justify-start items-center font-semibold text-gray-800"
+ >
+ {{ $t("settings.sso.form.identifier") }}
+ <span class="text-red-600">*</span>
+ <NTooltip>
+ <template #trigger>
+ <InfoIcon class="ml-1 w-4 h-auto text-blue-500" />
+ </template>
+ {{ $t("settings.sso.form.identifier-tips") }}
+ </NTooltip>
+ </p>
+ </div>
+ </div>
+
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.displayName"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.display-name-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.display-name") }}
+ </p>
+ </div>
+ </div>
+
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.phone"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.phone-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.phone") }}
+ </p>
+ </div>
+ </div>
+
+ <div
+ v-if="selectedType === IdentityProviderType.OIDC"
+ class="grid grid-cols-[256px_1fr] gap-4 items-center"
+ >
+ <BBTextField
+ v-model:value="fieldMapping.groups"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.groups-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.groups") }}
+ </p>
+ </div>
+ </div>
+
+ <div v-if="selectedType === IdentityProviderType.OIDC">
+ <p class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.groups-description") }}
+ </p>
+ </div>
+
+ <div>
+ <NButton
+ :disabled="!allowTestConnection"
+ @click="testConnection"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("identity-provider.test-connection") }}
+ </NButton>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Navigation Buttons -->
+ <div class="flex items-center justify-between pb-6">
+ <div></div>
+ <div class="flex items-center space-x-3">
+ <NButton
+ v-if="currentStep > 1"
+ @click="handlePrevStep"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("common.back") }}
+ </NButton>
+ <NButton
+ v-if="!isLastStep"
+ type="primary"
+ :disabled="!canProceedToNextStep"
+ @click="handleNextStep"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("common.next") }}
+ </NButton>
+ <NButton
+ v-else
+ type="primary"
+ :disabled="!canCreate"
+ :loading="isCreating"
+ @click="handleCreate"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("common.create") }}
+ </NButton>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { head } from "lodash-es";
+import {
+ KeyIcon,
+ ShieldCheckIcon,
+ DatabaseIcon,
+ GithubIcon,
+ ChromeIcon,
+ GitlabIcon,
+ BuildingIcon,
+ ArrowRightIcon,
+ InfoIcon,
+} from "lucide-vue-next";
+import {
+ NSteps,
+ NStep,
+ NRadioGroup,
+ NRadio,
+ NButton,
+ NTooltip,
+} from "naive-ui";
+import { computed, reactive, ref, watch } from "vue";
+import { useI18n } from "vue-i18n";
+import { useRouter } from "vue-router";
+import { BBAttention, BBTextField } from "@/bbkit";
+import { FeatureBadge } from "@/components/FeatureGuard";
+import ResourceIdField from "@/components/v2/Form/ResourceIdField.vue";
+import { WORKSPACE_ROUTE_SSO_DETAIL } from "@/router/dashboard/workspaceRoutes";
+import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetting";
+import { SQL_EDITOR_SETTING_GENERAL_MODULE } from "@/router/sqlEditor";
+import {
+ pushNotification,
+ useActuatorV1Store,
+ useSubscriptionV1Store,
+} from "@/store";
+import { useIdentityProviderStore } from "@/store/modules/idp";
+import { idpNamePrefix } from "@/store/modules/v1/common";
+import {
+ FieldMapping,
+ IdentityProvider,
+ IdentityProviderType,
+ OAuth2AuthStyle,
+ OAuth2IdentityProviderConfig,
+ OIDCIdentityProviderConfig,
+ LDAPIdentityProviderConfig,
+} from "@/types/proto/v1/idp_service";
+import { PlanFeature } from "@/types/proto/v1/subscription_service";
+import type { OAuth2IdentityProviderTemplate } from "@/utils";
+import {
+ extractIdentityProviderResourceName,
+ identityProviderTypeToString,
+} from "@/utils";
+import IdentityProviderExternalURL from "./IdentityProviderExternalURL.vue";
+import IdentityProviderForm from "./IdentityProviderForm.vue";
+
+interface IdentityProviderTemplate extends OAuth2IdentityProviderTemplate {
+ feature: PlanFeature;
+}
+
+const emit = defineEmits<{
+ (e: "created", provider: IdentityProvider): void;
+}>();
+
+const { t } = useI18n();
+const router = useRouter();
+const identityProviderStore = useIdentityProviderStore();
+const subscriptionStore = useSubscriptionV1Store();
+
+// State
+const currentStep = ref(1);
+const selectedType = ref<IdentityProviderType>(IdentityProviderType.OAUTH2);
+const selectedTemplate = ref<IdentityProviderTemplate>();
+const isCreating = ref(false);
+
+const identityProvider = ref<IdentityProvider>(
+ IdentityProvider.fromPartial({})
+);
+const configForOAuth2 = ref<OAuth2IdentityProviderConfig>(
+ OAuth2IdentityProviderConfig.fromPartial({
+ authStyle: OAuth2AuthStyle.IN_PARAMS,
+ })
+);
+const configForOIDC = ref<OIDCIdentityProviderConfig>(
+ OIDCIdentityProviderConfig.fromPartial({
+ authStyle: OAuth2AuthStyle.IN_PARAMS,
+ })
+);
+const configForLDAP = ref<LDAPIdentityProviderConfig>(
+ LDAPIdentityProviderConfig.fromPartial({
+ port: 389,
+ })
+);
+const scopesStringOfConfig = ref<string>("");
+const fieldMapping = reactive<FieldMapping>(FieldMapping.fromPartial({}));
+
+const resourceIdField = ref<InstanceType<typeof ResourceIdField>>();
+const resourceIdValue = ref<string>("");
+
+// Computed
+const externalUrl = computed(
+ () => useActuatorV1Store().serverInfo?.externalUrl ?? ""
+);
+
+const resourceId = computed(() => {
+ return resourceIdField.value?.resourceId || resourceIdValue.value || "";
+});
+
+const identityProviderTypeList = computed(() => {
+ return [
+ {
+ type: IdentityProviderType.OAUTH2,
+ feature: PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO,
+ },
+ {
+ type: IdentityProviderType.OIDC,
+ feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
+ },
+ {
+ type: IdentityProviderType.LDAP,
+ feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
+ },
+ ];
+});
+
+const templateList = computed((): IdentityProviderTemplate[] => {
+ return [
+ {
+ title: "Google",
+ name: "",
+ domain: "google.com",
+ type: IdentityProviderType.OAUTH2,
+ feature: PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO,
+ config: {
+ clientId: "",
+ clientSecret: "",
+ authUrl: "https://accounts.google.com/o/oauth2/v2/auth",
+ tokenUrl: "https://oauth2.googleapis.com/token",
+ userInfoUrl: "https://www.googleapis.com/oauth2/v2/userinfo",
+ scopes: [
+ "https://www.googleapis.com/auth/userinfo.email",
+ "https://www.googleapis.com/auth/userinfo.profile",
+ ],
+ skipTlsVerify: false,
+ authStyle: OAuth2AuthStyle.IN_PARAMS,
+ fieldMapping: {
+ identifier: "email",
+ displayName: "name",
+ phone: "",
+ groups: "",
+ },
+ },
+ },
+ {
+ title: "GitHub",
+ name: "",
+ domain: "github.com",
+ type: IdentityProviderType.OAUTH2,
+ feature: PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO,
+ config: {
+ clientId: "",
+ clientSecret: "",
+ authUrl: "https://github.com/login/oauth/authorize",
+ tokenUrl: "https://github.com/login/oauth/access_token",
+ userInfoUrl: "https://api.github.com/user",
+ scopes: ["user"],
+ skipTlsVerify: false,
+ authStyle: OAuth2AuthStyle.IN_PARAMS,
+ fieldMapping: {
+ identifier: "email",
+ displayName: "name",
+ phone: "",
+ groups: "",
+ },
+ },
+ },
+ {
+ title: "GitLab",
+ name: "",
+ domain: "gitlab.com",
+ type: IdentityProviderType.OAUTH2,
+ feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
+ config: {
+ clientId: "",
+ clientSecret: "",
+ authUrl: "https://gitlab.com/oauth/authorize",
+ tokenUrl: "https://gitlab.com/oauth/token",
+ userInfoUrl: "https://gitlab.com/api/v4/user",
+ scopes: ["read_user"],
+ skipTlsVerify: false,
+ authStyle: OAuth2AuthStyle.IN_PARAMS,
+ fieldMapping: {
+ identifier: "email",
+ displayName: "name",
+ phone: "",
+ groups: "",
+ },
+ },
+ },
+ {
+ title: "Microsoft Entra",
+ name: "",
+ domain: "",
+ type: IdentityProviderType.OAUTH2,
+ feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
+ config: {
+ clientId: "",
+ clientSecret: "",
+ authUrl:
+ "https://login.microsoftonline.com/{uuid}/oauth2/v2.0/authorize",
+ tokenUrl: "https://login.microsoftonline.com/{uuid}/oauth2/v2.0/token",
+ userInfoUrl: "https://graph.microsoft.com/v1.0/me",
+ scopes: ["user.read"],
+ skipTlsVerify: false,
+ authStyle: OAuth2AuthStyle.IN_PARAMS,
+ fieldMapping: {
+ identifier: "userPrincipalName",
+ displayName: "displayName",
+ phone: "",
+ groups: "",
+ },
+ },
+ },
+ {
+ title: "Custom",
+ name: "",
+ domain: "",
+ type: IdentityProviderType.OAUTH2,
+ feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
+ config: {
+ clientId: "",
+ clientSecret: "",
+ authUrl: "",
+ tokenUrl: "",
+ userInfoUrl: "",
+ scopes: [],
+ skipTlsVerify: false,
+ authStyle: OAuth2AuthStyle.IN_PARAMS,
+ fieldMapping: {
+ identifier: "",
+ displayName: "",
+ phone: "",
+ groups: "",
+ },
+ },
+ },
+ ];
+});
+
+const maxSteps = computed(() => {
+ return selectedType.value === IdentityProviderType.OAUTH2 ? 5 : 4;
+});
+
+const isLastStep = computed(() => {
+ return currentStep.value === maxSteps.value;
+});
+
+const canProceedToNextStep = computed(() => {
+ switch (currentStep.value) {
+ case 1:
+ return !!selectedType.value;
+ case 2:
+ if (selectedType.value === IdentityProviderType.OAUTH2) {
+ return !!selectedTemplate.value;
+ }
+ // For non-OAuth2, step 2 is basic info
+ return !!(identityProvider.value.title && resourceId.value);
+ case 3:
+ if (selectedType.value === IdentityProviderType.OAUTH2) {
+ // Basic info step for OAuth2
+ return !!(identityProvider.value.title && resourceId.value);
+ }
+ // Configuration step for non-OAuth2
+ return isConfigurationValid.value;
+ case 4:
+ if (selectedType.value === IdentityProviderType.OAUTH2) {
+ // Configuration step for OAuth2
+ return isConfigurationValid.value;
+ }
+ // Mapping step for non-OAuth2
+ return !!fieldMapping.identifier;
+ case 5:
+ // Mapping step for OAuth2
+ return !!fieldMapping.identifier;
+ default:
+ return false;
+ }
+});
+
+const isConfigurationValid = computed(() => {
+ if (selectedType.value === IdentityProviderType.OAUTH2) {
+ return !!(
+ configForOAuth2.value.clientId &&
+ configForOAuth2.value.clientSecret &&
+ configForOAuth2.value.authUrl &&
+ configForOAuth2.value.tokenUrl &&
+ configForOAuth2.value.userInfoUrl &&
+ scopesStringOfConfig.value
+ );
+ } else if (selectedType.value === IdentityProviderType.OIDC) {
+ return !!(
+ configForOIDC.value.clientId &&
+ configForOIDC.value.clientSecret &&
+ configForOIDC.value.issuer &&
+ scopesStringOfConfig.value
+ );
+ } else if (selectedType.value === IdentityProviderType.LDAP) {
+ return !!(
+ configForLDAP.value.host &&
+ configForLDAP.value.port &&
+ configForLDAP.value.bindDn &&
+ configForLDAP.value.bindPassword &&
+ configForLDAP.value.baseDn &&
+ configForLDAP.value.userFilter
+ );
+ }
+ return false;
+});
+
+const canCreate = computed(() => {
+ return !!(
+ identityProvider.value.title &&
+ resourceId.value &&
+ isConfigurationValid.value &&
+ fieldMapping.identifier
+ );
+});
+
+const allowTestConnection = computed(() => {
+ return isConfigurationValid.value && fieldMapping.identifier;
+});
+
+// Methods
+const getProviderIcon = (type: IdentityProviderType) => {
+ switch (type) {
+ case IdentityProviderType.OAUTH2:
+ return KeyIcon;
+ case IdentityProviderType.OIDC:
+ return ShieldCheckIcon;
+ case IdentityProviderType.LDAP:
+ return DatabaseIcon;
+ default:
+ return KeyIcon;
+ }
+};
+
+const getProviderDescription = (type: IdentityProviderType) => {
+ switch (type) {
+ case IdentityProviderType.OAUTH2:
+ return t("settings.sso.form.oauth2-description");
+ case IdentityProviderType.OIDC:
+ return t("settings.sso.form.oidc-description");
+ case IdentityProviderType.LDAP:
+ return t("settings.sso.form.ldap-description");
+ default:
+ return "";
+ }
+};
+
+const getTemplateIcon = (title: string) => {
+ switch (title.toLowerCase()) {
+ case "google":
+ return ChromeIcon;
+ case "github":
+ return GithubIcon;
+ case "gitlab":
+ return GitlabIcon;
+ case "microsoft entra":
+ return BuildingIcon;
+ default:
+ return KeyIcon;
+ }
+};
+
+const getTemplateDescription = (title: string) => {
+ switch (title.toLowerCase()) {
+ case "google":
+ return t("settings.sso.form.google-template-description");
+ case "github":
+ return t("settings.sso.form.github-template-description");
+ case "gitlab":
+ return t("settings.sso.form.gitlab-template-description");
+ case "microsoft entra":
+ return t("settings.sso.form.microsoft-entra-template-description");
+ case "custom":
+ return t("settings.sso.form.custom-template-description");
+ default:
+ return "";
+ }
+};
+
+const handleTemplateSelect = (template: IdentityProviderTemplate) => {
+ selectedTemplate.value = template;
+ // Update title and domain from template
+ identityProvider.value.title = template.title;
+ identityProvider.value.domain = template.domain;
+
+ if (template.type === IdentityProviderType.OAUTH2) {
+ // Create a completely new object to ensure reactivity
+ const newConfig = OAuth2IdentityProviderConfig.fromPartial({
+ clientId: template.config.clientId || "",
+ clientSecret: template.config.clientSecret || "",
+ authUrl: template.config.authUrl || "",
+ tokenUrl: template.config.tokenUrl || "",
+ userInfoUrl: template.config.userInfoUrl || "",
+ scopes: template.config.scopes || [],
+ skipTlsVerify: template.config.skipTlsVerify || false,
+ authStyle: template.config.authStyle || OAuth2AuthStyle.IN_PARAMS,
+ fieldMapping: template.config.fieldMapping || {},
+ });
+ configForOAuth2.value = newConfig;
+
+ // Clear existing field mapping and assign new values
+ Object.keys(fieldMapping).forEach((key) => {
+ delete fieldMapping[key as keyof FieldMapping];
+ });
+ Object.assign(fieldMapping, template.config.fieldMapping || {});
+
+ scopesStringOfConfig.value = template.config.scopes.join(" ");
+ }
+};
+
+const configureSetting = () => {
+ router.push({
+ name: router.currentRoute.value.name?.toString().startsWith("sql-editor")
+ ? SQL_EDITOR_SETTING_GENERAL_MODULE
+ : SETTING_ROUTE_WORKSPACE_GENERAL,
+ });
+};
+
+const handlePrevStep = () => {
+ if (currentStep.value > 1) {
+ currentStep.value--;
+ }
+};
+
+const handleNextStep = () => {
+ if (currentStep.value < maxSteps.value && canProceedToNextStep.value) {
+ // Ensure resource ID is captured before moving to next step
+ if (resourceIdField.value?.resourceId) {
+ resourceIdValue.value = resourceIdField.value.resourceId;
+ }
+ currentStep.value++;
+ }
+};
+
+const testConnection = async () => {
+ // Implementation would be similar to the original component
+ // TODO: Implement test connection functionality
+};
+
+const handleCreate = async () => {
+ if (!canCreate.value) return;
+
+ isCreating.value = true;
+ try {
+ const finalResourceId =
+ resourceIdField.value?.resourceId || resourceIdValue.value;
+ if (!finalResourceId) {
+ throw new Error("Resource ID is required");
+ }
+
+ const createdProvider = await identityProviderStore.createIdentityProvider({
+ name: finalResourceId,
+ title: identityProvider.value.title,
+ domain: identityProvider.value.domain,
+ type: selectedType.value,
+ config: {
+ ...(selectedType.value === IdentityProviderType.OAUTH2 && {
+ oauth2Config: {
+ ...configForOAuth2.value,
+ scopes: scopesStringOfConfig.value.split(" ").filter(Boolean),
+ fieldMapping,
+ },
+ }),
+ ...(selectedType.value === IdentityProviderType.OIDC && {
+ oidcConfig: {
+ ...configForOIDC.value,
+ scopes: scopesStringOfConfig.value.split(" ").filter(Boolean),
+ fieldMapping,
+ },
+ }),
+ ...(selectedType.value === IdentityProviderType.LDAP && {
+ ldapConfig: {
+ ...configForLDAP.value,
+ fieldMapping,
+ },
+ }),
+ },
+ });
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("identity-provider.identity-provider-created"),
+ });
+
+ emit("created", createdProvider);
+
+ router.replace({
+ name: WORKSPACE_ROUTE_SSO_DETAIL,
+ params: {
+ ssoId: extractIdentityProviderResourceName(createdProvider.name),
+ },
+ });
+ } catch (error) {
+ console.error("Failed to create identity provider:", error);
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("identity-provider.identity-provider-create-failed"),
+ });
+ } finally {
+ isCreating.value = false;
+ }
+};
+
+// Watchers
+watch(selectedType, (newType, oldType) => {
+ // Only process if type actually changed, not on initial mount
+ if (oldType === undefined) {
+ // Initial mount - set up OAuth2 defaults if needed
+ if (newType === IdentityProviderType.OAUTH2) {
+ if (!selectedTemplate.value) {
+ selectedTemplate.value = head(templateList.value);
+ }
+ if (selectedTemplate.value) {
+ handleTemplateSelect(selectedTemplate.value);
+ }
+ }
+ return;
+ }
+
+ if (newType !== oldType) {
+ // Type changed - reset form but preserve resource ID
+ if (newType === IdentityProviderType.OAUTH2) {
+ // Switching to OAuth2
+ if (!selectedTemplate.value) {
+ selectedTemplate.value = head(templateList.value);
+ }
+ if (selectedTemplate.value) {
+ handleTemplateSelect(selectedTemplate.value);
+ }
+ } else {
+ // Switching to OIDC or LDAP
+ identityProvider.value.title = "";
+ identityProvider.value.domain = "";
+
+ // Clear field mapping
+ Object.keys(fieldMapping).forEach((key) => {
+ delete fieldMapping[key as keyof FieldMapping];
+ });
+ scopesStringOfConfig.value = "";
+ }
+ }
+});
+
+// Watch for template changes to ensure form is updated
+watch(
+ selectedTemplate,
+ (newTemplate) => {
+ if (newTemplate && selectedType.value === IdentityProviderType.OAUTH2) {
+ handleTemplateSelect(newTemplate);
+ }
+ },
+ { deep: true }
+);
+</script>
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue b/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
new file mode 100644
index 0000000000..5c8d12c67f
--- /dev/null
+++ b/frontend/src/components/IdentityProvider/IdentityProviderEditForm.vue
@@ -0,0 +1,584 @@
+<template>
+ <div class="w-full space-y-0 pt-4">
+ <div class="divide-y divide-block-border">
+ <!-- Basic Information Section -->
+ <div class="pb-6 lg:flex">
+ <div class="text-left lg:w-1/4">
+ <h1 class="text-3xl font-bold text-gray-900">
+ {{ $t("common.general") }}
+ </h1>
+ </div>
+ <div class="flex-1 mt-4 lg:px-4 lg:mt-0 space-y-6">
+ <div>
+ <p class="text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.name") }}
+ <span class="text-red-600">*</span>
+ </p>
+ <BBTextField
+ v-model:value="localIdentityProvider.title"
+ required
+ :disabled="!allowEdit"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.name-description')"
+ />
+ </div>
+
+ <div>
+ <p class="text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.resource-id") }}
+ </p>
+ <BBTextField
+ :value="resourceId"
+ readonly
+ size="large"
+ class="w-full text-base bg-gray-50"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.resource-id-readonly-hint") }}
+ </p>
+ </div>
+
+ <div>
+ <p class="text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.domain") }}
+ </p>
+ <BBTextField
+ v-model:value="localIdentityProvider.domain"
+ :disabled="!allowEdit"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.domain-description')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.domain-optional-hint") }}
+ </p>
+ </div>
+
+ <div>
+ <p class="text-base font-semibold text-gray-800 mb-2">
+ {{ $t("common.type") }}
+ </p>
+ <div class="flex items-center space-x-3 p-3 bg-gray-50 rounded-md">
+ <component
+ :is="getProviderIcon(localIdentityProvider.type)"
+ class="w-5 h-5 text-gray-600"
+ />
+ <span class="text-base font-medium text-gray-800">
+ {{ identityProviderTypeToString(localIdentityProvider.type) }}
+ </span>
+ </div>
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.provider-type-readonly-hint") }}
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <!-- Configuration Section -->
+ <div class="py-6 lg:flex">
+ <div class="text-left lg:w-1/4">
+ <h1 class="text-3xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.configuration") }}
+ </h1>
+ <p class="text-base text-gray-600 mt-3">
+ {{ $t("settings.sso.form.configuration-description") }}
+ </p>
+ </div>
+ <div class="flex-1 mt-4 lg:px-4 lg:mt-0">
+ <IdentityProviderForm
+ :identity-provider="localIdentityProvider"
+ :provider-type="localIdentityProvider.type"
+ :config-for-oauth2="configForOAuth2"
+ :config-for-oidc="configForOIDC"
+ :config-for-ldap="configForLDAP"
+ :scopes-string="scopesStringOfConfig"
+ :is-edit-mode="true"
+ @update:config-for-oauth2="configForOAuth2 = $event"
+ @update:config-for-oidc="configForOIDC = $event"
+ @update:config-for-ldap="configForLDAP = $event"
+ @update:scopes-string="scopesStringOfConfig = $event"
+ />
+ </div>
+ </div>
+
+ <!-- User Information Mapping Section -->
+ <div class="py-6 lg:flex">
+ <div class="text-left lg:w-1/4">
+ <h1 class="text-3xl font-bold text-gray-900">
+ {{ $t("settings.sso.form.user-information-mapping") }}
+ </h1>
+ <p class="text-base text-gray-600 mt-3">
+ {{ $t("settings.sso.form.user-information-mapping-description") }}
+ <a
+ href="https://docs.bytebase.com/administration/sso/oauth2#user-information-field-mapping?source=console"
+ class="text-blue-600 hover:text-blue-800 underline ml-1"
+ target="_blank"
+ >
+ {{ $t("common.learn-more") }}
+ </a>
+ </p>
+ </div>
+ <div class="flex-1 mt-4 lg:px-4 lg:mt-0 space-y-6">
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.identifier"
+ :disabled="!allowEdit"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.identifier-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p
+ class="flex flex-row justify-start items-center font-semibold text-gray-800"
+ >
+ {{ $t("settings.sso.form.identifier") }}
+ <span class="text-red-600">*</span>
+ <NTooltip>
+ <template #trigger>
+ <InfoIcon class="ml-1 w-4 h-auto text-blue-500" />
+ </template>
+ {{ $t("settings.sso.form.identifier-tips") }}
+ </NTooltip>
+ </p>
+ </div>
+ </div>
+
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.displayName"
+ :disabled="!allowEdit"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.display-name-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.display-name") }}
+ </p>
+ </div>
+ </div>
+
+ <div class="grid grid-cols-[256px_1fr] gap-4 items-center">
+ <BBTextField
+ v-model:value="fieldMapping.phone"
+ :disabled="!allowEdit"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.phone-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.phone") }}
+ </p>
+ </div>
+ </div>
+
+ <div
+ v-if="localIdentityProvider.type === IdentityProviderType.OIDC"
+ class="grid grid-cols-[256px_1fr] gap-4 items-center"
+ >
+ <BBTextField
+ v-model:value="fieldMapping.groups"
+ :disabled="!allowEdit"
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.groups-placeholder')"
+ />
+ <div class="flex flex-row justify-start items-center text-base">
+ <ArrowRightIcon class="mx-2 h-auto w-5 text-gray-400" />
+ <p class="font-semibold text-gray-800">
+ {{ $t("settings.sso.form.groups") }}
+ </p>
+ </div>
+ </div>
+
+ <div>
+ <NButton
+ :disabled="!allowTestConnection"
+ @click="testConnection"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("identity-provider.test-connection") }}
+ </NButton>
+ </div>
+ </div>
+ </div>
+
+ <!-- Actions Section -->
+ <div class="py-6">
+ <div class="flex flex-row justify-between items-center">
+ <div class="space-x-4 flex flex-row justify-start items-center">
+ <BBButtonConfirm
+ :type="'ARCHIVE'"
+ :button-text="$t('settings.sso.delete')"
+ :ok-text="$t('common.delete')"
+ :confirm-title="$t('settings.sso.delete')"
+ :confirm-description="$t('common.cannot-undo-this-action')"
+ :require-confirm="true"
+ @confirm="handleDelete"
+ />
+ </div>
+ <div class="space-x-3 flex flex-row justify-end items-center">
+ <NButton
+ v-if="hasChanges"
+ @click="handleDiscard"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("common.discard-changes") }}
+ </NButton>
+ <NButton
+ type="primary"
+ :disabled="!canUpdate"
+ :loading="isUpdating"
+ @click="handleUpdate"
+ size="large"
+ class="text-base"
+ >
+ {{ $t("common.update") }}
+ </NButton>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { cloneDeep, isEqual } from "lodash-es";
+import {
+ ArrowRightIcon,
+ InfoIcon,
+ KeyIcon,
+ ShieldCheckIcon,
+ DatabaseIcon,
+} from "lucide-vue-next";
+import { NButton, NTooltip } from "naive-ui";
+import { computed, reactive, ref, watch } from "vue";
+import { useI18n } from "vue-i18n";
+import { useRouter } from "vue-router";
+import { BBTextField, BBButtonConfirm } from "@/bbkit";
+import { WORKSPACE_ROUTE_SSO } from "@/router/dashboard/workspaceRoutes";
+import { pushNotification } from "@/store";
+import { useIdentityProviderStore } from "@/store/modules/idp";
+import { getIdentityProviderResourceId } from "@/store/modules/v1/common";
+import {
+ FieldMapping,
+ IdentityProvider,
+ IdentityProviderType,
+ OAuth2IdentityProviderConfig,
+ OIDCIdentityProviderConfig,
+ LDAPIdentityProviderConfig,
+ IdentityProviderConfig,
+} from "@/types/proto/v1/idp_service";
+import {
+ hasWorkspacePermissionV2,
+ identityProviderTypeToString,
+} from "@/utils";
+import IdentityProviderForm from "./IdentityProviderForm.vue";
+
+interface Props {
+ identityProvider: IdentityProvider;
+}
+
+const props = defineProps<Props>();
+
+const emit = defineEmits<{
+ (event: "updated", identityProvider: IdentityProvider): void;
+ (event: "deleted"): void;
+}>();
+
+const { t } = useI18n();
+const router = useRouter();
+const identityProviderStore = useIdentityProviderStore();
+
+// State
+const isUpdating = ref(false);
+const localIdentityProvider = ref<IdentityProvider>(
+ cloneDeep(props.identityProvider)
+);
+const configForOAuth2 = ref<OAuth2IdentityProviderConfig>(
+ OAuth2IdentityProviderConfig.fromPartial(
+ props.identityProvider.config?.oauth2Config || {}
+ )
+);
+const configForOIDC = ref<OIDCIdentityProviderConfig>(
+ OIDCIdentityProviderConfig.fromPartial(
+ props.identityProvider.config?.oidcConfig || {}
+ )
+);
+const configForLDAP = ref<LDAPIdentityProviderConfig>(
+ LDAPIdentityProviderConfig.fromPartial(
+ props.identityProvider.config?.ldapConfig || {}
+ )
+);
+const scopesStringOfConfig = ref<string>("");
+const fieldMapping = reactive<FieldMapping>(FieldMapping.fromPartial({}));
+
+// Computed
+const resourceId = computed(() => {
+ return getIdentityProviderResourceId(localIdentityProvider.value.name);
+});
+
+const allowEdit = computed(() => {
+ return hasWorkspacePermissionV2("bb.identityProviders.update");
+});
+
+const hasChanges = computed(() => {
+ const current = buildUpdatedIdentityProvider();
+ return !isEqual(current, props.identityProvider);
+});
+
+// Track if secrets have been modified
+const isClientSecretModified = ref(false);
+const isBindPasswordModified = ref(false);
+
+const isFormValid = computed(() => {
+ if (!localIdentityProvider.value.title) return false;
+ if (!fieldMapping.identifier) return false;
+
+ if (localIdentityProvider.value.type === IdentityProviderType.OAUTH2) {
+ // For edit mode, client secret is optional if not modified
+ const isClientSecretValid = isClientSecretModified.value
+ ? !!configForOAuth2.value.clientSecret
+ : true;
+
+ return !!(
+ configForOAuth2.value.clientId &&
+ isClientSecretValid &&
+ configForOAuth2.value.authUrl &&
+ configForOAuth2.value.tokenUrl &&
+ configForOAuth2.value.userInfoUrl
+ );
+ } else if (localIdentityProvider.value.type === IdentityProviderType.OIDC) {
+ // For edit mode, client secret is optional if not modified
+ const isClientSecretValid = isClientSecretModified.value
+ ? !!configForOIDC.value.clientSecret
+ : true;
+
+ return !!(
+ configForOIDC.value.clientId &&
+ isClientSecretValid &&
+ configForOIDC.value.issuer
+ );
+ } else if (localIdentityProvider.value.type === IdentityProviderType.LDAP) {
+ // For edit mode, bind password is optional if not modified
+ const isBindPasswordValid = isBindPasswordModified.value
+ ? !!configForLDAP.value.bindPassword
+ : true;
+
+ return !!(
+ configForLDAP.value.host &&
+ configForLDAP.value.port &&
+ configForLDAP.value.bindDn &&
+ isBindPasswordValid &&
+ configForLDAP.value.baseDn &&
+ configForLDAP.value.userFilter
+ );
+ }
+
+ return false;
+});
+
+const canUpdate = computed(() => {
+ return allowEdit.value && hasChanges.value && isFormValid.value;
+});
+
+const allowTestConnection = computed(() => {
+ return isFormValid.value;
+});
+
+// Methods
+const getProviderIcon = (type: IdentityProviderType) => {
+ switch (type) {
+ case IdentityProviderType.OAUTH2:
+ return KeyIcon;
+ case IdentityProviderType.OIDC:
+ return ShieldCheckIcon;
+ case IdentityProviderType.LDAP:
+ return DatabaseIcon;
+ default:
+ return KeyIcon;
+ }
+};
+
+const buildUpdatedIdentityProvider = (): IdentityProvider => {
+ const result: any = IdentityProvider.fromPartial({
+ ...localIdentityProvider.value,
+ config: IdentityProviderConfig.fromPartial({}),
+ });
+
+ if (localIdentityProvider.value.type === IdentityProviderType.OAUTH2) {
+ const oauth2Config: any = {
+ ...configForOAuth2.value,
+ scopes: scopesStringOfConfig.value.split(" ").filter(Boolean),
+ fieldMapping,
+ };
+
+ result.config.oauth2Config = oauth2Config;
+ } else if (localIdentityProvider.value.type === IdentityProviderType.OIDC) {
+ const oidcConfig: any = {
+ ...configForOIDC.value,
+ scopes: scopesStringOfConfig.value.split(" ").filter(Boolean),
+ fieldMapping,
+ };
+
+ result.config.oidcConfig = oidcConfig;
+ } else if (localIdentityProvider.value.type === IdentityProviderType.LDAP) {
+ const ldapConfig: any = {
+ ...configForLDAP.value,
+ fieldMapping,
+ };
+
+ result.config.ldapConfig = ldapConfig;
+ }
+
+ return result as IdentityProvider;
+};
+
+const initializeFromProps = () => {
+ localIdentityProvider.value = cloneDeep(props.identityProvider);
+
+ // Reset secret modification flags
+ isClientSecretModified.value = false;
+ isBindPasswordModified.value = false;
+
+ if (props.identityProvider.config?.oauth2Config) {
+ configForOAuth2.value = OAuth2IdentityProviderConfig.fromPartial(
+ props.identityProvider.config.oauth2Config
+ );
+ Object.assign(
+ fieldMapping,
+ props.identityProvider.config.oauth2Config.fieldMapping || {}
+ );
+ scopesStringOfConfig.value = (
+ props.identityProvider.config.oauth2Config.scopes || []
+ ).join(" ");
+ } else if (props.identityProvider.config?.oidcConfig) {
+ configForOIDC.value = OIDCIdentityProviderConfig.fromPartial(
+ props.identityProvider.config.oidcConfig
+ );
+ Object.assign(
+ fieldMapping,
+ props.identityProvider.config.oidcConfig.fieldMapping || {}
+ );
+ scopesStringOfConfig.value = (
+ props.identityProvider.config.oidcConfig.scopes || []
+ ).join(" ");
+ } else if (props.identityProvider.config?.ldapConfig) {
+ configForLDAP.value = LDAPIdentityProviderConfig.fromPartial(
+ props.identityProvider.config.ldapConfig
+ );
+ Object.assign(
+ fieldMapping,
+ props.identityProvider.config.ldapConfig.fieldMapping || {}
+ );
+ }
+};
+
+const testConnection = async () => {
+ // TODO: Implement test connection
+};
+
+const handleUpdate = async () => {
+ if (!canUpdate.value) return;
+
+ isUpdating.value = true;
+ try {
+ const updatedProvider = await identityProviderStore.patchIdentityProvider(
+ buildUpdatedIdentityProvider()
+ );
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
+
+ emit("updated", updatedProvider);
+ initializeFromProps();
+ } catch {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("identity-provider.identity-provider-update-failed"),
+ });
+ } finally {
+ isUpdating.value = false;
+ }
+};
+
+const handleDiscard = () => {
+ initializeFromProps();
+};
+
+const handleDelete = async () => {
+ if (!hasWorkspacePermissionV2("bb.identityProviders.delete")) {
+ pushNotification({
+ module: "bytebase",
+ style: "WARN",
+ title: t("identity-provider.identity-provider-permission-denied"),
+ });
+ return;
+ }
+
+ try {
+ await identityProviderStore.deleteIdentityProvider(
+ props.identityProvider.name
+ );
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("identity-provider.identity-provider-deleted"),
+ });
+
+ emit("deleted");
+ router.replace({
+ name: WORKSPACE_ROUTE_SSO,
+ });
+ } catch {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("identity-provider.identity-provider-delete-failed"),
+ });
+ }
+};
+
+// Initialize from props
+watch(() => props.identityProvider, initializeFromProps, { immediate: true });
+
+// Watch for secret field changes
+watch(
+ () => configForOAuth2.value.clientSecret,
+ (newVal, oldVal) => {
+ if (oldVal !== undefined && newVal !== oldVal) {
+ isClientSecretModified.value = true;
+ }
+ }
+);
+
+watch(
+ () => configForOIDC.value.clientSecret,
+ (newVal, oldVal) => {
+ if (oldVal !== undefined && newVal !== oldVal) {
+ isClientSecretModified.value = true;
+ }
+ }
+);
+
+watch(
+ () => configForLDAP.value.bindPassword,
+ (newVal, oldVal) => {
+ if (oldVal !== undefined && newVal !== oldVal) {
+ isBindPasswordModified.value = true;
+ }
+ }
+);
+</script>
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderExternalURL.vue b/frontend/src/components/IdentityProvider/IdentityProviderExternalURL.vue
new file mode 100644
index 0000000000..87d7f6daca
--- /dev/null
+++ b/frontend/src/components/IdentityProvider/IdentityProviderExternalURL.vue
@@ -0,0 +1,80 @@
+<template>
+ <div class="p-4 rounded-lg border border-gray-200 bg-gray-50">
+ <div class="flex items-start space-x-3">
+ <div class="flex-shrink-0">
+ <InfoIcon class="w-5 h-5 text-blue-500 mt-0.5" />
+ </div>
+ <div class="flex-1 min-w-0">
+ <p class="text-sm font-medium text-gray-900 mb-2">
+ {{ $t("settings.sso.form.identity-provider-needed-information") }}
+ </p>
+ <p class="text-sm text-gray-600 mb-3">
+ {{ $t("settings.sso.form.redirect-url-description") }}
+ </p>
+
+ <div class="flex items-center space-x-3">
+ <div class="flex-1">
+ <label class="block text-sm font-medium text-gray-700 mb-1">
+ {{ $t("settings.sso.form.redirect-url") }}
+ </label>
+ <div class="relative">
+ <input
+ :value="redirectUrl"
+ readonly
+ class="block w-full px-3 py-2 border border-gray-300 rounded-md bg-white text-sm font-mono text-gray-700 pr-10"
+ />
+ <button
+ type="button"
+ class="absolute inset-y-0 right-0 px-3 flex items-center text-gray-400 hover:text-gray-600"
+ @click="copyRedirectUrl"
+ >
+ <ClipboardIcon class="w-4 h-4" />
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { ClipboardIcon, InfoIcon } from "lucide-vue-next";
+import { computed } from "vue";
+import { useI18n } from "vue-i18n";
+import { pushNotification, useActuatorV1Store } from "@/store";
+import { IdentityProviderType } from "@/types/proto/v1/idp_service";
+import { toClipboard } from "@/utils";
+
+const props = defineProps<{
+ type: IdentityProviderType;
+}>();
+
+const { t } = useI18n();
+
+const externalUrl = computed(
+ () => useActuatorV1Store().serverInfo?.externalUrl ?? ""
+);
+
+const redirectUrl = computed(() => {
+ const url = externalUrl.value || window.origin;
+ switch (props.type) {
+ case IdentityProviderType.OAUTH2:
+ return `${url}/oauth/callback`;
+ case IdentityProviderType.OIDC:
+ return `${url}/oidc/callback`;
+ default:
+ return "";
+ }
+});
+
+const copyRedirectUrl = () => {
+ toClipboard(redirectUrl.value).then(() => {
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("settings.sso.copy-redirect-url"),
+ });
+ });
+};
+</script>
\ No newline at end of file
diff --git a/frontend/src/components/IdentityProvider/IdentityProviderForm.vue b/frontend/src/components/IdentityProvider/IdentityProviderForm.vue
new file mode 100644
index 0000000000..b6723b7455
--- /dev/null
+++ b/frontend/src/components/IdentityProvider/IdentityProviderForm.vue
@@ -0,0 +1,564 @@
+<template>
+ <div class="space-y-6">
+ <!-- OAuth2 Configuration -->
+ <div v-if="providerType === IdentityProviderType.OAUTH2" class="space-y-6">
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ Client ID
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oauth2Config.clientId || ''"
+ @update:value="updateOAuth2Config('clientId', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ placeholder="e.g. 6655asd77895265aa110ac0d3"
+ />
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ Client Secret
+ <span v-if="!isEditMode" class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oauth2Config.clientSecret || ''"
+ @update:value="updateOAuth2Config('clientSecret', $event)"
+ :required="!isEditMode"
+ size="large"
+ type="password"
+ class="w-full text-base"
+ :placeholder="
+ isEditMode && !oauth2Config.clientSecret
+ ? 'Leave empty to keep existing secret'
+ : 'e.g. 5bbezxc3972ca304de70c5d70a6aa932asd8'
+ "
+ />
+ </div>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.auth-url") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oauth2Config.authUrl || ''"
+ @update:value="updateOAuth2Config('authUrl', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.auth-url-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.auth-url-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.token-url") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oauth2Config.tokenUrl || ''"
+ @update:value="updateOAuth2Config('tokenUrl', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.token-url-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.token-url-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.user-info-url") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oauth2Config.userInfoUrl || ''"
+ @update:value="updateOAuth2Config('userInfoUrl', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.user-info-url-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.user-info-url-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.scopes") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="scopesString || ''"
+ @update:value="$emit('update:scopes-string', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.scopes-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.scopes-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-3">
+ {{ $t("settings.sso.form.authentication-style") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <NRadioGroup
+ :value="oauth2Config.authStyle"
+ @update:value="updateOAuth2Config('authStyle', $event)"
+ size="large"
+ class="space-y-3"
+ >
+ <NRadio
+ :value="OAuth2AuthStyle.IN_PARAMS"
+ class="text-base font-medium text-gray-800"
+ >
+ <div class="space-y-1">
+ <div class="font-medium">
+ {{ $t("settings.sso.form.in-parameters") }}
+ </div>
+ <div class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.in-parameters-description") }}
+ </div>
+ </div>
+ </NRadio>
+ <NRadio
+ :value="OAuth2AuthStyle.IN_HEADER"
+ class="text-base font-medium text-gray-800"
+ >
+ <div class="space-y-1">
+ <div class="font-medium">
+ {{ $t("settings.sso.form.in-header") }}
+ </div>
+ <div class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.in-header-description") }}
+ </div>
+ </div>
+ </NRadio>
+ </NRadioGroup>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-3">
+ {{ $t("settings.sso.form.security-options") }}
+ </label>
+ <NCheckbox
+ :checked="oauth2Config.skipTlsVerify"
+ @update:checked="updateOAuth2Config('skipTlsVerify', $event)"
+ size="large"
+ class="text-base font-medium text-gray-800"
+ >
+ {{ $t("settings.sso.form.skip-tls-verification") }}
+ </NCheckbox>
+ <p class="text-sm text-gray-600 mt-1 ml-6">
+ {{ $t("settings.sso.form.skip-tls-warning") }}
+ </p>
+ </div>
+ </div>
+
+ <!-- OIDC Configuration -->
+ <div
+ v-else-if="providerType === IdentityProviderType.OIDC"
+ class="space-y-6"
+ >
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ Issuer URL
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oidcConfig.issuer || ''"
+ @update:value="updateOIDCConfig('issuer', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.issuer-url-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.issuer-url-description") }}
+ </p>
+ </div>
+
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ Client ID
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oidcConfig.clientId || ''"
+ @update:value="updateOIDCConfig('clientId', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ placeholder="e.g. 6655asd77895265aa110ac0d3"
+ />
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ Client Secret
+ <span v-if="!isEditMode" class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="oidcConfig.clientSecret || ''"
+ @update:value="updateOIDCConfig('clientSecret', $event)"
+ :required="!isEditMode"
+ size="large"
+ type="password"
+ class="w-full text-base"
+ :placeholder="
+ isEditMode && !oidcConfig.clientSecret
+ ? 'Leave empty to keep existing secret'
+ : 'e.g. 5bbezxc3972ca304de70c5d70a6aa932asd8'
+ "
+ />
+ </div>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.scopes") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :model-value="scopesString"
+ @update:value="$emit('update:scopes-string', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.scopes-placeholder-oidc')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.openid-scopes-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-3">
+ {{ $t("settings.sso.form.authentication-style") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <NRadioGroup
+ :value="oidcConfig.authStyle"
+ @update:value="updateOIDCConfig('authStyle', $event)"
+ size="large"
+ class="space-y-3"
+ >
+ <NRadio
+ :value="OAuth2AuthStyle.IN_PARAMS"
+ class="text-base font-medium text-gray-800"
+ >
+ <div class="space-y-1">
+ <div class="font-medium">
+ {{ $t("settings.sso.form.in-parameters") }}
+ </div>
+ <div class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.in-parameters-description") }}
+ </div>
+ </div>
+ </NRadio>
+ <NRadio
+ :value="OAuth2AuthStyle.IN_HEADER"
+ class="text-base font-medium text-gray-800"
+ >
+ <div class="space-y-1">
+ <div class="font-medium">
+ {{ $t("settings.sso.form.in-header") }}
+ </div>
+ <div class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.in-header-description") }}
+ </div>
+ </div>
+ </NRadio>
+ </NRadioGroup>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-3">
+ {{ $t("settings.sso.form.security-options") }}
+ </label>
+ <NCheckbox
+ :checked="oidcConfig.skipTlsVerify"
+ @update:checked="updateOIDCConfig('skipTlsVerify', $event)"
+ size="large"
+ class="text-base font-medium text-gray-800"
+ >
+ {{ $t("settings.sso.form.skip-tls-verification") }}
+ </NCheckbox>
+ <p class="text-sm text-gray-600 mt-1 ml-6">
+ {{ $t("settings.sso.form.skip-tls-warning") }}
+ </p>
+ </div>
+ </div>
+
+ <!-- LDAP Configuration -->
+ <div
+ v-else-if="providerType === IdentityProviderType.LDAP"
+ class="space-y-6"
+ >
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
+ <div class="md:col-span-2">
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ Host
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="ldapConfig.host || ''"
+ @update:value="updateLDAPConfig('host', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.host-placeholder')"
+ />
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ Port
+ <span class="text-red-600">*</span>
+ </label>
+ <NInputNumber
+ :value="ldapConfig.port"
+ @update:value="updateLDAPConfig('port', $event)"
+ size="large"
+ class="w-full text-base"
+ placeholder="389"
+ :min="1"
+ :max="65535"
+ />
+ </div>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.bind-dn") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="ldapConfig.bindDn || ''"
+ @update:value="updateLDAPConfig('bindDn', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.bind-dn-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.bind-dn-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.bind-password") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="ldapConfig.bindPassword || ''"
+ @update:value="updateLDAPConfig('bindPassword', $event)"
+ required
+ size="large"
+ type="password"
+ class="w-full text-base"
+ placeholder="••••••••"
+ />
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.base-dn") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="ldapConfig.baseDn || ''"
+ @update:value="updateLDAPConfig('baseDn', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.base-dn-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.base-dn-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-2">
+ {{ $t("settings.sso.form.user-filter") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <BBTextField
+ :value="ldapConfig.userFilter || ''"
+ @update:value="updateLDAPConfig('userFilter', $event)"
+ required
+ size="large"
+ class="w-full text-base"
+ :placeholder="$t('settings.sso.form.user-filter-placeholder')"
+ />
+ <p class="text-sm text-gray-600 mt-1">
+ {{ $t("settings.sso.form.user-filter-description") }}
+ </p>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-3">
+ {{ $t("settings.sso.form.security-protocol") }}
+ <span class="text-red-600">*</span>
+ </label>
+ <NRadioGroup
+ :value="ldapConfig.securityProtocol"
+ @update:value="updateLDAPConfig('securityProtocol', $event)"
+ size="large"
+ class="space-y-3"
+ >
+ <NRadio
+ :value="LDAPIdentityProviderConfig_SecurityProtocol.START_TLS"
+ class="text-base font-medium text-gray-800"
+ >
+ <div class="space-y-1">
+ <div class="font-medium">
+ {{ $t("settings.sso.form.starttls") }}
+ </div>
+ <div class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.starttls-description") }}
+ </div>
+ </div>
+ </NRadio>
+ <NRadio
+ :value="LDAPIdentityProviderConfig_SecurityProtocol.LDAPS"
+ class="text-base font-medium text-gray-800"
+ >
+ <div class="space-y-1">
+ <div class="font-medium">{{ $t("settings.sso.form.ldaps") }}</div>
+ <div class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.ldaps-description") }}
+ </div>
+ </div>
+ </NRadio>
+ <NRadio
+ :value="
+ LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED
+ "
+ class="text-base font-medium text-gray-800"
+ >
+ <div class="space-y-1">
+ <div class="font-medium">{{ $t("settings.sso.form.none") }}</div>
+ <div class="text-sm text-gray-600">
+ {{ $t("settings.sso.form.none-description") }}
+ </div>
+ </div>
+ </NRadio>
+ </NRadioGroup>
+ </div>
+
+ <div>
+ <label class="block text-base font-semibold text-gray-800 mb-3">
+ {{ $t("settings.sso.form.security-options") }}
+ </label>
+ <NCheckbox
+ :checked="ldapConfig.skipTlsVerify"
+ @update:checked="updateLDAPConfig('skipTlsVerify', $event)"
+ size="large"
+ class="text-base font-medium text-gray-800"
+ >
+ {{ $t("settings.sso.form.skip-tls-verification") }}
+ </NCheckbox>
+ <p class="text-sm text-gray-600 mt-1 ml-6">
+ {{ $t("settings.sso.form.skip-tls-warning") }}
+ </p>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { NRadioGroup, NRadio, NCheckbox, NInputNumber } from "naive-ui";
+import { computed, watch } from "vue";
+import { BBTextField } from "@/bbkit";
+import {
+ IdentityProviderType,
+ OAuth2AuthStyle,
+ type IdentityProvider,
+ type OAuth2IdentityProviderConfig,
+ type OIDCIdentityProviderConfig,
+ type LDAPIdentityProviderConfig,
+ LDAPIdentityProviderConfig_SecurityProtocol,
+} from "@/types/proto/v1/idp_service";
+
+interface Props {
+ identityProvider: IdentityProvider;
+ providerType: IdentityProviderType;
+ configForOauth2: OAuth2IdentityProviderConfig;
+ configForOidc: OIDCIdentityProviderConfig;
+ configForLdap: LDAPIdentityProviderConfig;
+ scopesString: string;
+ isEditMode?: boolean;
+}
+
+const props = defineProps<Props>();
+
+const emit = defineEmits<{
+ "update:config-for-oauth2": [config: OAuth2IdentityProviderConfig];
+ "update:config-for-oidc": [config: OIDCIdentityProviderConfig];
+ "update:config-for-ldap": [config: LDAPIdentityProviderConfig];
+ "update:scopes-string": [scopes: string];
+}>();
+
+// Create computed properties to ensure reactivity
+const oauth2Config = computed(() => props.configForOauth2);
+const oidcConfig = computed(() => props.configForOidc);
+const ldapConfig = computed(() => props.configForLdap);
+
+// Watch for OAuth2 config changes to ensure reactivity
+watch(
+ () => props.configForOauth2,
+ () => {
+ // Trigger reactivity when props change
+ },
+ { deep: true }
+);
+
+// Helper methods to update configurations
+const updateOAuth2Config = (
+ key: keyof OAuth2IdentityProviderConfig,
+ value: any
+) => {
+ emit("update:config-for-oauth2", {
+ ...props.configForOauth2,
+ [key]: value,
+ });
+};
+
+const updateOIDCConfig = (
+ key: keyof OIDCIdentityProviderConfig,
+ value: any
+) => {
+ emit("update:config-for-oidc", {
+ ...props.configForOidc,
+ [key]: value,
+ });
+};
+
+const updateLDAPConfig = (
+ key: keyof LDAPIdentityProviderConfig,
+ value: any
+) => {
+ emit("update:config-for-ldap", {
+ ...props.configForLdap,
+ [key]: value,
+ });
+};
+</script>
diff --git a/frontend/src/components/SSO/IdentityProviderTable.vue b/frontend/src/components/IdentityProvider/IdentityProviderTable.vue
similarity index 79%
rename from frontend/src/components/SSO/IdentityProviderTable.vue
rename to frontend/src/components/IdentityProvider/IdentityProviderTable.vue
index b97c9b9055..0eabfe4a8e 100644
--- a/frontend/src/components/SSO/IdentityProviderTable.vue
+++ b/frontend/src/components/IdentityProvider/IdentityProviderTable.vue
@@ -1,13 +1,12 @@
<template>
<NDataTable
key="idp-table"
- size="small"
v-bind="$attrs"
:columns="columnList"
:data="identityProviderList"
:striped="true"
:bordered="bordered"
- :row-key="(data: IdentityProvider) => data.name"
+ :row-key="(idp: IdentityProvider) => idp.name"
:row-props="rowProps"
:paginate-single-page="false"
/>
@@ -21,6 +20,7 @@ import { useRouter } from "vue-router";
import { WORKSPACE_ROUTE_SSO_DETAIL } from "@/router/dashboard/workspaceRoutes";
import { getSSOId } from "@/store/modules/v1/common";
import type { IdentityProvider } from "@/types/proto/v1/idp_service";
+import { identityProviderTypeToString } from "@/utils";
withDefaults(
defineProps<{
@@ -33,31 +33,24 @@ withDefaults(
);
const router = useRouter();
-
const { t } = useI18n();
const columnList = computed((): DataTableColumn<IdentityProvider>[] => {
return [
{
- key: "name",
+ key: "title",
title: t("common.name"),
- resizable: true,
- ellipsis: true,
render: (idp) => idp.title,
},
{
- key: "resource-id",
- title: t("settings.sso.form.resource-id"),
- resizable: true,
- ellipsis: true,
- render: (idp) => idp.name,
+ key: "type",
+ title: t("common.type"),
+ render: (idp) => identityProviderTypeToString(idp.type),
},
{
key: "domain",
title: t("settings.sso.form.domain"),
- resizable: true,
- ellipsis: true,
- render: (idp) => idp.domain,
+ render: (idp) => idp.domain || "-",
},
];
});
diff --git a/frontend/src/components/IdentityProvider/index.ts b/frontend/src/components/IdentityProvider/index.ts
new file mode 100644
index 0000000000..3a1c0765bd
--- /dev/null
+++ b/frontend/src/components/IdentityProvider/index.ts
@@ -0,0 +1,5 @@
+export { default as IdentityProviderTable } from "./IdentityProviderTable.vue";
+export { default as IdentityProviderCreateWizard } from "./IdentityProviderCreateWizard.vue";
+export { default as IdentityProviderEditForm } from "./IdentityProviderEditForm.vue";
+export { default as IdentityProviderForm } from "./IdentityProviderForm.vue";
+export { default as IdentityProviderExternalURL } from "./IdentityProviderExternalURL.vue";
\ No newline at end of file
diff --git a/frontend/src/components/SSO/IdentityProviderCreateForm.vue b/frontend/src/components/SSO/IdentityProviderCreateForm.vue
deleted file mode 100644
index 243725af1e..0000000000
--- a/frontend/src/components/SSO/IdentityProviderCreateForm.vue
+++ /dev/null
@@ -1,1325 +0,0 @@
-<template>
- <div
- class="w-full flex flex-col justify-start items-start overflow-x-hidden px-1"
- >
- <div
- v-if="isCreating"
- class="w-full flex flex-col justify-start items-start"
- >
- <div class="w-full flex flex-row items-center space-x-2">
- <p class="textlabel my-2">{{ $t("settings.sso.form.type") }}</p>
- <a
- v-if="userDocLink"
- :href="userDocLink"
- class="normal-link text-sm inline-flex flex-row items-center"
- target="_blank"
- >
- {{ $t("settings.sso.form.learn-more-with-user-doc") }}
- <heroicons-outline:external-link class="w-4 h-4" />
- </a>
- </div>
- <div class="w-full flex flex-row justify-start items-start space-x-2">
- <NRadioGroup
- v-for="item in identityProviderTypeList"
- :key="item.type"
- v-model:value="state.type"
- >
- <NRadio
- :value="item.type"
- :disabled="!subscriptionStore.hasFeature(item.feature)"
- >
- <div class="flex items-center space-x-2">
- <FeatureBadge :feature="item.feature" />
- {{ identityProviderTypeToString(item.type) }}
- </div>
- </NRadio>
- </NRadioGroup>
- </div>
-
- <BBAttention
- v-if="
- !externalUrl &&
- (state.type === IdentityProviderType.OAUTH2 ||
- state.type === IdentityProviderType.OIDC)
- "
- class="mt-4 w-full border-none"
- type="error"
- :title="$t('banner.external-url')"
- :description="$t('settings.general.workspace.external-url.description')"
- >
- <template #action>
- <NButton type="primary" @click="configureSetting">
- {{ $t("common.configure-now") }}
- </NButton>
- </template>
- </BBAttention>
- </div>
-
- <!-- OAuth2 templates group -->
- <div
- v-if="isCreating && state.type === IdentityProviderType.OAUTH2"
- class="w-full flex flex-col justify-start items-start space-y-3"
- >
- <p class="textlabel mt-4">
- {{ $t("settings.sso.form.use-template") }}
- </p>
- <div class="w-full flex flex-row justify-start items-start space-x-2">
- <NRadioGroup
- v-for="template in templateList"
- :key="template.title"
- :value="selectedTemplate?.title"
- >
- <NRadio
- :value="template.title"
- :disabled="!subscriptionStore.hasFeature(template.feature)"
- @change="handleTemplateSelect(template)"
- >
- <div class="flex items-center space-x-2">
- <FeatureBadge :feature="template.feature" />
- {{ template.title }}
- </div>
- </NRadio>
- </NRadioGroup>
- </div>
- </div>
-
- <div class="w-full flex flex-col justify-start items-start space-y-3 mb-3">
- <p class="text-lg font-medium !mt-4">
- {{ $t("settings.sso.form.basic-information") }}
- </p>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.name") }}
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="identityProvider.title"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- :placeholder="$t('settings.sso.form.name-description')"
- />
-
- <ResourceIdField
- ref="resourceIdField"
- class="mt-1.5"
- editing-class="mt-3"
- resource-type="idp"
- :readonly="!isCreating"
- :value="resourceId"
- :suffix="true"
- :resource-title="identityProvider.title"
- :fetch-resource="
- (id) =>
- identityProviderStore.getOrFetchIdentityProviderByName(
- `${idpNamePrefix}${id}`,
- true /* silent */
- )
- "
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.domain") }}
- </p>
- <BBTextField
- v-model:value="identityProvider.domain"
- :disabled="!allowEdit"
- class="mt-1 w-full"
- :placeholder="$t('settings.sso.form.domain-description')"
- />
- </div>
- </div>
-
- <!-- OAuth2 form group -->
- <div
- v-if="state.type === IdentityProviderType.OAUTH2"
- class="w-full flex flex-col justify-start items-start space-y-3"
- >
- <div class="w-full flex flex-col justify-start items-start">
- <p class="text-lg font-medium mt-2">
- {{ $t("settings.sso.form.identity-provider-information") }}
- </p>
- <p class="textinfolabel">
- {{
- $t("settings.sso.form.identity-provider-information-description")
- }}
- </p>
- </div>
- <IdentityProviderExternalURL v-if="isCreating" :type="state.type" />
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Client ID
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForOAuth2.clientId"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. 6655asd77895265aa110ac0d3"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Client secret
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForOAuth2.clientSecret"
- :required="isCreating"
- :disabled="!allowEdit"
- class="mt-1 w-full"
- :placeholder="
- isCreating
- ? 'e.g. 5bbezxc3972ca304de70c5d70a6aa932asd8'
- : $t('common.sensitive-placeholder')
- "
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Auth URL
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel">
- {{ $t("settings.sso.form.auth-url-description") }}
- </p>
- <BBTextField
- v-model:value="configForOAuth2.authUrl"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. https://github.com/login/oauth/authorize"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Scopes
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel">
- {{ $t("settings.sso.form.scopes-description") }}
- </p>
- <BBTextField
- v-model:value="scopesStringOfConfig"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. user"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Token URL
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel">
- {{ $t("settings.sso.form.token-url-description") }}
- </p>
- <BBTextField
- v-model:value="configForOAuth2.tokenUrl"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. https://github.com/login/oauth/access_token"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- User information URL
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel">
- {{ $t("settings.sso.form.user-info-url-description") }}
- </p>
- <BBTextField
- v-model:value="configForOAuth2.userInfoUrl"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. https://api.github.com/user"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.auth-style.self") }}
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel mt-1">
- <NRadioGroup v-model:value="configForOAuth2.authStyle">
- <NRadio
- :value="OAuth2AuthStyle.IN_PARAMS"
- :label="$t('settings.sso.form.auth-style.in-params.self')"
- />
- <NRadio
- :value="OAuth2AuthStyle.IN_HEADER"
- :label="$t('settings.sso.form.auth-style.in-header.self')"
- />
- </NRadioGroup>
- </p>
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.connection-security") }}
- </p>
- <p class="textinfolabel mt-1">
- <NCheckbox
- v-model:checked="configForOAuth2.skipTlsVerify"
- :label="$t('settings.sso.form.connection-security-skip-tls-verify')"
- :disabled="!allowEdit"
- />
- </p>
- </div>
- </div>
-
- <!-- OIDC form group -->
- <div
- v-else-if="state.type === IdentityProviderType.OIDC"
- class="w-full flex flex-col justify-start items-start space-y-3"
- >
- <div class="w-full flex flex-col justify-start items-start">
- <p class="text-lg font-medium mt-2">
- {{ $t("settings.sso.form.identity-provider-information") }}
- </p>
- <p class="textinfolabel">
- {{
- $t("settings.sso.form.identity-provider-information-description")
- }}
- </p>
- </div>
- <IdentityProviderExternalURL v-if="isCreating" :type="state.type" />
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Issuer
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForOIDC.issuer"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. https://acme.okta.com"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Client ID
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForOIDC.clientId"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. 6655asd77895265aa110ac0d3"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Client secret
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForOIDC.clientSecret"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- :placeholder="
- isCreating
- ? 'e.g. 5bbezxc3972ca304de70c5d70a6aa932asd8'
- : $t('common.sensitive-placeholder')
- "
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Scopes
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel">
- {{ $t("settings.sso.form.scopes-description") }}
- </p>
- <BBTextField
- v-model:value="scopesStringOfConfig"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. user"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.auth-style.self") }}
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel mt-1">
- <NRadioGroup v-model:value="configForOIDC.authStyle">
- <NRadio
- :value="OAuth2AuthStyle.IN_PARAMS"
- :label="$t('settings.sso.form.auth-style.in-params.self')"
- />
- <NRadio
- :value="OAuth2AuthStyle.IN_HEADER"
- :label="$t('settings.sso.form.auth-style.in-header.self')"
- />
- </NRadioGroup>
- </p>
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.connection-security") }}
- </p>
- <p class="textinfolabel mt-1">
- <NCheckbox
- v-model:checked="configForOIDC.skipTlsVerify"
- :label="$t('settings.sso.form.connection-security-skip-tls-verify')"
- :disabled="!allowEdit"
- />
- </p>
- </div>
- </div>
-
- <!-- LDAP form group -->
- <div
- v-else-if="state.type === IdentityProviderType.LDAP"
- class="w-full flex flex-col justify-start items-start space-y-3"
- >
- <div class="w-full flex flex-col justify-start items-start">
- <p class="text-lg font-medium mt-2">
- {{ $t("settings.sso.form.identity-provider-information") }}
- </p>
- <p class="textinfolabel">
- {{
- $t("settings.sso.form.identity-provider-information-description")
- }}
- </p>
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Host
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForLDAP.host"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. ldap.example.com"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Port
- <span class="text-red-600">*</span>
- </p>
- <NInputNumber
- v-model:value="configForLDAP.port"
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. 389 or 636"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Bind DN
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForLDAP.bindDn"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. uid=system,ou=Users,dc=example,dc=com"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Bind Password
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForLDAP.bindPassword"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- :placeholder="$t('common.sensitive-placeholder')"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- Base DN
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForLDAP.baseDn"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. ou=users,dc=example,dc=com"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- User Filter
- <span class="text-red-600">*</span>
- </p>
- <BBTextField
- v-model:value="configForLDAP.userFilter"
- required
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. (uid=%s)"
- />
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.security-protocol") }}
- <span class="text-red-600">*</span>
- </p>
- <p class="textinfolabel mt-1">
- <NRadioGroup v-model:value="configForLDAP.securityProtocol">
- <NRadio :value="LDAPIdentityProviderConfig_SecurityProtocol.START_TLS" label="StartTLS" />
- <NRadio :value="LDAPIdentityProviderConfig_SecurityProtocol.LDAPS" label="LDAPS" />
- <NRadio :value="LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED" label="None" />
- </NRadioGroup>
- </p>
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <p class="textlabel">
- {{ $t("settings.sso.form.connection-security") }}
- </p>
- <p class="textinfolabel mt-1">
- <NCheckbox
- v-model:checked="configForLDAP.skipTlsVerify"
- :label="$t('settings.sso.form.connection-security-skip-tls-verify')"
- :disabled="!allowEdit"
- />
- </p>
- </div>
- </div>
-
- <div class="w-full flex flex-col justify-start items-start space-y-3 mt-3">
- <div class="w-full flex flex-col justify-start items-start">
- <p class="text-lg font-medium mt-2">
- {{ $t("settings.sso.form.user-information-mapping") }}
- </p>
- <p class="textinfolabel">
- {{ $t("settings.sso.form.user-information-mapping-description") }}
- <a
- href="https://docs.bytebase.com/administration/sso/oauth2#user-information-field-mapping?source=console"
- class="normal-link text-sm inline-flex flex-row items-center"
- target="_blank"
- >
- {{ $t("common.learn-more") }}
- <heroicons-outline:external-link class="w-4 h-4" />
- </a>
- </p>
- </div>
- <div class="w-full grid grid-cols-[256px_1fr]">
- <BBTextField
- v-model:value="state.fieldMapping.identifier"
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. login"
- />
- <div class="w-full flex flex-row justify-start items-center text-sm">
- <ArrowRightIcon class="mx-2 h-auto w-4 text-gray-300" />
- <p class="flex flex-row justify-start items-center">
- {{ $t("settings.sso.form.identifier") }}
- <span class="text-red-600">*</span>
- <NTooltip>
- <template #trigger>
- <heroicons-outline:information-circle
- class="ml-1 w-4 h-auto text-blue-500"
- />
- </template>
- {{ $t("settings.sso.form.identifier-tips") }}
- </NTooltip>
- </p>
- </div>
- </div>
- <div class="w-full grid grid-cols-[256px_1fr]">
- <BBTextField
- v-model:value="state.fieldMapping.displayName"
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. name"
- />
- <div class="w-full flex flex-row justify-start items-center text-sm">
- <ArrowRightIcon class="mx-2 h-auto w-4 text-gray-300" />
- <p>
- {{ $t("settings.sso.form.display-name") }}
- </p>
- </div>
- </div>
- <div class="w-full grid grid-cols-[256px_1fr]">
- <BBTextField
- v-model:value="state.fieldMapping.phone"
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. phone"
- />
- <div class="w-full flex flex-row justify-start items-center text-sm">
- <ArrowRightIcon class="mx-2 h-auto w-4 text-gray-300" />
- <p>
- {{ $t("settings.sso.form.phone") }}
- </p>
- </div>
- </div>
- <div
- v-if="state.type === IdentityProviderType.OIDC"
- class="w-full grid grid-cols-[256px_1fr]"
- >
- <BBTextField
- v-model:value="state.fieldMapping.groups"
- :disabled="!allowEdit"
- class="mt-1 w-full"
- placeholder="e.g. groups"
- />
- <div class="w-full flex flex-row justify-start items-center text-sm">
- <ArrowRightIcon class="mx-2 h-auto w-4 text-gray-300" />
- <p>
- {{ $t("settings.sso.form.groups") }}
- </p>
- </div>
- </div>
- <div class="mt-4">
- <NButton :disabled="!allowTestConnection" @click="testConnection">
- {{ $t("identity-provider.test-connection") }}
- </NButton>
- </div>
- </div>
-
- <div
- class="mt-6 pt-4 border-t space-x-4 w-full flex flex-row justify-between items-center"
- >
- <div class="space-x-4 flex flex-row justify-start items-center">
- <template v-if="!isCreating">
- <BBButtonConfirm
- :type="'ARCHIVE'"
- :button-text="$t('settings.sso.delete')"
- :ok-text="$t('common.delete')"
- :confirm-title="$t('settings.sso.delete')"
- :confirm-description="$t('common.cannot-undo-this-action')"
- :require-confirm="true"
- @confirm="handleDeleteButtonClick"
- />
- </template>
- </div>
- <div class="space-x-3 flex flex-row justify-end items-center">
- <template v-if="isCreating">
- <NButton @click="handleCancelButtonClick">
- {{ $t("common.cancel") }}
- </NButton>
- <NButton
- type="primary"
- :disabled="!allowCreate"
- @click="handleCreateButtonClick"
- >
- {{ $t("common.create") }}
- </NButton>
- </template>
- <template v-else>
- <NButton v-if="allowUpdate" @click="handleDiscardChangesButtonClick">
- {{ $t("common.discard-changes") }}
- </NButton>
- <NButton
- type="primary"
- :disabled="!allowUpdate"
- @click="handleUpdateButtonClick"
- >
- {{ $t("common.update") }}
- </NButton>
- </template>
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { cloneDeep, head, isEqual } from "lodash-es";
-import { ArrowRightIcon } from "lucide-vue-next";
-import {
- NRadioGroup,
- NCheckbox,
- NRadio,
- NTooltip,
- NInputNumber,
- NButton,
-} from "naive-ui";
-import type { ClientError } from "nice-grpc-common";
-import { computed, reactive, ref, onMounted, watch } from "vue";
-import { useRouter } from "vue-router";
-import { BBAttention, BBButtonConfirm, BBTextField } from "@/bbkit";
-import { FeatureBadge } from "@/components/FeatureGuard";
-import ResourceIdField from "@/components/v2/Form/ResourceIdField.vue";
-import { identityProviderClient } from "@/grpcweb";
-import { WORKSPACE_ROUTE_SSO } from "@/router/dashboard/workspaceRoutes";
-import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetting";
-import { SQL_EDITOR_SETTING_GENERAL_MODULE } from "@/router/sqlEditor";
-import {
- pushNotification,
- useActuatorV1Store,
- useSubscriptionV1Store,
-} from "@/store";
-import { useIdentityProviderStore } from "@/store/modules/idp";
-import {
- getIdentityProviderResourceId,
- idpNamePrefix,
-} from "@/store/modules/v1/common";
-import type { OAuthWindowEventPayload } from "@/types";
-import {
- FieldMapping,
- IdentityProvider,
- IdentityProviderConfig,
- IdentityProviderType,
- OAuth2AuthStyle,
- OAuth2IdentityProviderConfig,
- OIDCIdentityProviderConfig,
- LDAPIdentityProviderConfig,
- LDAPIdentityProviderConfig_SecurityProtocol,
-} from "@/types/proto/v1/idp_service";
-import { PlanFeature } from "@/types/proto/v1/subscription_service";
-import type { OAuth2IdentityProviderTemplate } from "@/utils";
-import {
- hasWorkspacePermissionV2,
- identityProviderTypeToString,
- openWindowForSSO,
-} from "@/utils";
-import IdentityProviderExternalURL from "./IdentityProviderExternalURL.vue";
-
-interface IdentityProviderTemplate extends OAuth2IdentityProviderTemplate {
- feature: PlanFeature;
-}
-
-interface LocalState {
- type: IdentityProviderType;
- fieldMapping: FieldMapping;
-}
-
-const props = defineProps<{
- identityProviderName?: string;
- onCreated?: (sso: IdentityProvider) => void;
- onUpdated?: (sso: IdentityProvider) => void;
- onDeleted?: (sso: IdentityProvider) => void;
- onCanceled?: () => void;
-}>();
-
-const router = useRouter();
-const identityProviderStore = useIdentityProviderStore();
-const subscriptionStore = useSubscriptionV1Store();
-
-const state = reactive<LocalState>({
- type: IdentityProviderType.OAUTH2,
- fieldMapping: FieldMapping.fromPartial({}),
-});
-
-const identityProvider = ref<IdentityProvider>(
- IdentityProvider.fromPartial({})
-);
-const configForOAuth2 = ref<OAuth2IdentityProviderConfig>(
- OAuth2IdentityProviderConfig.fromPartial({})
-);
-const scopesStringOfConfig = ref<string>("");
-const configForOIDC = ref<OIDCIdentityProviderConfig>(
- OIDCIdentityProviderConfig.fromPartial({})
-);
-const configForLDAP = ref<LDAPIdentityProviderConfig>(
- LDAPIdentityProviderConfig.fromPartial({
- port: 389,
- securityProtocol: LDAPIdentityProviderConfig_SecurityProtocol.START_TLS,
- })
-);
-const resourceIdField = ref<InstanceType<typeof ResourceIdField>>();
-const selectedTemplate = ref<IdentityProviderTemplate>();
-
-const currentIdentityProvider = computed(() => {
- return identityProviderStore.getIdentityProviderByName(
- props.identityProviderName || ""
- );
-});
-
-const identityProviderTypeList = computed(() => {
- return [
- {
- type: IdentityProviderType.OAUTH2,
- feature: PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO,
- },
- {
- type: IdentityProviderType.OIDC,
- feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
- },
- {
- type: IdentityProviderType.LDAP,
- feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
- },
- ];
-});
-
-const configureSetting = () => {
- router.push({
- name: router.currentRoute.value.name?.toString().startsWith("sql-editor")
- ? SQL_EDITOR_SETTING_GENERAL_MODULE
- : SETTING_ROUTE_WORKSPACE_GENERAL,
- });
-};
-
-const externalUrl = computed(
- () => useActuatorV1Store().serverInfo?.externalUrl ?? ""
-);
-
-const isCreating = computed(() => {
- return currentIdentityProvider.value === undefined;
-});
-
-const resourceId = computed(() => {
- return isCreating.value
- ? ""
- : getIdentityProviderResourceId(identityProvider.value.name);
-});
-
-const userDocLink = computed(() => {
- if (state.type === IdentityProviderType.OAUTH2) {
- return "https://docs.bytebase.com/administration/sso/oauth2?source=console";
- } else if (state.type === IdentityProviderType.OIDC) {
- return "https://docs.bytebase.com/administration/sso/oidc?source=console";
- } else if (state.type === IdentityProviderType.LDAP) {
- return "https://docs.bytebase.com/administration/sso/ldap?source=console";
- }
- return "";
-});
-
-const identityProviderTemplateList = computed(
- (): IdentityProviderTemplate[] => {
- return [
- {
- title: "Google",
- name: "",
- domain: "google.com",
- type: IdentityProviderType.OAUTH2,
- feature: PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO,
- config: {
- clientId: "",
- clientSecret: "",
- authUrl: "https://accounts.google.com/o/oauth2/v2/auth",
- tokenUrl: "https://oauth2.googleapis.com/token",
- userInfoUrl: "https://www.googleapis.com/oauth2/v2/userinfo",
- scopes: [
- "https://www.googleapis.com/auth/userinfo.email",
- "https://www.googleapis.com/auth/userinfo.profile",
- ],
- skipTlsVerify: false,
- authStyle: OAuth2AuthStyle.IN_PARAMS,
- fieldMapping: {
- identifier: "email",
- displayName: "name",
- phone: "",
- groups: "",
- },
- },
- },
- {
- title: "GitHub",
- name: "",
- domain: "github.com",
- type: IdentityProviderType.OAUTH2,
- feature: PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO,
- config: {
- clientId: "",
- clientSecret: "",
- authUrl: "https://github.com/login/oauth/authorize",
- tokenUrl: "https://github.com/login/oauth/access_token",
- userInfoUrl: "https://api.github.com/user",
- scopes: ["user"],
- skipTlsVerify: false,
- authStyle: OAuth2AuthStyle.IN_PARAMS,
- fieldMapping: {
- identifier: "email",
- displayName: "name",
- phone: "",
- groups: "",
- },
- },
- },
- {
- title: "GitLab",
- name: "",
- domain: "gitlab.com",
- type: IdentityProviderType.OAUTH2,
- feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
- config: {
- clientId: "",
- clientSecret: "",
- authUrl: "https://gitlab.com/oauth/authorize",
- tokenUrl: "https://gitlab.com/oauth/token",
- userInfoUrl: "https://gitlab.com/api/v4/user",
- scopes: ["read_user"],
- skipTlsVerify: false,
- authStyle: OAuth2AuthStyle.IN_PARAMS,
- fieldMapping: {
- identifier: "email",
- displayName: "name",
- phone: "",
- groups: "",
- },
- },
- },
- {
- title: "Microsoft Entra",
- name: "",
- domain: "",
- type: IdentityProviderType.OAUTH2,
- feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
- config: {
- clientId: "",
- clientSecret: "",
- authUrl:
- "https://login.microsoftonline.com/{uuid}/oauth2/v2.0/authorize",
- tokenUrl:
- "https://login.microsoftonline.com/{uuid}/oauth2/v2.0/token",
- userInfoUrl: "https://graph.microsoft.com/v1.0/me",
- scopes: ["user.read"],
- skipTlsVerify: false,
- authStyle: OAuth2AuthStyle.IN_PARAMS,
- fieldMapping: {
- identifier: "userPrincipalName",
- displayName: "displayName",
- phone: "",
- groups: "",
- },
- },
- },
- {
- title: "Custom",
- name: "",
- domain: "",
- type: IdentityProviderType.OAUTH2,
- feature: PlanFeature.FEATURE_ENTERPRISE_SSO,
- config: {
- clientId: "",
- clientSecret: "",
- authUrl: "",
- tokenUrl: "",
- userInfoUrl: "",
- scopes: [],
- skipTlsVerify: false,
- authStyle: OAuth2AuthStyle.IN_PARAMS,
- fieldMapping: {
- identifier: "",
- displayName: "",
- phone: "",
- groups: "",
- },
- },
- },
- ];
- }
-);
-
-const templateList = computed(() => {
- if (state.type === IdentityProviderType.OAUTH2) {
- return identityProviderTemplateList.value.filter(
- (template) => template.type === IdentityProviderType.OAUTH2
- );
- }
- return [];
-});
-
-const originIdentityProvider = computed(() => {
- return identityProviderStore.getIdentityProviderByName(
- props.identityProviderName || ""
- );
-});
-
-const isFormCompleted = computed(() => {
- if (!identityProvider.value.title) {
- return false;
- }
- if (!state.fieldMapping.identifier) {
- return false;
- }
-
- if (state.type === IdentityProviderType.OAUTH2) {
- if (
- !configForOAuth2.value.clientId ||
- !configForOAuth2.value.authUrl ||
- !configForOAuth2.value.tokenUrl ||
- !configForOAuth2.value.userInfoUrl ||
- // Only request client secret when creating.
- (isCreating.value && !configForOAuth2.value.clientSecret)
- ) {
- return false;
- }
- } else if (state.type === IdentityProviderType.OIDC) {
- if (
- !configForOIDC.value.clientId ||
- !configForOIDC.value.issuer ||
- (isCreating.value && !configForOIDC.value.clientSecret)
- ) {
- return false;
- }
- } else if (state.type === IdentityProviderType.LDAP) {
- if (
- !configForLDAP.value.host ||
- !configForLDAP.value.port ||
- !configForLDAP.value.bindDn ||
- !configForLDAP.value.baseDn ||
- !configForLDAP.value.userFilter ||
- (isCreating.value && !configForLDAP.value.bindPassword)
- ) {
- return false;
- }
- } else {
- return false;
- }
-
- return true;
-});
-
-const allowEdit = computed(() => {
- if (isCreating.value) {
- return hasWorkspacePermissionV2("bb.identityProviders.create");
- }
- return hasWorkspacePermissionV2("bb.identityProviders.update");
-});
-
-const allowCreate = computed(() => {
- if (
- !isFormCompleted.value ||
- !resourceIdField.value?.resourceId ||
- !resourceIdField.value?.isValidated
- ) {
- return false;
- }
- return true;
-});
-
-const allowTestConnection = computed(() => {
- if (
- state.type === IdentityProviderType.OAUTH2 ||
- state.type === IdentityProviderType.OIDC ||
- state.type === IdentityProviderType.LDAP
- ) {
- if (isFormCompleted.value) {
- return true;
- }
- }
- return false;
-});
-
-const editedIdentityProvider = computed(() => {
- const tempIdentityProvider: IdentityProvider = {
- ...identityProvider.value,
- type: state.type,
- name:
- identityProvider.value.name ||
- (resourceIdField.value?.resourceId as string),
- config: IdentityProviderConfig.fromPartial({}),
- };
- if (tempIdentityProvider.type === IdentityProviderType.OAUTH2) {
- tempIdentityProvider.config!.oauth2Config = {
- ...configForOAuth2.value,
- scopes: scopesStringOfConfig.value.split(" "),
- fieldMapping: FieldMapping.fromPartial(state.fieldMapping),
- };
- } else if (tempIdentityProvider.type === IdentityProviderType.OIDC) {
- tempIdentityProvider.config!.oidcConfig = {
- ...configForOIDC.value,
- scopes: scopesStringOfConfig.value.split(" "),
- fieldMapping: FieldMapping.fromPartial(state.fieldMapping),
- };
- } else if (tempIdentityProvider.type === IdentityProviderType.LDAP) {
- tempIdentityProvider.config!.ldapConfig = {
- ...configForLDAP.value,
- fieldMapping: FieldMapping.fromPartial(state.fieldMapping),
- };
- } else {
- throw new Error(`identity provider type ${state.type} is invalid`);
- }
- return tempIdentityProvider;
-});
-
-const allowUpdate = computed(() => {
- if (!isFormCompleted.value) {
- return false;
- }
- if (isEqual(editedIdentityProvider.value, originIdentityProvider.value)) {
- return false;
- }
- return true;
-});
-
-onMounted(async () => {
- if (originIdentityProvider.value) {
- updateEditState(originIdentityProvider.value);
- }
-});
-
-const loginWithIdentityProviderEventListener = async (event: Event) => {
- const payload = (event as CustomEvent).detail as OAuthWindowEventPayload;
- if (payload.error) {
- return;
- }
-
- const code = payload.code;
- try {
- await identityProviderClient.testIdentityProvider({
- identityProvider: editedIdentityProvider.value,
- oauth2Context: {
- code: code,
- },
- });
- } catch (error) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: `Request error occurred`,
- description: (error as ClientError).details,
- });
- return;
- }
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: "Test connection succeed",
- });
-};
-
-const testConnection = async () => {
- if (
- state.type === IdentityProviderType.OAUTH2 ||
- state.type === IdentityProviderType.OIDC
- ) {
- let idpForTesting = editedIdentityProvider.value;
- // For OIDC, we need to obtain the auth endpoint from the issuer in backend.
- if (isCreating.value && idpForTesting.type === IdentityProviderType.OIDC) {
- idpForTesting = await identityProviderClient.createIdentityProvider({
- identityProviderId: idpForTesting.name,
- identityProvider: idpForTesting,
- validateOnly: true,
- });
- }
- try {
- await openWindowForSSO(idpForTesting);
- } catch (error) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: `Request error occurred`,
- description: (error as any).message,
- });
- }
- } else if (state.type === IdentityProviderType.LDAP) {
- try {
- await identityProviderClient.testIdentityProvider({
- identityProvider: editedIdentityProvider.value,
- });
- } catch (error) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: `Request error occurred`,
- description: (error as ClientError).details,
- });
- return;
- }
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: "Test connection succeed",
- });
- }
-};
-
-const handleTemplateSelect = (template: IdentityProviderTemplate) => {
- if (template.type !== state.type) {
- return;
- }
-
- selectedTemplate.value = template;
- identityProvider.value.title = template.title;
- identityProvider.value.domain = template.domain;
- if (template.type === IdentityProviderType.OAUTH2) {
- configForOAuth2.value = {
- ...configForOAuth2.value,
- ...template.config,
- };
- state.fieldMapping = FieldMapping.fromPartial(
- template.config.fieldMapping || {}
- );
- scopesStringOfConfig.value = template.config.scopes.join(" ");
- }
-};
-
-const handleDeleteButtonClick = async () => {
- if (!currentIdentityProvider.value) {
- return;
- }
- if (!hasWorkspacePermissionV2("bb.identityProviders.delete")) {
- pushNotification({
- module: "bytebase",
- style: "WARN",
- title: "Permission denied",
- });
- return;
- }
-
- await identityProviderStore.deleteIdentityProvider(
- currentIdentityProvider.value.name
- );
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: "Archive SSO succeed",
- });
- if (props.onDeleted) {
- props.onDeleted(currentIdentityProvider.value);
- return;
- }
- router.push({
- name: WORKSPACE_ROUTE_SSO,
- });
-};
-
-const handleCancelButtonClick = () => {
- if (props.onCanceled) {
- props.onCanceled();
- return;
- }
- router.push({
- name: WORKSPACE_ROUTE_SSO,
- });
-};
-
-const updateEditState = (updatedIdentityProvider: IdentityProvider) => {
- const tempIdentityProvider = cloneDeep(updatedIdentityProvider);
- identityProvider.value = tempIdentityProvider;
- state.type = tempIdentityProvider.type;
- if (tempIdentityProvider.type === IdentityProviderType.OAUTH2) {
- state.fieldMapping =
- tempIdentityProvider.config?.oauth2Config?.fieldMapping ??
- FieldMapping.fromPartial({});
- configForOAuth2.value =
- tempIdentityProvider.config?.oauth2Config ||
- OAuth2IdentityProviderConfig.fromPartial({});
- scopesStringOfConfig.value = configForOAuth2.value.scopes.join(" ");
- } else if (tempIdentityProvider.type === IdentityProviderType.OIDC) {
- state.fieldMapping =
- tempIdentityProvider.config?.oidcConfig?.fieldMapping ??
- FieldMapping.fromPartial({});
- configForOIDC.value =
- tempIdentityProvider.config?.oidcConfig ||
- OIDCIdentityProviderConfig.fromPartial({});
- scopesStringOfConfig.value = configForOIDC.value.scopes.join(" ");
- } else if (tempIdentityProvider.type === IdentityProviderType.LDAP) {
- state.fieldMapping =
- tempIdentityProvider.config?.ldapConfig?.fieldMapping ??
- FieldMapping.fromPartial({});
- configForLDAP.value =
- tempIdentityProvider.config?.ldapConfig ||
- LDAPIdentityProviderConfig.fromPartial({});
- }
-};
-
-const handleDiscardChangesButtonClick = async () => {
- if (originIdentityProvider.value) {
- updateEditState(originIdentityProvider.value);
- }
-};
-
-const handleCreateButtonClick = async () => {
- const created = await identityProviderStore.createIdentityProvider(
- editedIdentityProvider.value
- );
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: "Create SSO succeed",
- });
- if (props.onCreated) {
- props.onCreated(created);
- return;
- }
- router.push({
- name: WORKSPACE_ROUTE_SSO,
- });
-};
-
-const handleUpdateButtonClick = async () => {
- const updatedIdentityProvider =
- await identityProviderStore.patchIdentityProvider(
- editedIdentityProvider.value
- );
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: "Update SSO succeed",
- });
- updateEditState(updatedIdentityProvider);
- if (props.onUpdated) {
- props.onUpdated(updatedIdentityProvider);
- }
-};
-
-watch(
- () => state.type,
- () => {
- if (!isCreating.value) {
- return;
- }
- if (state.type === IdentityProviderType.OAUTH2) {
- if (!selectedTemplate.value) {
- selectedTemplate.value = head(templateList.value);
- }
- if (selectedTemplate.value) {
- handleTemplateSelect(
- selectedTemplate.value as IdentityProviderTemplate
- );
- }
- } else if (
- state.type === IdentityProviderType.OIDC ||
- state.type === IdentityProviderType.LDAP
- ) {
- // NOTE: We do not yet have templates for OIDC nor LDAP providers so resetting
- // leftover values when we switch from other provider types to not confuse users.
- identityProvider.value.title = "";
- identityProvider.value.name = "";
- identityProvider.value.domain = "";
-
- if (state.type === IdentityProviderType.OIDC) {
- // Default is a list of scopes that are part of OIDC standard claims, see
- // https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes#standard-claims.
- scopesStringOfConfig.value = "openid profile email";
- }
- }
- },
- {
- immediate: true,
- }
-);
-
-watch(
- () => editedIdentityProvider.value.name,
- (newName, oldName) => {
- if (
- state.type === IdentityProviderType.OAUTH2 ||
- state.type === IdentityProviderType.OIDC
- ) {
- window.removeEventListener(
- `bb.oauth.signin.${oldName}`,
- loginWithIdentityProviderEventListener,
- false
- );
- window.addEventListener(
- `bb.oauth.signin.${newName}`,
- loginWithIdentityProviderEventListener,
- false
- );
- }
- },
- {
- immediate: true,
- }
-);
-</script>
diff --git a/frontend/src/components/SSO/IdentityProviderExternalURL.vue b/frontend/src/components/SSO/IdentityProviderExternalURL.vue
deleted file mode 100644
index 4345992235..0000000000
--- a/frontend/src/components/SSO/IdentityProviderExternalURL.vue
+++ /dev/null
@@ -1,71 +0,0 @@
-<template>
- <div
- class="w-auto max-w-full p-4 rounded flex flex-col justify-start items-start border"
- >
- <p class="textinfolabel flex flex-row justify-start items-center mb-2">
- {{ $t("settings.sso.form.identity-provider-needed-information") }}
- <ShowMoreIcon
- class="ml-1 mr-2"
- :content="$t('settings.sso.form.redirect-url-description')"
- />
- </p>
- <div class="flex flex-row justify-start items-center space-x-4">
- <p class="textlabel my-auto text-right whitespace-nowrap">
- {{ $t("settings.sso.form.redirect-url") }}
- </p>
- <div class="w-full relative break-all pr-8 text-sm">
- <div class="bg-gray-100 p-1 border border-gray-300 rounded">
- {{ redirectUrl }}
- </div>
- <button
- tabindex="-1"
- class="absolute right-0 top-1/2 -translate-y-1/2 p-1 text-control-light rounded hover:bg-gray-100"
- @click.prevent="copyRedirectUrl"
- >
- <heroicons-outline:clipboard class="w-5 h-5" />
- </button>
- </div>
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { pushNotification, useActuatorV1Store } from "@/store";
-import { IdentityProviderType } from "@/types/proto/v1/idp_service";
-import { toClipboard } from "@/utils";
-import ShowMoreIcon from "../ShowMoreIcon.vue";
-
-const props = defineProps<{
- type: IdentityProviderType;
-}>();
-
-const { t } = useI18n();
-
-const externalUrl = computed(
- () => useActuatorV1Store().serverInfo?.externalUrl ?? ""
-);
-
-const redirectUrl = computed(() => {
- const url = externalUrl.value || window.origin;
- switch (props.type) {
- case IdentityProviderType.OAUTH2:
- return `${url}/oauth/callback`;
- case IdentityProviderType.OIDC:
- return `${url}/oidc/callback`;
- default:
- return "";
- }
-});
-
-const copyRedirectUrl = () => {
- toClipboard(redirectUrl.value).then(() => {
- pushNotification({
- module: "bytebase",
- style: "INFO",
- title: t("settings.sso.copy-redirect-url"),
- });
- });
-};
-</script>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 2675f22237..982873b842 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -436,26 +436,25 @@
"delete": "Delete this SSO",
"form": {
"type": "Type",
- "learn-more-with-user-doc": "Learn more about the configuration",
+ "type-description": "Choose the type of identity provider you want to configure",
+ "oauth2-description": "Connect with OAuth 2.0 providers like Google, GitHub, GitLab",
+ "oidc-description": "Connect with OpenID Connect providers like Microsoft Entra ID (Azure AD), Okta, Auth0",
+ "ldap-description": "Connect with LDAP providers like Microsoft Active Directory, OpenLDAP",
"redirect-url": "Authorization redirect URL",
"redirect-url-description": "It will be used to fill in the appropriate field in the identity provider application form.",
"use-template": "Use template",
- "basic-information": "Basic information",
+ "template-description": "Choose a pre-configured template or set up a custom OAuth 2.0 provider",
"name": "Name",
"name-description": "The display name to be shown to the users",
"resource-id": "Resource ID",
"domain": "Domain",
"domain-description": "The identity provider's domain name",
- "identity-provider-information": "Identity provider information",
- "identity-provider-information-description": "The information is provided by your identity provider.",
"identity-provider-needed-information": "Create your SSO application with the following information.",
"auth-url-description": "The link to OAuth login page",
"scopes-description": "A space-separated list of scopes to be carried when accessing the Auth URL",
"token-url-description": "The API address for obtaining accessToken",
"user-info-url-description": "The API address for obtaining user information by accessToken",
- "security-protocol": "Security protocol",
- "connection-security": "Connection security",
- "connection-security-skip-tls-verify": "Skip TLS verify",
+ "security-protocol": "Security Protocol",
"user-information-mapping": "User information mapping",
"user-information-mapping-description": "Maps the field names from user info API to the Bytebase user.",
"identifier": "Bytebase user's email",
@@ -463,15 +462,59 @@
"display-name": "Bytebase user's display name",
"phone": "Bytebase user's phone number",
"groups": "Bytebase user's groups",
- "auth-style": {
- "self": "Auth style",
- "in-params": {
- "self": "In params"
- },
- "in-header": {
- "self": "In header"
- }
- }
+ "general-setting-description": "Provide basic information about your identity provider.",
+ "configuration": "Configuration",
+ "configuration-description": "Configure the connection settings for your identity provider",
+ "auth-url": "Authorization URL",
+ "auth-url-placeholder": "e.g. https://github.com/login/oauth/authorize",
+ "token-url": "Token URL",
+ "token-url-placeholder": "e.g. https://github.com/login/oauth/access_token",
+ "user-info-url": "User Information URL",
+ "user-info-url-placeholder": "e.g. https://api.github.com/user",
+ "scopes": "Scopes",
+ "scopes-placeholder": "e.g. user email profile",
+ "scopes-placeholder-oidc": "e.g. openid profile email",
+ "authentication-style": "Authentication Style",
+ "in-parameters": "In Parameters",
+ "in-parameters-description": "Send credentials in POST body (recommended)",
+ "in-header": "In Header",
+ "in-header-description": "Send credentials using HTTP Basic Authorization",
+ "security-options": "Security Options",
+ "skip-tls-verification": "Skip TLS Certificate Verification",
+ "skip-tls-warning": "Only enable this for development or testing purposes",
+ "issuer-url-placeholder": "e.g. https://acme.okta.com",
+ "issuer-url-description": "The OIDC issuer URL (well-known configuration will be auto-discovered)",
+ "openid-scopes-description": "Space-separated list of OIDC scopes (openid is required)",
+ "host-placeholder": "e.g. ldap.example.com",
+ "bind-dn": "Bind DN",
+ "bind-dn-placeholder": "e.g. uid=system,ou=Users,dc=example,dc=com",
+ "bind-dn-description": "The DN of the user to bind as for search requests",
+ "bind-password": "Bind Password",
+ "base-dn": "Base DN",
+ "base-dn-placeholder": "e.g. ou=users,dc=example,dc=com",
+ "base-dn-description": "The base DN to search for users",
+ "user-filter": "User Filter",
+ "user-filter-placeholder": "e.g. (uid=%s)",
+ "user-filter-description": "The filter to search for users (%s will be replaced with username)",
+ "starttls": "StartTLS",
+ "starttls-description": "Upgrade connection to TLS (recommended)",
+ "ldaps": "LDAPS",
+ "ldaps-description": "Use TLS from the beginning (port 636)",
+ "none": "None",
+ "none-description": "No encryption (not recommended for production)",
+ "resource-id-readonly-hint": "Resource ID cannot be changed after creation",
+ "domain-optional-hint": "Optional: Restrict access to users from this domain",
+ "provider-type-readonly-hint": "Provider type cannot be changed after creation",
+ "identifier-placeholder": "e.g. login, email",
+ "display-name-placeholder": "e.g. name, displayName",
+ "phone-placeholder": "e.g. phone, mobile",
+ "groups-placeholder": "e.g. groups",
+ "groups-description": "Used for group-based access control (OIDC providers only)",
+ "google-template-description": "Sign in with Google accounts",
+ "github-template-description": "Sign in with GitHub accounts",
+ "gitlab-template-description": "Sign in with GitLab accounts",
+ "microsoft-entra-template-description": "Sign in with Microsoft Entra ID",
+ "custom-template-description": "Configure custom OAuth 2.0 provider"
},
"copy-redirect-url": "Redirect URL copied to clipboard."
},
@@ -2250,7 +2293,13 @@
"fit-content-with-view": "Fit content within view"
},
"identity-provider": {
- "test-connection": "Test Connection"
+ "test-connection": "Test Connection",
+ "identity-provider-created": "Identity provider created successfully",
+ "identity-provider-deleted": "Identity provider deleted successfully",
+ "identity-provider-update-failed": "Failed to update identity provider",
+ "identity-provider-create-failed": "Failed to create identity provider",
+ "identity-provider-delete-failed": "Failed to delete identity provider",
+ "identity-provider-permission-denied": "Permission denied"
},
"sensitive-data": {
"self": "Sensitive Data"
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 4e51831291..94089da4fa 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -436,26 +436,25 @@
"delete": "Eliminar este SSO",
"form": {
"type": "Tipo",
- "learn-more-with-user-doc": "Obtenga más información sobre la configuración",
+ "type-description": "Elija el tipo de proveedor de identidad que desea configurar",
+ "oauth2-description": "Conéctese con proveedores de OAuth 2.0 como Google, GitHub, GitLab",
+ "oidc-description": "Conéctese con proveedores de OpenID Connect como Microsoft Entra ID (Azure AD), Okta, Auth0",
+ "ldap-description": "Conéctese con proveedores LDAP como Microsoft Active Directory, OpenLDAP",
"redirect-url": "URL de redireccionamiento de autorización",
"redirect-url-description": "Se utilizará para completar el campo correspondiente en el formulario de la aplicación del proveedor de identidad.",
"use-template": "Usar plantilla",
- "basic-information": "Información básica",
+ "template-description": "Elija una plantilla preconfigurada o configure un proveedor OAuth 2.0 personalizado",
"name": "Nombre",
"name-description": "El nombre de visualización que se mostrará a los usuarios",
"resource-id": "ID de recurso",
"domain": "Dominio",
"domain-description": "El nombre de dominio del proveedor de identidad",
- "identity-provider-information": "Información del proveedor de identidad",
- "identity-provider-information-description": "La información es proporcionada por su proveedor de identidad.",
"identity-provider-needed-information": "Cree su aplicación SSO con la siguiente información.",
"auth-url-description": "El enlace a la página de inicio de sesión de OAuth",
"scopes-description": "Una lista separada por espacios de ámbitos que se llevarán al acceder a la URL de autenticación",
"token-url-description": "La dirección API para obtener el token de acceso",
"user-info-url-description": "La dirección API para obtener la información del usuario mediante el token de acceso",
"security-protocol": "Protocolo de seguridad",
- "connection-security": "Seguridad de la conexión",
- "connection-security-skip-tls-verify": "Omitir verificación TLS",
"user-information-mapping": "Mapeo de información del usuario",
"user-information-mapping-description": "Mapea los nombres de campo de la API de información del usuario al usuario Bytebase.",
"identifier": "Correo electrónico de usuario de Bytebase",
@@ -463,15 +462,59 @@
"display-name": "Nombre para mostrar de usuario de Bytebase",
"phone": "Número de teléfono de usuario de Bytebase",
"groups": "Grupos de usuarios de Bytebase",
- "auth-style": {
- "self": "Estilo de autenticación",
- "in-params": {
- "self": "En parámetros"
- },
- "in-header": {
- "self": "En encabezado"
- }
- }
+ "general-setting-description": "Proporcione información básica sobre su proveedor de identidad.",
+ "configuration": "Configuración",
+ "configuration-description": "Configure los ajustes de conexión para su proveedor de identidad",
+ "auth-url": "URL de autorización",
+ "auth-url-placeholder": "p.ej. https://github.com/login/oauth/authorize",
+ "token-url": "URL del token",
+ "token-url-placeholder": "p.ej. https://github.com/login/oauth/access_token",
+ "user-info-url": "URL de información del usuario",
+ "user-info-url-placeholder": "p.ej. https://api.github.com/user",
+ "scopes": "Ámbitos",
+ "scopes-placeholder": "p. ej. perfil de correo electrónico del usuario",
+ "scopes-placeholder-oidc": "p. ej. correo electrónico del perfil de OpenID",
+ "authentication-style": "Estilo de autenticación",
+ "in-parameters": "En parámetros",
+ "in-parameters-description": "Enviar credenciales en el cuerpo del POST (recomendado)",
+ "in-header": "En el encabezado",
+ "in-header-description": "Enviar credenciales mediante la autorización básica HTTP",
+ "security-options": "Opciones de seguridad",
+ "skip-tls-verification": "Omitir la verificación del certificado TLS",
+ "skip-tls-warning": "Habilite esto solo para fines de desarrollo o prueba",
+ "issuer-url-placeholder": "p. ej. https://acme.okta.com",
+ "issuer-url-description": "La URL del emisor de OIDC (la configuración conocida se descubrirá automáticamente)",
+ "openid-scopes-description": "Lista separada por espacios de ámbitos OIDC (se requiere openid)",
+ "host-placeholder": "p. ej. ldap.example.com",
+ "bind-dn": "Vincular DN",
+ "bind-dn-placeholder": "p.ej. uid=sistema,ou=Usuarios,dc=ejemplo,dc=com",
+ "bind-dn-description": "El DN del usuario al que se vinculará para las solicitudes de búsqueda",
+ "bind-password": "Vincular contraseña",
+ "base-dn": "DN base",
+ "base-dn-placeholder": "p.ej. ou=usuarios,dc=ejemplo,dc=com",
+ "base-dn-description": "El DN base para buscar usuarios",
+ "user-filter": "Filtro de usuario",
+ "user-filter-placeholder": "p. ej. (uid=%s)",
+ "user-filter-description": "El filtro para buscar usuarios (%s será reemplazado por el nombre de usuario)",
+ "starttls": "StartTLS",
+ "starttls-description": "Actualizar la conexión a TLS (recomendado)",
+ "ldaps": "LDAPS",
+ "ldaps-description": "Utilice TLS desde el principio (puerto 636)",
+ "none": "Ninguno",
+ "none-description": "Sin cifrado (no recomendado para producción)",
+ "resource-id-readonly-hint": "El ID del recurso no se puede cambiar después de su creación",
+ "domain-optional-hint": "Opcional: Restringir el acceso a los usuarios de este dominio",
+ "provider-type-readonly-hint": "El tipo de proveedor no se puede cambiar después de la creación",
+ "identifier-placeholder": "p. ej. inicio de sesión, correo electrónico",
+ "display-name-placeholder": "p. ej. nombre, nombre para mostrar",
+ "phone-placeholder": "p. ej. teléfono, móvil",
+ "groups-placeholder": "p. ej. grupos",
+ "groups-description": "Se utiliza para el control de acceso basado en grupos (solo proveedores de OIDC)",
+ "google-template-description": "Iniciar sesión con cuentas de Google",
+ "github-template-description": "Iniciar sesión con cuentas de GitHub",
+ "gitlab-template-description": "Iniciar sesión con cuentas de GitLab",
+ "microsoft-entra-template-description": "Iniciar sesión con el ID de Microsoft Entra",
+ "custom-template-description": "Configurar un proveedor OAuth 2.0 personalizado"
},
"copy-redirect-url": "URL de redireccionamiento copiada al portapapeles."
},
@@ -2250,7 +2293,13 @@
"fit-content-with-view": "Ajustar contenido dentro de la vista"
},
"identity-provider": {
- "test-connection": "Probar conexión"
+ "test-connection": "Probar conexión",
+ "identity-provider-created": "Proveedor de identidad creado exitosamente",
+ "identity-provider-deleted": "Proveedor de identidad eliminado exitosamente",
+ "identity-provider-update-failed": "No se pudo actualizar el proveedor de identidad",
+ "identity-provider-create-failed": "No se pudo crear el proveedor de identidad",
+ "identity-provider-delete-failed": "No se pudo eliminar el proveedor de identidad",
+ "identity-provider-permission-denied": "Permiso denegado"
},
"sensitive-data": {
"self": "Datos Sensibles"
@@ -2737,4 +2786,4 @@
"last-visit": "Última visita",
"changelog-for-version": "Registro de cambios para {version}"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index c4814a73b3..82f1178e5e 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -436,26 +436,25 @@
"delete": "この SSO を削除する",
"form": {
"type": "タイプ",
- "learn-more-with-user-doc": "設定方法の詳細については、こちらをご覧ください",
+ "type-description": "設定するIDプロバイダーの種類を選択します",
+ "oauth2-description": "Google、GitHub、GitLabなどのOAuth 2.0プロバイダーと接続する",
+ "oidc-description": "Microsoft Entra ID (Azure AD)、Okta、Auth0 などの OpenID Connect プロバイダーと接続します。",
+ "ldap-description": "Microsoft Active Directory、OpenLDAPなどのLDAPプロバイダーに接続します",
"redirect-url": "コールバックアドレス",
"redirect-url-description": "ID プロバイダー要求フォームの対応するフィールドに入力するために使用されます。",
"use-template": "テンプレートを使用する",
- "basic-information": "基本情報",
+ "template-description": "事前設定されたテンプレートを選択するか、カスタムのOAuth 2.0プロバイダーを設定します",
"name": "名前",
"name-description": "ログインユーザーに表示される名前",
"resource-id": "リソースID",
"domain": "ドメイン名",
"domain-description": "OAuthプロバイダーのドメイン名",
- "identity-provider-information": "ID プロバイダー情報",
- "identity-provider-information-description": "この情報は ID プロバイダーによって提供されます。",
"identity-provider-needed-information": "次の情報を使用して SSO アプリケーションを作成します。",
"auth-url-description": "ログインページへのリンク",
"scopes-description": "認証 URL にアクセスするときに渡される範囲パラメーター。複数の値を区切るにはスペースを使用します。",
"token-url-description": "accessTokenの取得に使用するAPIアドレス",
"user-info-url-description": "accessTokenによるユーザー情報の取得に使用するAPIアドレス",
"security-protocol": "セキュリティプロトコル",
- "connection-security": "セキュリティオプション",
- "connection-security-skip-tls-verify": "証明書の検証をスキップする",
"user-information-mapping": "ユーザー情報のマッピング",
"user-information-mapping-description": "フィールド マップには、API ユーザー情報のフィールド名が保持されます。",
"identifier": "バイトベースユーザーの電子メールアドレス",
@@ -463,15 +462,59 @@
"display-name": "バイトベースユーザーのニックネーム",
"phone": "Bytebase ユーザーの携帯電話番号",
"groups": "Bytebaseユーザーグループ",
- "auth-style": {
- "self": "認証パラメータの引き渡し方法",
- "in-params": {
- "self": "リクエストパラメータ経由"
- },
- "in-header": {
- "self": "リクエストヘッダー経由"
- }
- }
+ "general-setting-description": "ID プロバイダーに関する基本情報を提供します。",
+ "configuration": "構成",
+ "configuration-description": "IDプロバイダーの接続設定を構成する",
+ "auth-url": "認証URL",
+ "auth-url-placeholder": "例えばhttps://github.com/login/oauth/authorize",
+ "token-url": "トークンURL",
+ "token-url-placeholder": "例えばhttps://github.com/login/oauth/access_token",
+ "user-info-url": "ユーザー情報URL",
+ "user-info-url-placeholder": "例えばhttps://api.github.com/user",
+ "scopes": "スコープ",
+ "scopes-placeholder": "例: ユーザーのメールプロフィール",
+ "scopes-placeholder-oidc": "例:OpenIDプロファイルメール",
+ "authentication-style": "認証スタイル",
+ "in-parameters": "パラメータ",
+ "in-parameters-description": "POST 本文で資格情報を送信する(推奨)",
+ "in-header": "ヘッダー内",
+ "in-header-description": "HTTP 基本認証を使用して資格情報を送信する",
+ "security-options": "セキュリティオプション",
+ "skip-tls-verification": "TLS証明書の検証をスキップする",
+ "skip-tls-warning": "開発またはテストの目的でのみ有効にしてください",
+ "issuer-url-placeholder": "例: https://acme.okta.com",
+ "issuer-url-description": "OIDC 発行者 URL (既知の構成は自動的に検出されます)",
+ "openid-scopes-description": "OIDC スコープのスペース区切りリスト (openid は必須)",
+ "host-placeholder": "例: ldap.example.com",
+ "bind-dn": "バインドDN",
+ "bind-dn-placeholder": "例えばuid=システム、ou=ユーザー、dc=example、dc=com",
+ "bind-dn-description": "検索リクエストにバインドするユーザーのDN",
+ "bind-password": "パスワードをバインドする",
+ "base-dn": "ベースDN",
+ "base-dn-placeholder": "例えばou=ユーザー、dc=例、dc=com",
+ "base-dn-description": "ユーザーを検索するためのベースDN",
+ "user-filter": "ユーザーフィルター",
+ "user-filter-placeholder": "例: (uid=%s)",
+ "user-filter-description": "ユーザーを検索するためのフィルター (%s はユーザー名に置き換えられます)",
+ "starttls": "TLS を開始",
+ "starttls-description": "接続を TLS にアップグレードする (推奨)",
+ "ldaps": "LDAP",
+ "ldaps-description": "最初から TLS を使用する (ポート 636)",
+ "none": "なし",
+ "none-description": "暗号化なし(本番環境では推奨されません)",
+ "resource-id-readonly-hint": "リソースIDは作成後に変更できません",
+ "domain-optional-hint": "オプション: このドメインのユーザーへのアクセスを制限する",
+ "provider-type-readonly-hint": "プロバイダタイプは作成後に変更できません",
+ "identifier-placeholder": "例:ログイン、メール",
+ "display-name-placeholder": "例: name、displayName",
+ "phone-placeholder": "例:電話、携帯電話",
+ "groups-placeholder": "例:グループ",
+ "groups-description": "グループベースのアクセス制御に使用されます(OIDC プロバイダーのみ)",
+ "google-template-description": "Googleアカウントでログイン",
+ "github-template-description": "GitHubアカウントでサインイン",
+ "gitlab-template-description": "GitLabアカウントでサインイン",
+ "microsoft-entra-template-description": "Microsoft Entra IDでサインイン",
+ "custom-template-description": "カスタムOAuth 2.0プロバイダーを構成する"
},
"copy-redirect-url": "リダイレクト URL がクリップボードにコピーされました。"
},
@@ -2250,7 +2293,13 @@
"fit-content-with-view": "ビューに自動的に適応します"
},
"identity-provider": {
- "test-connection": "テスト接続"
+ "test-connection": "テスト接続",
+ "identity-provider-created": "ID プロバイダが正常に作成されました",
+ "identity-provider-deleted": "ID プロバイダが正常に削除されました",
+ "identity-provider-update-failed": "IDプロバイダの更新に失敗しました",
+ "identity-provider-create-failed": "IDプロバイダの作成に失敗しました",
+ "identity-provider-delete-failed": "IDプロバイダの削除に失敗しました",
+ "identity-provider-permission-denied": "許可が拒否されました"
},
"sensitive-data": {
"self": "機密データ"
@@ -2737,4 +2786,4 @@
"last-visit": "最終訪問",
"changelog-for-version": "{version} の変更履歴"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 72aac198d0..4093bf3fea 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -436,26 +436,25 @@
"delete": "xóa SSO này đi",
"form": {
"type": "Loại",
- "learn-more-with-user-doc": "Tìm hiểu thêm về cấu hình",
+ "type-description": "Chọn loại nhà cung cấp danh tính bạn muốn cấu hình",
+ "oauth2-description": "Kết nối với các nhà cung cấp OAuth 2.0 như Google, GitHub, GitLab",
+ "oidc-description": "Kết nối với các nhà cung cấp OpenID Connect như Microsoft Entra ID (Azure AD), Okta, Auth0",
+ "ldap-description": "Kết nối với các nhà cung cấp LDAP như Microsoft Active Directory, OpenLDAP",
"redirect-url": "URL chuyển hướng ủy quyền",
"redirect-url-description": "Nó sẽ được sử dụng để điền vào trường thích hợp trong biểu mẫu ứng dụng của nhà cung cấp danh tính.",
"use-template": "Sử dụng mẫu",
- "basic-information": "Thông tin cơ bản",
+ "template-description": "Chọn một mẫu được cấu hình sẵn hoặc thiết lập một nhà cung cấp OAuth 2.0 tùy chỉnh",
"name": "Tên",
"name-description": "Tên hiển thị sẽ được hiển thị cho người dùng",
"resource-id": "ID tài nguyên",
"domain": "Tên miền",
"domain-description": "Tên miền của nhà cung cấp danh tính",
- "identity-provider-information": "Thông tin nhà cung cấp danh tính",
- "identity-provider-information-description": "Thông tin được cung cấp bởi nhà cung cấp danh tính của bạn.",
"identity-provider-needed-information": "Tạo ứng dụng SSO của bạn với các thông tin sau.",
"auth-url-description": "Liên kết đến trang đăng nhập OAuth",
"scopes-description": "Danh sách các phạm vi được phân tách bằng dấu cách sẽ được thực hiện khi truy cập URL Xác thực",
"token-url-description": "Địa chỉ API để lấy accessToken",
"user-info-url-description": "Địa chỉ API để lấy thông tin người dùng bằng accessToken",
"security-protocol": "Giao thức bảo mật",
- "connection-security": "Bảo mật kết nối",
- "connection-security-skip-tls-verify": "Bỏ qua xác minh TLS",
"user-information-mapping": "Ánh xạ thông tin người dùng",
"user-information-mapping-description": "Ánh xạ tên trường từ API thông tin người dùng sang người dùng Bytebase.",
"identifier": "Email của người dùng Bytebase",
@@ -463,15 +462,59 @@
"display-name": "Tên hiển thị của người dùng Bytebase",
"phone": "Số điện thoại của người dùng Bytebase",
"groups": "Nhóm người dùng Bytebase",
- "auth-style": {
- "self": "Kiểu xác thực",
- "in-params": {
- "self": "Trong tham số"
- },
- "in-header": {
- "self": "Trong tiêu đề"
- }
- }
+ "general-setting-description": "Cung cấp thông tin cơ bản về nhà cung cấp danh tính của bạn.",
+ "configuration": "Cấu hình",
+ "configuration-description": "Cấu hình cài đặt kết nối cho nhà cung cấp danh tính của bạn",
+ "auth-url": "URL ủy quyền",
+ "auth-url-placeholder": "ví dụ. https://github.com/login/oauth/authorize",
+ "token-url": "URL mã thông báo",
+ "token-url-placeholder": "ví dụ. https://github.com/login/oauth/access_token",
+ "user-info-url": "URL thông tin người dùng",
+ "user-info-url-placeholder": "ví dụ. https://api.github.com/user",
+ "scopes": "Phạm vi",
+ "scopes-placeholder": "ví dụ: hồ sơ email của người dùng",
+ "scopes-placeholder-oidc": "ví dụ email hồ sơ openid",
+ "authentication-style": "Kiểu xác thực",
+ "in-parameters": "Trong các tham số",
+ "in-parameters-description": "Gửi thông tin xác thực trong nội dung POST (khuyến nghị)",
+ "in-header": "Trong Tiêu đề",
+ "in-header-description": "Gửi thông tin xác thực bằng HTTP Basic Authorization",
+ "security-options": "Tùy chọn bảo mật",
+ "skip-tls-verification": "Bỏ qua Xác minh chứng chỉ TLS",
+ "skip-tls-warning": "Chỉ bật tính năng này cho mục đích phát triển hoặc thử nghiệm",
+ "issuer-url-placeholder": "ví dụ: https://acme.okta.com",
+ "issuer-url-description": "URL của đơn vị phát hành OIDC (cấu hình được biết đến rộng rãi sẽ được tự động phát hiện)",
+ "openid-scopes-description": "Danh sách các phạm vi OIDC được phân tách bằng dấu cách (cần có openid)",
+ "host-placeholder": "ví dụ ldap.example.com",
+ "bind-dn": "Liên kết DN",
+ "bind-dn-placeholder": "ví dụ. uid=system,ou=Users,dc=example,dc=com",
+ "bind-dn-description": "DN của người dùng để ràng buộc như đối với các yêu cầu tìm kiếm",
+ "bind-password": "Liên kết mật khẩu",
+ "base-dn": "DN cơ sở",
+ "base-dn-placeholder": "ví dụ. ou=users,dc=example,dc=com",
+ "base-dn-description": "DN cơ sở để tìm kiếm người dùng",
+ "user-filter": "Bộ lọc người dùng",
+ "user-filter-placeholder": "ví dụ (uid=%s)",
+ "user-filter-description": "Bộ lọc để tìm kiếm người dùng (%s sẽ được thay thế bằng tên người dùng)",
+ "starttls": "Bắt đầu TLS",
+ "starttls-description": "Nâng cấp kết nối lên TLS (khuyến nghị)",
+ "ldaps": "LDAPS",
+ "ldaps-description": "Sử dụng TLS ngay từ đầu (cổng 636)",
+ "none": "Không có",
+ "none-description": "Không mã hóa (không khuyến khích sử dụng cho mục đích sản xuất)",
+ "resource-id-readonly-hint": "ID tài nguyên không thể thay đổi sau khi tạo",
+ "domain-optional-hint": "Tùy chọn: Hạn chế quyền truy cập của người dùng từ miền này",
+ "provider-type-readonly-hint": "Loại nhà cung cấp không thể thay đổi sau khi tạo",
+ "identifier-placeholder": "ví dụ: đăng nhập, email",
+ "display-name-placeholder": "ví dụ tên, displayName",
+ "phone-placeholder": "ví dụ điện thoại, di động",
+ "groups-placeholder": "ví dụ nhóm",
+ "groups-description": "Được sử dụng để kiểm soát truy cập theo nhóm (chỉ dành cho nhà cung cấp OIDC)",
+ "google-template-description": "Đăng nhập bằng tài khoản Google",
+ "github-template-description": "Đăng nhập bằng tài khoản GitHub",
+ "gitlab-template-description": "Đăng nhập bằng tài khoản GitLab",
+ "microsoft-entra-template-description": "Đăng nhập bằng ID Microsoft Entra",
+ "custom-template-description": "Cấu hình nhà cung cấp OAuth 2.0 tùy chỉnh"
},
"copy-redirect-url": "URL chuyển hướng đã được sao chép vào bộ nhớ tạm."
},
@@ -2250,7 +2293,13 @@
"fit-content-with-view": "Điều chỉnh nội dung vừa với khung nhìn"
},
"identity-provider": {
- "test-connection": "Kiểm tra kết nối"
+ "test-connection": "Kiểm tra kết nối",
+ "identity-provider-created": "Nhà cung cấp danh tính đã được tạo thành công",
+ "identity-provider-deleted": "Nhà cung cấp danh tính đã xóa thành công",
+ "identity-provider-update-failed": "Không cập nhật được nhà cung cấp danh tính",
+ "identity-provider-create-failed": "Không tạo được nhà cung cấp danh tính",
+ "identity-provider-delete-failed": "Không xóa được nhà cung cấp danh tính",
+ "identity-provider-permission-denied": "Quyền bị từ chối"
},
"sensitive-data": {
"self": "Dữ liệu nhạy cảm"
@@ -2737,4 +2786,4 @@
"last-visit": "Lần truy cập cuối",
"changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index c580c4265b..3a3a25af79 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -436,26 +436,25 @@
"delete": "删除该 SSO",
"form": {
"type": "类型",
- "learn-more-with-user-doc": "了解更多如何配置",
+ "type-description": "选择要配置的身份提供者类型",
+ "oauth2-description": "适用于 OAuth 2.0 提供商,例如 Google、GitHub、GitLab 以及自部署等。",
+ "oidc-description": "适用于 OpenID Connect 提供商,例如 Microsoft Entra ID (Azure AD)、Okta、Auth0",
+ "ldap-description": "适用于 LDAP 提供商,例如 Microsoft Active Directory、OpenLDAP",
"redirect-url": "回调地址",
"redirect-url-description": "将会用于填写到身份提供商申请表单中的相应字段。",
"use-template": "使用模版",
- "basic-information": "基础信息",
+ "template-description": "选择预配置的模板或自定义 OAuth 2.0 提供商。",
"name": "名称",
"name-description": "显示给登录用户的名称",
"resource-id": "资源 ID",
"domain": "域名",
"domain-description": "OAuth 提供商的域名",
- "identity-provider-information": "身份提供商信息",
- "identity-provider-information-description": "这些信息是由您的身份提供商提供的。",
"identity-provider-needed-information": "用以下信息创建您的 SSO 应用程序。",
"auth-url-description": "登录页面的链接",
"scopes-description": "访问 Auth URL 时携带的范围参数,使用空格分隔多个值",
"token-url-description": "用于获取 accessToken 的 API 地址",
"user-info-url-description": "用于通过 accessToken 获取用户信息的 API 地址",
"security-protocol": "安全协议",
- "connection-security": "安全性选项",
- "connection-security-skip-tls-verify": "跳过证书验证",
"user-information-mapping": "用户信息映射",
"user-information-mapping-description": "字段映射保存了来自 API 用户信息的字段名。",
"identifier": "Bytebase 用户的邮箱",
@@ -463,15 +462,59 @@
"display-name": "Bytebase 用户的昵称",
"phone": "Bytebase 用户的手机号",
"groups": "Bytebase 用户的群组",
- "auth-style": {
- "self": "认证参数传递方式",
- "in-params": {
- "self": "通过请求参数"
- },
- "in-header": {
- "self": "通过请求头"
- }
- }
+ "general-setting-description": "提供有关您的身份提供者的基本信息。",
+ "configuration": "配置",
+ "configuration-description": "配置身份提供商的连接设置",
+ "auth-url": "授权网址",
+ "auth-url-placeholder": "例如 https://github.com/login/oauth/authorize",
+ "token-url": "令牌 URL",
+ "token-url-placeholder": "例如 https://github.com/login/oauth/access_token",
+ "user-info-url": "用户信息 URL",
+ "user-info-url-placeholder": "例如 https://api.github.com/user",
+ "scopes": "作用域",
+ "scopes-placeholder": "例如用户电子邮件资料",
+ "scopes-placeholder-oidc": "例如 openid 个人资料电子邮件",
+ "authentication-style": "身份验证方式",
+ "in-parameters": "在参数中",
+ "in-parameters-description": "在 POST 正文中发送凭据(推荐)",
+ "in-header": "在标题中",
+ "in-header-description": "使用 HTTP 基本授权发送凭证",
+ "security-options": "安全选项",
+ "skip-tls-verification": "跳过 TLS 证书验证",
+ "skip-tls-warning": "仅为开发或测试目的启用此功能",
+ "issuer-url-placeholder": "例如 https://acme.okta.com",
+ "issuer-url-description": "OIDC Issuer URL",
+ "openid-scopes-description": "以空格分隔的 OIDC 范围列表(需要 openid)",
+ "host-placeholder": "例如 ldap.example.com",
+ "bind-dn": "绑定 DN",
+ "bind-dn-placeholder": "例如uid=系统、ou=用户、dc=示例、dc=com",
+ "bind-dn-description": "搜索请求时绑定的用户 DN",
+ "bind-password": "绑定密码",
+ "base-dn": "基本 DN",
+ "base-dn-placeholder": "例如ou=用户、dc=示例、dc=com",
+ "base-dn-description": "搜索用户的基本 DN",
+ "user-filter": "用户过滤器",
+ "user-filter-placeholder": "例如 (uid=%s)",
+ "user-filter-description": "搜索用户的过滤器(%s 将被替换为用户名)",
+ "starttls": "启动 TLS",
+ "starttls-description": "将连接升级到 TLS(推荐)",
+ "ldaps": "LDAPS",
+ "ldaps-description": "从一开始就使用 TLS(端口 636)",
+ "none": "没有任何",
+ "none-description": "无加密(不建议用于生产)",
+ "resource-id-readonly-hint": "资源 ID 创建后无法更改",
+ "domain-optional-hint": "可选:限制此域用户的访问",
+ "provider-type-readonly-hint": "提供商类型创建后无法更改",
+ "identifier-placeholder": "例如登录名、电子邮件",
+ "display-name-placeholder": "例如名称、显示名称",
+ "phone-placeholder": "例如电话、手机",
+ "groups-placeholder": "例如团体",
+ "groups-description": "用于基于组的访问控制(仅限 OIDC 提供商)",
+ "google-template-description": "使用 Google 帐户登录",
+ "github-template-description": "使用 GitHub 帐户登录",
+ "gitlab-template-description": "使用 GitLab 帐户登录",
+ "microsoft-entra-template-description": "使用 Microsoft Entra ID 登录",
+ "custom-template-description": "配置自定义 OAuth 2.0 提供程序"
},
"copy-redirect-url": "Redirect URL 已复制到剪切板。"
},
@@ -2250,7 +2293,13 @@
"fit-content-with-view": "自动适应视图"
},
"identity-provider": {
- "test-connection": "测试连接"
+ "test-connection": "测试连接",
+ "identity-provider-created": "身份提供者创建成功",
+ "identity-provider-deleted": "身份提供者已成功删除",
+ "identity-provider-update-failed": "无法更新身份提供者",
+ "identity-provider-create-failed": "无法创建身份提供者",
+ "identity-provider-delete-failed": "无法删除身份提供者",
+ "identity-provider-permission-denied": "没有权限"
},
"sensitive-data": {
"self": "敏感数据"
@@ -2737,4 +2786,4 @@
"last-visit": "上次访问",
"changelog-for-version": "{version} 的更新日志"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.ts
index 83778b70da..3ba8c2c27b 100644
--- a/frontend/src/store/modules/v1/common.ts
+++ b/frontend/src/store/modules/v1/common.ts
@@ -17,7 +17,6 @@ export const databaseGroupNamePrefix = "databaseGroups/";
export const logNamePrefix = "logs/";
export const issueNamePrefix = "issues/";
export const secretNamePrefix = "secrets/";
-export const ssoNamePrefix = "idps/";
export const issueCommentNamePrefix = "issueComments/";
export const groupNamePrefix = "groups/";
export const reviewConfigNamePrefix = "reviewConfigs/";
@@ -147,7 +146,7 @@ export const getProjectNameAndDatabaseGroupName = (name: string): string[] => {
};
export const getSSOId = (name: string) => {
- const tokens = getNameParentTokens(name, [ssoNamePrefix]);
+ const tokens = getNameParentTokens(name, [idpNamePrefix]);
return tokens[0];
};
diff --git a/frontend/src/utils/idp.ts b/frontend/src/utils/idp.ts
index 9b95004882..4dcc83b766 100644
--- a/frontend/src/utils/idp.ts
+++ b/frontend/src/utils/idp.ts
@@ -22,3 +22,9 @@ export interface OAuth2IdentityProviderTemplate {
type: IdentityProviderType.OAUTH2;
config: OAuth2IdentityProviderConfig;
}
+
+export const extractIdentityProviderResourceName = (name: string) => {
+ const pattern = /(?:^|\/)idps\/([^/]+)(?:$|\/)/;
+ const matches = name.match(pattern);
+ return matches?.[1] ?? "";
+};
diff --git a/frontend/src/views/SettingWorkspaceSSO.vue b/frontend/src/views/SettingWorkspaceSSO.vue
index 8a2e5f0e1a..b773c146b8 100644
--- a/frontend/src/views/SettingWorkspaceSSO.vue
+++ b/frontend/src/views/SettingWorkspaceSSO.vue
@@ -27,15 +27,9 @@
{{ $t("settings.sso.create") }}
</NButton>
</div>
- <NDataTable
- key="sso-table"
- size="small"
- :data="identityProviderList"
- :row-key="(sso: IdentityProvider) => sso.name"
- :columns="columnList"
- :striped="true"
+ <IdentityProviderTable
+ :identity-provider-list="identityProviderList"
:bordered="true"
- :loading="state.isLoading"
/>
</div>
@@ -48,31 +42,21 @@
<script lang="ts" setup>
import { PlusIcon } from "lucide-vue-next";
-import { NButton, NDataTable } from "naive-ui";
-import type { DataTableColumn } from "naive-ui";
-import { computed, onMounted, reactive, h } from "vue";
-import { useI18n } from "vue-i18n";
+import { NButton } from "naive-ui";
+import { computed, onMounted, reactive } from "vue";
import { useRouter } from "vue-router";
import { FeatureBadge, FeatureModal } from "@/components/FeatureGuard";
-import {
- WORKSPACE_ROUTE_SSO_CREATE,
- WORKSPACE_ROUTE_SSO_DETAIL,
-} from "@/router/dashboard/workspaceRoutes";
+import { IdentityProviderTable } from "@/components/IdentityProvider";
+import { WORKSPACE_ROUTE_SSO_CREATE } from "@/router/dashboard/workspaceRoutes";
import { featureToRef } from "@/store";
import { useIdentityProviderStore } from "@/store/modules/idp";
-import { getSSOId } from "@/store/modules/v1/common";
import type { IdentityProvider } from "@/types/proto/v1/idp_service";
import { PlanFeature } from "@/types/proto/v1/subscription_service";
-import {
- hasWorkspacePermissionV2,
- identityProviderTypeToString,
-} from "@/utils";
+import { hasWorkspacePermissionV2 } from "@/utils";
interface LocalState {
isLoading: boolean;
showFeatureModal: boolean;
- showCreatingSSOModal: boolean;
- selectedIdentityProviderName: string;
}
const props = defineProps<{
@@ -80,13 +64,10 @@ const props = defineProps<{
onClickView?: (sso: IdentityProvider) => void;
}>();
-const { t } = useI18n();
const router = useRouter();
const state = reactive<LocalState>({
isLoading: true,
showFeatureModal: false,
- showCreatingSSOModal: false,
- selectedIdentityProviderName: "",
});
const identityProviderStore = useIdentityProviderStore();
const hasSSOFeature = featureToRef(PlanFeature.FEATURE_GOOGLE_AND_GITHUB_SSO);
@@ -99,10 +80,6 @@ const allowCreateSSO = computed(() => {
return hasWorkspacePermissionV2("bb.identityProviders.create");
});
-const allowGetSSO = computed(() => {
- return hasWorkspacePermissionV2("bb.identityProviders.get");
-});
-
onMounted(async () => {
await identityProviderStore.fetchIdentityProviderList();
state.isLoading = false;
@@ -123,60 +100,4 @@ const handleCreateSSO = () => {
name: WORKSPACE_ROUTE_SSO_CREATE,
});
};
-
-const handleViewSSO = (identityProvider: IdentityProvider) => {
- if (props.onClickView) {
- props.onClickView(identityProvider);
- return;
- }
- router.push({
- name: WORKSPACE_ROUTE_SSO_DETAIL,
- params: {
- ssoId: getSSOId(identityProvider.name),
- },
- });
-};
-
-const columnList = computed((): DataTableColumn<IdentityProvider>[] => {
- const list: DataTableColumn<IdentityProvider>[] = [
- {
- key: "name",
- title: t("settings.sso.form.name"),
- render: (identityProvider) => identityProvider.title,
- },
- {
- key: "type",
- title: t("settings.sso.form.type"),
- render: (identityProvider) =>
- identityProviderTypeToString(identityProvider.type),
- },
- {
- key: "domain",
- title: t("settings.sso.form.domain"),
- render: (identityProvider) => identityProvider.domain,
- },
- ];
- if (allowGetSSO.value) {
- list.push({
- key: "view",
- title: "",
- render: (identityProvider) =>
- h(
- "div",
- { class: "flex justify-end" },
- h(
- NButton,
- {
- size: "small",
- onClick: () => handleViewSSO(identityProvider),
- },
- {
- default: () => t("common.view"),
- }
- )
- ),
- });
- }
- return list;
-});
</script>
diff --git a/frontend/src/views/SettingWorkspaceSSODetail.vue b/frontend/src/views/SettingWorkspaceSSODetail.vue
index 3c886e834a..0c2c516d00 100644
--- a/frontend/src/views/SettingWorkspaceSSODetail.vue
+++ b/frontend/src/views/SettingWorkspaceSSODetail.vue
@@ -1,5 +1,5 @@
<template>
- <div class="w-full space-y-4">
+ <div class="w-full space-y-6">
<div class="w-full flex flex-row justify-between items-center">
<div class="textinfolabel mr-4">
{{ $t("settings.sso.description") }}
@@ -13,18 +13,23 @@
</a>
</div>
</div>
- </div>
- <IdentityProviderCreateForm
- v-if="!isLoading"
- class="py-4"
- :identity-provider-name="currentIdentityProvider?.name"
- :on-created="onCreated"
- :on-updated="onUpdated"
- :on-deleted="onDeleted"
- :on-canceled="onCanceled"
- />
- <BBSpin v-else class="w-full h-64" />
+ <!-- Create new identity provider -->
+ <IdentityProviderCreateWizard
+ v-if="!isLoading && !currentIdentityProvider"
+ @created="props.onCreated"
+ />
+
+ <!-- Edit existing identity provider -->
+ <IdentityProviderEditForm
+ v-else-if="!isLoading && currentIdentityProvider"
+ :identity-provider="currentIdentityProvider"
+ @updated="props.onUpdated"
+ @deleted="props.onDeleted"
+ />
+
+ <BBSpin v-else class="w-full h-64" />
+ </div>
<FeatureModal
:feature="PlanFeature.FEATURE_ENTERPRISE_SSO"
@@ -37,9 +42,12 @@
import { computed, reactive, ref, watchEffect } from "vue";
import { BBSpin } from "@/bbkit";
import { FeatureModal } from "@/components/FeatureGuard";
-import IdentityProviderCreateForm from "@/components/SSO/IdentityProviderCreateForm.vue";
+import {
+ IdentityProviderCreateWizard,
+ IdentityProviderEditForm,
+} from "@/components/IdentityProvider";
import { useIdentityProviderStore } from "@/store/modules/idp";
-import { ssoNamePrefix } from "@/store/modules/v1/common";
+import { idpNamePrefix } from "@/store/modules/v1/common";
import type { IdentityProvider } from "@/types/proto/v1/idp_service";
import { PlanFeature } from "@/types/proto/v1/subscription_service";
@@ -47,7 +55,7 @@ const props = defineProps<{
ssoId?: string;
onCreated?: (sso: IdentityProvider) => void;
onUpdated?: (sso: IdentityProvider) => void;
- onDeleted?: (sso: IdentityProvider) => void;
+ onDeleted?: () => void;
onCanceled?: () => void;
}>();
@@ -61,22 +69,22 @@ const state = reactive<LocalState>({
const identityProviderStore = useIdentityProviderStore();
const isLoading = ref<boolean>(true);
-const ssoName = computed(() => {
+const idpName = computed(() => {
if (!props.ssoId) {
return "";
}
- return `${ssoNamePrefix}${props.ssoId}`;
+ return `${idpNamePrefix}${props.ssoId}`;
});
watchEffect(async () => {
- if (ssoName.value) {
+ if (idpName.value) {
isLoading.value = true;
- await identityProviderStore.getOrFetchIdentityProviderByName(ssoName.value);
+ await identityProviderStore.getOrFetchIdentityProviderByName(idpName.value);
}
isLoading.value = false;
});
const currentIdentityProvider = computed(() => {
- return identityProviderStore.getIdentityProviderByName(ssoName.value);
+ return identityProviderStore.getIdentityProviderByName(idpName.value);
});
</script>
diff --git a/frontend/src/views/sql-editor/Setting/SSO/SSO.vue b/frontend/src/views/sql-editor/Setting/SSO/SSO.vue
index 41eec651fb..eeb8ce677d 100644
--- a/frontend/src/views/sql-editor/Setting/SSO/SSO.vue
+++ b/frontend/src/views/sql-editor/Setting/SSO/SSO.vue
@@ -16,7 +16,6 @@
:on-created="(sso) => (state.detail.sso = sso)"
:on-updated="() => (state.detail.show = false)"
:on-deleted="() => (state.detail.show = false)"
- :on-canceled="() => (state.detail.show = false)"
/>
</DrawerContent>
</Drawer>