Skip to content

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

fix: allow update idp without client secret (#4623)

boojack83a7c514c15a
diff --git a/backend/api/v1/idp_service.go b/backend/api/v1/idp_service.go
index 8af5a922c6..a40c5c8caf 100644
--- a/backend/api/v1/idp_service.go
+++ b/backend/api/v1/idp_service.go
@@ -117,6 +117,16 @@ func (s *IdentityProviderService) UpdateIdentityProvider(ctx context.Context, re
if err := validIdentityProviderConfig(v1pb.IdentityProviderType(identityProvider.Type), request.IdentityProvider.Config); err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}
+ // Don't update client secret if it's empty string.
+ if identityProvider.Type == storepb.IdentityProviderType_OAUTH2 {
+ if request.IdentityProvider.Config.GetOauth2Config().ClientSecret == "" {
+ patch.Config.GetOauth2Config().ClientSecret = identityProvider.Config.GetOauth2Config().ClientSecret
+ }
+ } else if identityProvider.Type == storepb.IdentityProviderType_OIDC {
+ if request.IdentityProvider.Config.GetOidcConfig().ClientSecret == "" {
+ patch.Config.GetOidcConfig().ClientSecret = identityProvider.Config.GetOidcConfig().ClientSecret
+ }
+ }
}
identityProvider, err = s.store.UpdateIdentityProvider(ctx, patch)
diff --git a/frontend/src/components/IdentityProviderCreateForm.vue b/frontend/src/components/IdentityProviderCreateForm.vue
index 40f4ad3f49..78368de2c1 100644
--- a/frontend/src/components/IdentityProviderCreateForm.vue
+++ b/frontend/src/components/IdentityProviderCreateForm.vue
@@ -252,7 +252,7 @@
</a>
</p>
</div>
- <div class="w-full grid grid-cols-2">
+ <div class="w-full grid grid-cols-[256px_1fr]">
<input
v-model="configForOAuth2.fieldMapping!.identifier"
type="text"
@@ -269,7 +269,7 @@
</p>
</div>
</div>
- <div class="w-full grid grid-cols-2">
+ <div class="w-full grid grid-cols-[256px_1fr]">
<input
v-model="configForOAuth2.fieldMapping!.displayName"
type="text"
@@ -285,7 +285,7 @@
</p>
</div>
</div>
- <div class="w-full grid grid-cols-2">
+ <div class="w-full grid grid-cols-[256px_1fr]">
<input
v-model="configForOAuth2.fieldMapping!.email"
type="text"
@@ -570,20 +570,21 @@ const isFormCompleted = computed(() => {
if (state.type === IdentityProviderType.OAUTH2) {
if (
!configForOAuth2.value.clientId ||
- !configForOAuth2.value.clientSecret ||
!configForOAuth2.value.authUrl ||
!configForOAuth2.value.tokenUrl ||
!configForOAuth2.value.userInfoUrl ||
- !configForOAuth2.value.fieldMapping?.identifier
+ !configForOAuth2.value.fieldMapping?.identifier ||
+ // 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.clientSecret ||
!configForOIDC.value.issuer ||
- !configForOIDC.value.fieldMapping?.identifier
+ !configForOIDC.value.fieldMapping?.identifier ||
+ (isCreating.value && !configForOIDC.value.clientSecret)
) {
return false;
}
@@ -603,7 +604,7 @@ const allowCreate = computed(() => {
const allowTestConnection = computed(() => {
if (state.type === IdentityProviderType.OAUTH2) {
- if (isFormCompleted.value) {
+ if (isFormCompleted.value && configForOAuth2.value.clientSecret) {
return true;
}
}