Skip to content

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

chore: use enum instead of raw string for idp.security_protocol (#16520)

boojackafbcf0bf1838
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index b0093747d8..d8113897b0 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -354,7 +354,7 @@ func (s *AuthService) getOrCreateUserWithIDP(ctx context.Context, request *v1pb.
BindPassword: idpConfig.BindPassword,
BaseDN: idpConfig.BaseDn,
UserFilter: idpConfig.UserFilter,
- SecurityProtocol: ldap.SecurityProtocol(idpConfig.SecurityProtocol),
+ SecurityProtocol: idpConfig.SecurityProtocol,
FieldMapping: idpConfig.FieldMapping,
},
)
diff --git a/backend/api/v1/idp_service.go b/backend/api/v1/idp_service.go
index 0c75f4ef2c..ba42a30298 100644
--- a/backend/api/v1/idp_service.go
+++ b/backend/api/v1/idp_service.go
@@ -312,7 +312,7 @@ func (s *IdentityProviderService) TestIdentityProvider(ctx context.Context, requ
BindPassword: identityProviderConfig.BindPassword,
BaseDN: identityProviderConfig.BaseDn,
UserFilter: identityProviderConfig.UserFilter,
- SecurityProtocol: ldap.SecurityProtocol(identityProviderConfig.SecurityProtocol),
+ SecurityProtocol: identityProviderConfig.SecurityProtocol,
FieldMapping: identityProviderConfig.FieldMapping,
},
)
@@ -438,7 +438,7 @@ func convertIdentityProviderConfigFromStore(identityProviderConfig *storepb.Iden
BindPassword: "", // SECURITY: We do not expose the bind password
BaseDn: v.BaseDn,
UserFilter: v.UserFilter,
- SecurityProtocol: v.SecurityProtocol,
+ SecurityProtocol: v1pb.LDAPIdentityProviderConfig_SecurityProtocol(v.SecurityProtocol),
FieldMapping: &fieldMapping,
},
},
@@ -507,7 +507,7 @@ func convertIdentityProviderConfigToStore(identityProviderConfig *v1pb.IdentityP
BindPassword: v.BindPassword,
BaseDn: v.BaseDn,
UserFilter: v.UserFilter,
- SecurityProtocol: v.SecurityProtocol,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_SecurityProtocol(v.SecurityProtocol),
FieldMapping: &fieldMapping,
},
},
diff --git a/backend/migrator/migration/3.8/0000##ldap_security_protocol_enum.sql b/backend/migrator/migration/3.8/0000##ldap_security_protocol_enum.sql
new file mode 100644
index 0000000000..2f62c68a25
--- /dev/null
+++ b/backend/migrator/migration/3.8/0000##ldap_security_protocol_enum.sql
@@ -0,0 +1,27 @@
+-- Convert LDAP security protocol from string to enum string values
+-- The mapping is:
+-- "starttls" -> "START_TLS"
+-- "ldaps" -> "LDAPS"
+-- "" (empty string) or NULL -> remove the field (will default to SECURITY_PROTOCOL_UNSPECIFIED)
+--
+-- Note: For LDAP type, the config column stores the LDAP configuration directly,
+-- not wrapped in a "ldapConfig" field. Protojson uses enum string names, not numbers.
+
+-- First, update the non-empty values
+UPDATE idp
+SET config = jsonb_set(
+ config,
+ '{securityProtocol}',
+ CASE
+ WHEN config->>'securityProtocol' = 'starttls' THEN '"START_TLS"'::jsonb
+ WHEN config->>'securityProtocol' = 'ldaps' THEN '"LDAPS"'::jsonb
+ END
+)
+WHERE type = 'LDAP'
+ AND config->>'securityProtocol' IN ('starttls', 'ldaps');
+
+-- Then, remove the field for empty or null values
+UPDATE idp
+SET config = config - 'securityProtocol'
+WHERE type = 'LDAP'
+ AND (config->>'securityProtocol' = '' OR config->>'securityProtocol' IS NULL);
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index e8d825c4fa..b20b016e6d 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.7.23"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.8.0"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/backend/plugin/idp/ldap/ldap.go b/backend/plugin/idp/ldap/ldap.go
index 56967750e4..4cbf88f877 100644
--- a/backend/plugin/idp/ldap/ldap.go
+++ b/backend/plugin/idp/ldap/ldap.go
@@ -17,19 +17,6 @@ type IdentityProvider struct {
config IdentityProviderConfig
}
-// SecurityProtocol represents the security protocol to be used when connecting
-// to the LDAP server.
-type SecurityProtocol string
-
-const (
- // SecurityProtocolStartTLS represents the StartTLS security protocol.
- SecurityProtocolStartTLS SecurityProtocol = "starttls"
- // SecurityProtocolLDAPS represents the LDAPS security protocol.
- SecurityProtocolLDAPS SecurityProtocol = "ldaps"
- // SecurityProtocolNone means no security protocol.
- SecurityProtocolNone SecurityProtocol = ""
-)
-
// IdentityProviderConfig is the configuration to be consumed by the LDAP
// Identity Provider.
type IdentityProviderConfig struct {
@@ -52,8 +39,8 @@ type IdentityProviderConfig struct {
// UserFilter is the filter to search for users, e.g. "(uid=%s)".
UserFilter string `json:"userFilter"`
// SecurityProtocol is the security protocol to be used for establishing
- // connections with the LDAP server. It must be StartTLS, LDAPS or None.
- SecurityProtocol SecurityProtocol `json:"securityProtocol"`
+ // connections with the LDAP server.
+ SecurityProtocol storepb.LDAPIdentityProviderConfig_SecurityProtocol `json:"securityProtocol"`
// FieldMapping is the mapping of the user attributes returned by the LDAP
// server.
FieldMapping *storepb.FieldMapping `json:"fieldMapping"`
@@ -76,7 +63,7 @@ func NewIdentityProvider(config IdentityProviderConfig) (*IdentityProvider, erro
}
if config.Port <= 0 {
- if config.SecurityProtocol == SecurityProtocolLDAPS {
+ if config.SecurityProtocol == storepb.LDAPIdentityProviderConfig_LDAPS {
config.Port = 636
} else {
config.Port = 389
@@ -94,14 +81,14 @@ func (p *IdentityProvider) dial() (*ldap.Conn, error) {
InsecureSkipVerify: p.config.SkipTLSVerify,
}
switch p.config.SecurityProtocol {
- case SecurityProtocolLDAPS:
+ case storepb.LDAPIdentityProviderConfig_LDAPS:
url := fmt.Sprintf("ldaps://%s:%d", p.config.Host, p.config.Port)
conn, err := ldap.DialURL(url, ldap.DialWithTLSConfig(tlsConfig))
if err != nil {
return nil, errors.Errorf("dial TLS: %v", err)
}
return conn, nil
- case SecurityProtocolStartTLS:
+ case storepb.LDAPIdentityProviderConfig_START_TLS:
url := fmt.Sprintf("ldap://%s:%d", p.config.Host, p.config.Port)
conn, err := ldap.DialURL(url)
if err != nil {
@@ -112,15 +99,13 @@ func (p *IdentityProvider) dial() (*ldap.Conn, error) {
return nil, errors.Errorf("start TLS: %v", err)
}
return conn, nil
- case SecurityProtocolNone:
+ default:
url := fmt.Sprintf("ldap://%s:%d", p.config.Host, p.config.Port)
conn, err := ldap.DialURL(url)
if err != nil {
return nil, errors.Errorf("dial: %v", err)
}
return conn, nil
- default:
- return nil, errors.Errorf("unknown security protocol %q", p.config.SecurityProtocol)
}
}
diff --git a/backend/plugin/idp/ldap/ldap_test.go b/backend/plugin/idp/ldap/ldap_test.go
index 3ac3aa29d6..24ee1ff8ac 100644
--- a/backend/plugin/idp/ldap/ldap_test.go
+++ b/backend/plugin/idp/ldap/ldap_test.go
@@ -37,7 +37,7 @@ func TestNewIdentityProvider(t *testing.T) {
BindPassword: "pa$$word",
BaseDN: "ou=Users,o=6456a5e9c25dabb51ccad385,dc=example,dc=com",
UserFilter: "(&(objectClass=posixAccount)(uid=%s))",
- SecurityProtocol: SecurityProtocolStartTLS,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_START_TLS,
FieldMapping: &storepb.FieldMapping{
Identifier: "uid",
},
@@ -52,7 +52,7 @@ func TestNewIdentityProvider(t *testing.T) {
BindPassword: "pa$$word",
BaseDN: "ou=Users,o=6456a5e9c25dabb51ccad385,dc=example,dc=com",
UserFilter: "(&(objectClass=posixAccount)(uid=%s))",
- SecurityProtocol: SecurityProtocolStartTLS,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_START_TLS,
FieldMapping: &storepb.FieldMapping{
Identifier: "uid",
},
@@ -67,7 +67,7 @@ func TestNewIdentityProvider(t *testing.T) {
BindPassword: "",
BaseDN: "ou=Users,o=6456a5e9c25dabb51ccad385,dc=example,dc=com",
UserFilter: "(&(objectClass=posixAccount)(uid=%s))",
- SecurityProtocol: SecurityProtocolStartTLS,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_START_TLS,
FieldMapping: &storepb.FieldMapping{
Identifier: "uid",
},
@@ -82,7 +82,7 @@ func TestNewIdentityProvider(t *testing.T) {
BindPassword: "pa$$word",
BaseDN: "",
UserFilter: "(&(objectClass=posixAccount)(uid=%s))",
- SecurityProtocol: SecurityProtocolStartTLS,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_START_TLS,
FieldMapping: &storepb.FieldMapping{
Identifier: "uid",
},
@@ -97,7 +97,7 @@ func TestNewIdentityProvider(t *testing.T) {
BindPassword: "pa$$word",
BaseDN: "ou=Users,o=6456a5e9c25dabb51ccad385,dc=example,dc=com",
UserFilter: "",
- SecurityProtocol: SecurityProtocolStartTLS,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_START_TLS,
FieldMapping: &storepb.FieldMapping{
Identifier: "uid",
},
@@ -112,7 +112,7 @@ func TestNewIdentityProvider(t *testing.T) {
BindPassword: "pa$$word",
BaseDN: "ou=Users,o=6456a5e9c25dabb51ccad385,dc=example,dc=com",
UserFilter: "(&(objectClass=posixAccount)(uid=%s))",
- SecurityProtocol: SecurityProtocolStartTLS,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_START_TLS,
FieldMapping: &storepb.FieldMapping{
DisplayName: "displayName",
},
@@ -237,7 +237,7 @@ func TestIdentityProvider(t *testing.T) {
BindPassword: "pa$$word",
BaseDN: "ou=Users,o=6456a5e9c25dabb51ccad385,dc=example,dc=com",
UserFilter: "(&(objectClass=posixAccount)(uid=%s))",
- SecurityProtocol: SecurityProtocolLDAPS,
+ SecurityProtocol: storepb.LDAPIdentityProviderConfig_LDAPS,
FieldMapping: &storepb.FieldMapping{
Identifier: "uid",
DisplayName: "displayName",
diff --git a/frontend/src/components/SSO/IdentityProviderCreateForm.vue b/frontend/src/components/SSO/IdentityProviderCreateForm.vue
index 6680fb9625..243725af1e 100644
--- a/frontend/src/components/SSO/IdentityProviderCreateForm.vue
+++ b/frontend/src/components/SSO/IdentityProviderCreateForm.vue
@@ -479,9 +479,9 @@
</p>
<p class="textinfolabel mt-1">
<NRadioGroup v-model:value="configForLDAP.securityProtocol">
- <NRadio value="starttls" label="StartTLS" />
- <NRadio value="ldaps" label="LDAPS" />
- <NRadio value="" label="None" />
+ <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>
@@ -678,6 +678,7 @@ import {
OAuth2IdentityProviderConfig,
OIDCIdentityProviderConfig,
LDAPIdentityProviderConfig,
+ LDAPIdentityProviderConfig_SecurityProtocol,
} from "@/types/proto/v1/idp_service";
import { PlanFeature } from "@/types/proto/v1/subscription_service";
import type { OAuth2IdentityProviderTemplate } from "@/utils";
@@ -727,7 +728,7 @@ const configForOIDC = ref<OIDCIdentityProviderConfig>(
const configForLDAP = ref<LDAPIdentityProviderConfig>(
LDAPIdentityProviderConfig.fromPartial({
port: 389,
- securityProtocol: "starttls",
+ securityProtocol: LDAPIdentityProviderConfig_SecurityProtocol.START_TLS,
})
);
const resourceIdField = ref<InstanceType<typeof ResourceIdField>>();
diff --git a/frontend/src/types/proto-es/v1/idp_service_pb.d.ts b/frontend/src/types/proto-es/v1/idp_service_pb.d.ts
index 89b6c6f474..7d601d81de 100644
--- a/frontend/src/types/proto-es/v1/idp_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/idp_service_pb.d.ts
@@ -480,11 +480,11 @@ export declare type LDAPIdentityProviderConfig = Message<"bytebase.v1.LDAPIdenti
/**
* SecurityProtocol is the security protocol to be used for establishing
- * connections with the LDAP server. It must be StartTLS, LDAPS or None.
+ * connections with the LDAP server.
*
- * @generated from field: string security_protocol = 8;
+ * @generated from field: bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol security_protocol = 8;
*/
- securityProtocol: string;
+ securityProtocol: LDAPIdentityProviderConfig_SecurityProtocol;
/**
* FieldMapping is the mapping of the user attributes returned by the LDAP
@@ -501,6 +501,35 @@ export declare type LDAPIdentityProviderConfig = Message<"bytebase.v1.LDAPIdenti
*/
export declare const LDAPIdentityProviderConfigSchema: GenMessage<LDAPIdentityProviderConfig>;
+/**
+ * @generated from enum bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol
+ */
+export enum LDAPIdentityProviderConfig_SecurityProtocol {
+ /**
+ * @generated from enum value: SECURITY_PROTOCOL_UNSPECIFIED = 0;
+ */
+ SECURITY_PROTOCOL_UNSPECIFIED = 0,
+
+ /**
+ * StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS.
+ *
+ * @generated from enum value: START_TLS = 1;
+ */
+ START_TLS = 1,
+
+ /**
+ * LDAPS is the security protocol that uses TLS from the beginning.
+ *
+ * @generated from enum value: LDAPS = 2;
+ */
+ LDAPS = 2,
+}
+
+/**
+ * Describes the enum bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol.
+ */
+export declare const LDAPIdentityProviderConfig_SecurityProtocolSchema: GenEnum<LDAPIdentityProviderConfig_SecurityProtocol>;
+
/**
* FieldMapping saves the field names from user info API of identity provider.
* As we save all raw json string of user info response data into `principal.idp_user_info`,
diff --git a/frontend/src/types/proto-es/v1/idp_service_pb.js b/frontend/src/types/proto-es/v1/idp_service_pb.js
index b76257d1d7..9196ad8bb4 100644
--- a/frontend/src/types/proto-es/v1/idp_service_pb.js
+++ b/frontend/src/types/proto-es/v1/idp_service_pb.js
@@ -14,7 +14,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/idp_service.proto.
*/
export const file_v1_idp_service = /*@__PURE__*/
- fileDesc("ChR2MS9pZHBfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiRQoaR2V0SWRlb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FtZYrqMBtiYi5pZGVudGl0eVByb3ZpZGVycy5kZWxldGWQ6jABmOowAYLT5JMCEyoRL3YxL3tuYW1lPWlkcHMvKn0SqgEKFFRlc3RJZGVudGl0eVByb3ZpZGVyEiguYnl0ZWJhc2UudjEuVGVzdElkZW50aXR5UHJvdmlkZXJSZXF1ZXN0GikuYnl0ZWJhc2UudjEuVGVzdElkZW50aXR5UHJvdmlkZXJSZXNwb25zZSI9iuowG2JiLmlkZW50aXR5UHJvdmlkZXJzLnVwZGF0ZZDqMAGC0+STAhQ6ASoiDy92MS9pZHBzLyo6dGVzdEI0WjJnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL3Byb3RvL2dlbmVyYXRlZC1nby92MWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_v1_annotation]);
+ fileDesc("ChR2MS9pZHBfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiRQoaR2V0SWRlbnRpdHlQcm92aWRlclJlcXVlc3QSJwoEbmFtZRgBIAEoCUIZ4kEBAvpBEgoQYnl0ZWJhc2UuY29tL0lkUCJFChxMaXN0SWRlbnRpdHlQcm92aWRlcnNSZXF1ZXN0EhEKCXBhZ2Vfc2l6ZRgBIAEoBRISCgpwYWdlX3Rva2VuGAIgASgJInMKHUxpc3RJZGVudGl0eVByb3ZpZGVyc1Jlc3BvbnNlEjkKEmlkZW50aXR5X3Byb3ZpZGVycxgBIAMoCzIdLmJ5dGViYXNlLnYxLklkZW50aXR5UHJvdmlkZXISFwoPbmV4dF9wYWdlX3Rva2VuGAIgASgJIpQBCh1DcmVhdGVJZGVudGl0eVByb3ZpZGVyUmVxdWVzdBI+ChFpZGVudGl0eV9wcm92aWRlchgBIAEoCzIdLmJ5dGViYXNlLnYxLklkZW50aXR5UHJvdmlkZXJCBOJBAQISHAoUaWRlbnRpdHlfcHJvdmlkZXJfaWQYAiABKAkSFQoNdmFsaW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YmFzZS9ieXRlYmFzZS9wcm90by9nZW5lcmF0ZWQtZ28vdjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_empty, file_google_protobuf_field_mask, file_v1_annotation]);
/**
* Describes the message bytebase.v1.GetIdentityProviderRequest.
@@ -114,6 +114,18 @@ export const OIDCIdentityProviderConfigSchema = /*@__PURE__*/
export const LDAPIdentityProviderConfigSchema = /*@__PURE__*/
messageDesc(file_v1_idp_service, 13);
+/**
+ * Describes the enum bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol.
+ */
+export const LDAPIdentityProviderConfig_SecurityProtocolSchema = /*@__PURE__*/
+ enumDesc(file_v1_idp_service, 13, 0);
+
+/**
+ * @generated from enum bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol
+ */
+export const LDAPIdentityProviderConfig_SecurityProtocol = /*@__PURE__*/
+ tsEnum(LDAPIdentityProviderConfig_SecurityProtocolSchema);
+
/**
* Describes the message bytebase.v1.FieldMapping.
* Use `create(FieldMappingSchema)` to create a new message.
diff --git a/frontend/src/types/proto/v1/idp_service.ts b/frontend/src/types/proto/v1/idp_service.ts
index 90dcdd231b..6b7434b1f1 100644
--- a/frontend/src/types/proto/v1/idp_service.ts
+++ b/frontend/src/types/proto/v1/idp_service.ts
@@ -300,9 +300,9 @@ export interface LDAPIdentityProviderConfig {
userFilter: string;
/**
* SecurityProtocol is the security protocol to be used for establishing
- * connections with the LDAP server. It must be StartTLS, LDAPS or None.
+ * connections with the LDAP server.
*/
- securityProtocol: string;
+ securityProtocol: LDAPIdentityProviderConfig_SecurityProtocol;
/**
* FieldMapping is the mapping of the user attributes returned by the LDAP
* server.
@@ -310,6 +310,67 @@ export interface LDAPIdentityProviderConfig {
fieldMapping: FieldMapping | undefined;
}
+export enum LDAPIdentityProviderConfig_SecurityProtocol {
+ SECURITY_PROTOCOL_UNSPECIFIED = "SECURITY_PROTOCOL_UNSPECIFIED",
+ /** START_TLS - StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS. */
+ START_TLS = "START_TLS",
+ /** LDAPS - LDAPS is the security protocol that uses TLS from the beginning. */
+ LDAPS = "LDAPS",
+ UNRECOGNIZED = "UNRECOGNIZED",
+}
+
+export function lDAPIdentityProviderConfig_SecurityProtocolFromJSON(
+ object: any,
+): LDAPIdentityProviderConfig_SecurityProtocol {
+ switch (object) {
+ case 0:
+ case "SECURITY_PROTOCOL_UNSPECIFIED":
+ return LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED;
+ case 1:
+ case "START_TLS":
+ return LDAPIdentityProviderConfig_SecurityProtocol.START_TLS;
+ case 2:
+ case "LDAPS":
+ return LDAPIdentityProviderConfig_SecurityProtocol.LDAPS;
+ case -1:
+ case "UNRECOGNIZED":
+ default:
+ return LDAPIdentityProviderConfig_SecurityProtocol.UNRECOGNIZED;
+ }
+}
+
+export function lDAPIdentityProviderConfig_SecurityProtocolToJSON(
+ object: LDAPIdentityProviderConfig_SecurityProtocol,
+): string {
+ switch (object) {
+ case LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED:
+ return "SECURITY_PROTOCOL_UNSPECIFIED";
+ case LDAPIdentityProviderConfig_SecurityProtocol.START_TLS:
+ return "START_TLS";
+ case LDAPIdentityProviderConfig_SecurityProtocol.LDAPS:
+ return "LDAPS";
+ case LDAPIdentityProviderConfig_SecurityProtocol.UNRECOGNIZED:
+ default:
+ return "UNRECOGNIZED";
+ }
+}
+
+export function lDAPIdentityProviderConfig_SecurityProtocolToNumber(
+ object: LDAPIdentityProviderConfig_SecurityProtocol,
+): number {
+ switch (object) {
+ case LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED:
+ return 0;
+ case LDAPIdentityProviderConfig_SecurityProtocol.START_TLS:
+ return 1;
+ case LDAPIdentityProviderConfig_SecurityProtocol.LDAPS:
+ return 2;
+ case LDAPIdentityProviderConfig_SecurityProtocol.UNRECOGNIZED:
+ default:
+ return -1;
+ }
+}
+
/**
* FieldMapping saves the field names from user info API of identity provider.
* As we save all raw json string of user info response data into `principal.idp_user_info`,
@@ -1582,7 +1643,7 @@ function createBaseLDAPIdentityProviderConfig(): LDAPIdentityProviderConfig {
bindPassword: "",
baseDn: "",
userFilter: "",
- securityProtocol: "",
+ securityProtocol: LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED,
fieldMapping: undefined,
};
}
@@ -1610,8 +1671,8 @@ export const LDAPIdentityProviderConfig: MessageFns<LDAPIdentityProviderConfig>
if (message.userFilter !== "") {
writer.uint32(58).string(message.userFilter);
}
- if (message.securityProtocol !== "") {
- writer.uint32(66).string(message.securityProtocol);
+ if (message.securityProtocol !== LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED) {
+ writer.uint32(64).int32(lDAPIdentityProviderConfig_SecurityProtocolToNumber(message.securityProtocol));
}
if (message.fieldMapping !== undefined) {
FieldMapping.encode(message.fieldMapping, writer.uint32(74).fork()).join();
@@ -1683,11 +1744,11 @@ export const LDAPIdentityProviderConfig: MessageFns<LDAPIdentityProviderConfig>
continue;
}
case 8: {
- if (tag !== 66) {
+ if (tag !== 64) {
break;
}
- message.securityProtocol = reader.string();
+ message.securityProtocol = lDAPIdentityProviderConfig_SecurityProtocolFromJSON(reader.int32());
continue;
}
case 9: {
@@ -1716,7 +1777,9 @@ export const LDAPIdentityProviderConfig: MessageFns<LDAPIdentityProviderConfig>
bindPassword: isSet(object.bindPassword) ? globalThis.String(object.bindPassword) : "",
baseDn: isSet(object.baseDn) ? globalThis.String(object.baseDn) : "",
userFilter: isSet(object.userFilter) ? globalThis.String(object.userFilter) : "",
- securityProtocol: isSet(object.securityProtocol) ? globalThis.String(object.securityProtocol) : "",
+ securityProtocol: isSet(object.securityProtocol)
+ ? lDAPIdentityProviderConfig_SecurityProtocolFromJSON(object.securityProtocol)
+ : LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED,
fieldMapping: isSet(object.fieldMapping) ? FieldMapping.fromJSON(object.fieldMapping) : undefined,
};
},
@@ -1744,8 +1807,8 @@ export const LDAPIdentityProviderConfig: MessageFns<LDAPIdentityProviderConfig>
if (message.userFilter !== "") {
obj.userFilter = message.userFilter;
}
- if (message.securityProtocol !== "") {
- obj.securityProtocol = message.securityProtocol;
+ if (message.securityProtocol !== LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED) {
+ obj.securityProtocol = lDAPIdentityProviderConfig_SecurityProtocolToJSON(message.securityProtocol);
}
if (message.fieldMapping !== undefined) {
obj.fieldMapping = FieldMapping.toJSON(message.fieldMapping);
@@ -1765,7 +1828,8 @@ export const LDAPIdentityProviderConfig: MessageFns<LDAPIdentityProviderConfig>
message.bindPassword = object.bindPassword ?? "";
message.baseDn = object.baseDn ?? "";
message.userFilter = object.userFilter ?? "";
- message.securityProtocol = object.securityProtocol ?? "";
+ message.securityProtocol = object.securityProtocol ??
+ LDAPIdentityProviderConfig_SecurityProtocol.SECURITY_PROTOCOL_UNSPECIFIED;
message.fieldMapping = (object.fieldMapping !== undefined && object.fieldMapping !== null)
? FieldMapping.fromPartial(object.fieldMapping)
: undefined;
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 1e30be4f8b..cd3c6e1662 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -10610,10 +10610,15 @@ components:
type: string
description: UserFilter is the filter to search for users, e.g. "(uid=%s)".
securityProtocol:
+ enum:
+ - SECURITY_PROTOCOL_UNSPECIFIED
+ - START_TLS
+ - LDAPS
type: string
description: |-
SecurityProtocol is the security protocol to be used for establishing
- connections with the LDAP server. It must be StartTLS, LDAPS or None.
+ connections with the LDAP server.
+ format: enum
fieldMapping:
allOf:
- $ref: '#/components/schemas/FieldMapping'
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 7ae068d607..817064d611 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -123,6 +123,7 @@
- [OIDCIdentityProviderConfig](#bytebase-store-OIDCIdentityProviderConfig)
- [IdentityProviderType](#bytebase-store-IdentityProviderType)
+ - [LDAPIdentityProviderConfig.SecurityProtocol](#bytebase-store-LDAPIdentityProviderConfig-SecurityProtocol)
- [OAuth2AuthStyle](#bytebase-store-OAuth2AuthStyle)
- [store/instance.proto](#store_instance-proto)
@@ -2109,7 +2110,7 @@ LDAPIdentityProviderConfig is the structure for LDAP identity provider config.
| bind_password | [string](#string) | | BindPassword is the password of the user to bind as a service account. |
| base_dn | [string](#string) | | BaseDN is the base DN to search for users, e.g. &#34;ou=users,dc=example,dc=com&#34;. |
| user_filter | [string](#string) | | UserFilter is the filter to search for users, e.g. &#34;(uid=%s)&#34;. |
-| security_protocol | [string](#string) | | SecurityProtocol is the security protocol to be used for establishing connections with the LDAP server. It should be either StartTLS or LDAPS, and cannot be empty. |
+| security_protocol | [LDAPIdentityProviderConfig.SecurityProtocol](#bytebase-store-LDAPIdentityProviderConfig-SecurityProtocol) | | SecurityProtocol is the security protocol to be used for establishing connections with the LDAP server. |
| field_mapping | [FieldMapping](#bytebase-store-FieldMapping) | | FieldMapping is the mapping of the user attributes returned by the LDAP server. |
@@ -2177,6 +2178,19 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.
+<a name="bytebase-store-LDAPIdentityProviderConfig-SecurityProtocol"></a>
+
+### LDAPIdentityProviderConfig.SecurityProtocol
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| SECURITY_PROTOCOL_UNSPECIFIED | 0 | |
+| START_TLS | 1 | StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS. |
+| LDAPS | 2 | LDAPS is the security protocol that uses TLS from the beginning. |
+
+
+
<a name="bytebase-store-OAuth2AuthStyle"></a>
### OAuth2AuthStyle
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index aa253a10f2..43e1b67e42 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -660,6 +660,10 @@
<a href="#bytebase.store.IdentityProviderType"><span class="badge">E</span>IdentityProviderType</a>
</li>
+ <li>
+ <a href="#bytebase.store.LDAPIdentityProviderConfig.SecurityProtocol"><span class="badge">E</span>LDAPIdentityProviderConfig.SecurityProtocol</a>
+ </li>
+
<li>
<a href="#bytebase.store.OAuth2AuthStyle"><span class="badge">E</span>OAuth2AuthStyle</a>
</li>
@@ -6058,11 +6062,10 @@ search requests. </p></td>
<tr>
<td>security_protocol</td>
- <td><a href="#string">string</a></td>
+ <td><a href="#bytebase.store.LDAPIdentityProviderConfig.SecurityProtocol">LDAPIdentityProviderConfig.SecurityProtocol</a></td>
<td></td>
<td><p>SecurityProtocol is the security protocol to be used for establishing
-connections with the LDAP server. It should be either StartTLS or LDAPS, and
-cannot be empty. </p></td>
+connections with the LDAP server. </p></td>
</tr>
<tr>
@@ -6263,6 +6266,35 @@ server. </p></td>
</tbody>
</table>
+ <h3 id="bytebase.store.LDAPIdentityProviderConfig.SecurityProtocol">LDAPIdentityProviderConfig.SecurityProtocol</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>SECURITY_PROTOCOL_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>START_TLS</td>
+ <td>1</td>
+ <td><p>StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS.</p></td>
+ </tr>
+
+ <tr>
+ <td>LDAPS</td>
+ <td>2</td>
+ <td><p>LDAPS is the security protocol that uses TLS from the beginning.</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
<h3 id="bytebase.store.OAuth2AuthStyle">OAuth2AuthStyle</h3>
<p></p>
<table class="enum-table">
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index a0e76d2055..8a2927cfb7 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -385,6 +385,7 @@
- [UpdateIdentityProviderRequest](#bytebase-v1-UpdateIdentityProviderRequest)
- [IdentityProviderType](#bytebase-v1-IdentityProviderType)
+ - [LDAPIdentityProviderConfig.SecurityProtocol](#bytebase-v1-LDAPIdentityProviderConfig-SecurityProtocol)
- [OAuth2AuthStyle](#bytebase-v1-OAuth2AuthStyle)
- [IdentityProviderService](#bytebase-v1-IdentityProviderService)
@@ -6324,7 +6325,7 @@ LDAPIdentityProviderConfig is the structure for LDAP identity provider config.
| bind_password | [string](#string) | | BindPassword is the password of the user to bind as a service account. |
| base_dn | [string](#string) | | BaseDN is the base DN to search for users, e.g. &#34;ou=users,dc=example,dc=com&#34;. |
| user_filter | [string](#string) | | UserFilter is the filter to search for users, e.g. &#34;(uid=%s)&#34;. |
-| security_protocol | [string](#string) | | SecurityProtocol is the security protocol to be used for establishing connections with the LDAP server. It must be StartTLS, LDAPS or None. |
+| security_protocol | [LDAPIdentityProviderConfig.SecurityProtocol](#bytebase-v1-LDAPIdentityProviderConfig-SecurityProtocol) | | SecurityProtocol is the security protocol to be used for establishing connections with the LDAP server. |
| field_mapping | [FieldMapping](#bytebase-v1-FieldMapping) | | FieldMapping is the mapping of the user attributes returned by the LDAP server. |
@@ -6486,6 +6487,19 @@ The identity provider&#39;s `name` field is used to identify the identity provid
+<a name="bytebase-v1-LDAPIdentityProviderConfig-SecurityProtocol"></a>
+
+### LDAPIdentityProviderConfig.SecurityProtocol
+
+
+| Name | Number | Description |
+| ---- | ------ | ----------- |
+| SECURITY_PROTOCOL_UNSPECIFIED | 0 | |
+| START_TLS | 1 | StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS. |
+| LDAPS | 2 | LDAPS is the security protocol that uses TLS from the beginning. |
+
+
+
<a name="bytebase-v1-OAuth2AuthStyle"></a>
### OAuth2AuthStyle
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 881461e6f3..e9b611b783 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -1646,6 +1646,10 @@
<a href="#bytebase.v1.IdentityProviderType"><span class="badge">E</span>IdentityProviderType</a>
</li>
+ <li>
+ <a href="#bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol"><span class="badge">E</span>LDAPIdentityProviderConfig.SecurityProtocol</a>
+ </li>
+
<li>
<a href="#bytebase.v1.OAuth2AuthStyle"><span class="badge">E</span>OAuth2AuthStyle</a>
</li>
@@ -17812,10 +17816,10 @@ search requests. </p></td>
<tr>
<td>security_protocol</td>
- <td><a href="#string">string</a></td>
+ <td><a href="#bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol">LDAPIdentityProviderConfig.SecurityProtocol</a></td>
<td></td>
<td><p>SecurityProtocol is the security protocol to be used for establishing
-connections with the LDAP server. It must be StartTLS, LDAPS or None. </p></td>
+connections with the LDAP server. </p></td>
</tr>
<tr>
@@ -18193,6 +18197,35 @@ Format: idps/{identity_provider} </p></td>
</tbody>
</table>
+ <h3 id="bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol">LDAPIdentityProviderConfig.SecurityProtocol</h3>
+ <p></p>
+ <table class="enum-table">
+ <thead>
+ <tr><td>Name</td><td>Number</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>SECURITY_PROTOCOL_UNSPECIFIED</td>
+ <td>0</td>
+ <td><p></p></td>
+ </tr>
+
+ <tr>
+ <td>START_TLS</td>
+ <td>1</td>
+ <td><p>StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS.</p></td>
+ </tr>
+
+ <tr>
+ <td>LDAPS</td>
+ <td>2</td>
+ <td><p>LDAPS is the security protocol that uses TLS from the beginning.</p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
<h3 id="bytebase.v1.OAuth2AuthStyle">OAuth2AuthStyle</h3>
<p></p>
<table class="enum-table">
diff --git a/proto/generated-go/store/idp.pb.go b/proto/generated-go/store/idp.pb.go
index b02b45d8f9..849a8360f5 100644
--- a/proto/generated-go/store/idp.pb.go
+++ b/proto/generated-go/store/idp.pb.go
@@ -126,6 +126,55 @@ func (OAuth2AuthStyle) EnumDescriptor() ([]byte, []int) {
return file_store_idp_proto_rawDescGZIP(), []int{1}
}
+type LDAPIdentityProviderConfig_SecurityProtocol int32
+
+const (
+ LDAPIdentityProviderConfig_SECURITY_PROTOCOL_UNSPECIFIED LDAPIdentityProviderConfig_SecurityProtocol = 0
+ LDAPIdentityProviderConfig_START_TLS LDAPIdentityProviderConfig_SecurityProtocol = 1 // StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS.
+ LDAPIdentityProviderConfig_LDAPS LDAPIdentityProviderConfig_SecurityProtocol = 2 // LDAPS is the security protocol that uses TLS from the beginning.
+)
+
+// Enum value maps for LDAPIdentityProviderConfig_SecurityProtocol.
+var (
+ LDAPIdentityProviderConfig_SecurityProtocol_name = map[int32]string{
+ 0: "SECURITY_PROTOCOL_UNSPECIFIED",
+ 1: "START_TLS",
+ 2: "LDAPS",
+ }
+ LDAPIdentityProviderConfig_SecurityProtocol_value = map[string]int32{
+ "SECURITY_PROTOCOL_UNSPECIFIED": 0,
+ "START_TLS": 1,
+ "LDAPS": 2,
+ }
+)
+
+func (x LDAPIdentityProviderConfig_SecurityProtocol) Enum() *LDAPIdentityProviderConfig_SecurityProtocol {
+ p := new(LDAPIdentityProviderConfig_SecurityProtocol)
+ *p = x
+ return p
+}
+
+func (x LDAPIdentityProviderConfig_SecurityProtocol) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (LDAPIdentityProviderConfig_SecurityProtocol) Descriptor() protoreflect.EnumDescriptor {
+ return file_store_idp_proto_enumTypes[2].Descriptor()
+}
+
+func (LDAPIdentityProviderConfig_SecurityProtocol) Type() protoreflect.EnumType {
+ return &file_store_idp_proto_enumTypes[2]
+}
+
+func (x LDAPIdentityProviderConfig_SecurityProtocol) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use LDAPIdentityProviderConfig_SecurityProtocol.Descriptor instead.
+func (LDAPIdentityProviderConfig_SecurityProtocol) EnumDescriptor() ([]byte, []int) {
+ return file_store_idp_proto_rawDescGZIP(), []int{3, 0}
+}
+
type IdentityProviderConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Config:
@@ -448,9 +497,8 @@ type LDAPIdentityProviderConfig struct {
// UserFilter is the filter to search for users, e.g. "(uid=%s)".
UserFilter string `protobuf:"bytes,7,opt,name=user_filter,json=userFilter,proto3" json:"user_filter,omitempty"`
// SecurityProtocol is the security protocol to be used for establishing
- // connections with the LDAP server. It should be either StartTLS or LDAPS, and
- // cannot be empty.
- SecurityProtocol string `protobuf:"bytes,8,opt,name=security_protocol,json=securityProtocol,proto3" json:"security_protocol,omitempty"`
+ // connections with the LDAP server.
+ SecurityProtocol LDAPIdentityProviderConfig_SecurityProtocol `protobuf:"varint,8,opt,name=security_protocol,json=securityProtocol,proto3,enum=bytebase.store.LDAPIdentityProviderConfig_SecurityProtocol" json:"security_protocol,omitempty"`
// FieldMapping is the mapping of the user attributes returned by the LDAP
// server.
FieldMapping *FieldMapping `protobuf:"bytes,9,opt,name=field_mapping,json=fieldMapping,proto3" json:"field_mapping,omitempty"`
@@ -537,11 +585,11 @@ func (x *LDAPIdentityProviderConfig) GetUserFilter() string {
return ""
}
-func (x *LDAPIdentityProviderConfig) GetSecurityProtocol() string {
+func (x *LDAPIdentityProviderConfig) GetSecurityProtocol() LDAPIdentityProviderConfig_SecurityProtocol {
if x != nil {
return x.SecurityProtocol
}
- return ""
+ return LDAPIdentityProviderConfig_SECURITY_PROTOCOL_UNSPECIFIED
}
func (x *LDAPIdentityProviderConfig) GetFieldMapping() *FieldMapping {
@@ -739,7 +787,7 @@ const file_store_idp_proto_rawDesc = "" +
"\x0fskip_tls_verify\x18\x05 \x01(\bR\rskipTlsVerify\x12>\n" +
"\n" +
"auth_style\x18\x06 \x01(\x0e2\x1f.bytebase.store.OAuth2AuthStyleR\tauthStyle\x12\x16\n" +
- "\x06scopes\x18\a \x03(\tR\x06scopes\"\xd4\x02\n" +
+ "\x06scopes\x18\a \x03(\tR\x06scopes\"\xe2\x03\n" +
"\x1aLDAPIdentityProviderConfig\x12\x12\n" +
"\x04host\x18\x01 \x01(\tR\x04host\x12\x12\n" +
"\x04port\x18\x02 \x01(\x05R\x04port\x12&\n" +
@@ -748,9 +796,13 @@ const file_store_idp_proto_rawDesc = "" +
"\rbind_password\x18\x05 \x01(\tR\fbindPassword\x12\x17\n" +
"\abase_dn\x18\x06 \x01(\tR\x06baseDn\x12\x1f\n" +
"\vuser_filter\x18\a \x01(\tR\n" +
- "userFilter\x12+\n" +
- "\x11security_protocol\x18\b \x01(\tR\x10securityProtocol\x12A\n" +
- "\rfield_mapping\x18\t \x01(\v2\x1c.bytebase.store.FieldMappingR\ffieldMapping\"\x85\x01\n" +
+ "userFilter\x12h\n" +
+ "\x11security_protocol\x18\b \x01(\x0e2;.bytebase.store.LDAPIdentityProviderConfig.SecurityProtocolR\x10securityProtocol\x12A\n" +
+ "\rfield_mapping\x18\t \x01(\v2\x1c.bytebase.store.FieldMappingR\ffieldMapping\"O\n" +
+ "\x10SecurityProtocol\x12!\n" +
+ "\x1dSECURITY_PROTOCOL_UNSPECIFIED\x10\x00\x12\r\n" +
+ "\tSTART_TLS\x10\x01\x12\t\n" +
+ "\x05LDAPS\x10\x02\"\x85\x01\n" +
"\fFieldMapping\x12\x1e\n" +
"\n" +
"identifier\x18\x01 \x01(\tR\n" +
@@ -790,32 +842,34 @@ func file_store_idp_proto_rawDescGZIP() []byte {
return file_store_idp_proto_rawDescData
}
-var file_store_idp_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
+var file_store_idp_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_store_idp_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_store_idp_proto_goTypes = []any{
- (IdentityProviderType)(0), // 0: bytebase.store.IdentityProviderType
- (OAuth2AuthStyle)(0), // 1: bytebase.store.OAuth2AuthStyle
- (*IdentityProviderConfig)(nil), // 2: bytebase.store.IdentityProviderConfig
- (*OAuth2IdentityProviderConfig)(nil), // 3: bytebase.store.OAuth2IdentityProviderConfig
- (*OIDCIdentityProviderConfig)(nil), // 4: bytebase.store.OIDCIdentityProviderConfig
- (*LDAPIdentityProviderConfig)(nil), // 5: bytebase.store.LDAPIdentityProviderConfig
- (*FieldMapping)(nil), // 6: bytebase.store.FieldMapping
- (*IdentityProviderUserInfo)(nil), // 7: bytebase.store.IdentityProviderUserInfo
+ (IdentityProviderType)(0), // 0: bytebase.store.IdentityProviderType
+ (OAuth2AuthStyle)(0), // 1: bytebase.store.OAuth2AuthStyle
+ (LDAPIdentityProviderConfig_SecurityProtocol)(0), // 2: bytebase.store.LDAPIdentityProviderConfig.SecurityProtocol
+ (*IdentityProviderConfig)(nil), // 3: bytebase.store.IdentityProviderConfig
+ (*OAuth2IdentityProviderConfig)(nil), // 4: bytebase.store.OAuth2IdentityProviderConfig
+ (*OIDCIdentityProviderConfig)(nil), // 5: bytebase.store.OIDCIdentityProviderConfig
+ (*LDAPIdentityProviderConfig)(nil), // 6: bytebase.store.LDAPIdentityProviderConfig
+ (*FieldMapping)(nil), // 7: bytebase.store.FieldMapping
+ (*IdentityProviderUserInfo)(nil), // 8: bytebase.store.IdentityProviderUserInfo
}
var file_store_idp_proto_depIdxs = []int32{
- 3, // 0: bytebase.store.IdentityProviderConfig.oauth2_config:type_name -> bytebase.store.OAuth2IdentityProviderConfig
- 4, // 1: bytebase.store.IdentityProviderConfig.oidc_config:type_name -> bytebase.store.OIDCIdentityProviderConfig
- 5, // 2: bytebase.store.IdentityProviderConfig.ldap_config:type_name -> bytebase.store.LDAPIdentityProviderConfig
- 6, // 3: bytebase.store.OAuth2IdentityProviderConfig.field_mapping:type_name -> bytebase.store.FieldMapping
+ 4, // 0: bytebase.store.IdentityProviderConfig.oauth2_config:type_name -> bytebase.store.OAuth2IdentityProviderConfig
+ 5, // 1: bytebase.store.IdentityProviderConfig.oidc_config:type_name -> bytebase.store.OIDCIdentityProviderConfig
+ 6, // 2: bytebase.store.IdentityProviderConfig.ldap_config:type_name -> bytebase.store.LDAPIdentityProviderConfig
+ 7, // 3: bytebase.store.OAuth2IdentityProviderConfig.field_mapping:type_name -> bytebase.store.FieldMapping
1, // 4: bytebase.store.OAuth2IdentityProviderConfig.auth_style:type_name -> bytebase.store.OAuth2AuthStyle
- 6, // 5: bytebase.store.OIDCIdentityProviderConfig.field_mapping:type_name -> bytebase.store.FieldMapping
+ 7, // 5: bytebase.store.OIDCIdentityProviderConfig.field_mapping:type_name -> bytebase.store.FieldMapping
1, // 6: bytebase.store.OIDCIdentityProviderConfig.auth_style:type_name -> bytebase.store.OAuth2AuthStyle
- 6, // 7: bytebase.store.LDAPIdentityProviderConfig.field_mapping:type_name -> bytebase.store.FieldMapping
- 8, // [8:8] is the sub-list for method output_type
- 8, // [8:8] is the sub-list for method input_type
- 8, // [8:8] is the sub-list for extension type_name
- 8, // [8:8] is the sub-list for extension extendee
- 0, // [0:8] is the sub-list for field type_name
+ 2, // 7: bytebase.store.LDAPIdentityProviderConfig.security_protocol:type_name -> bytebase.store.LDAPIdentityProviderConfig.SecurityProtocol
+ 7, // 8: bytebase.store.LDAPIdentityProviderConfig.field_mapping:type_name -> bytebase.store.FieldMapping
+ 9, // [9:9] is the sub-list for method output_type
+ 9, // [9:9] is the sub-list for method input_type
+ 9, // [9:9] is the sub-list for extension type_name
+ 9, // [9:9] is the sub-list for extension extendee
+ 0, // [0:9] is the sub-list for field type_name
}
func init() { file_store_idp_proto_init() }
@@ -833,7 +887,7 @@ func file_store_idp_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_idp_proto_rawDesc), len(file_store_idp_proto_rawDesc)),
- NumEnums: 2,
+ NumEnums: 3,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
diff --git a/proto/generated-go/v1/idp_service.pb.go b/proto/generated-go/v1/idp_service.pb.go
index e07d6dafe3..a2612d94c2 100644
--- a/proto/generated-go/v1/idp_service.pb.go
+++ b/proto/generated-go/v1/idp_service.pb.go
@@ -129,6 +129,55 @@ func (OAuth2AuthStyle) EnumDescriptor() ([]byte, []int) {
return file_v1_idp_service_proto_rawDescGZIP(), []int{1}
}
+type LDAPIdentityProviderConfig_SecurityProtocol int32
+
+const (
+ LDAPIdentityProviderConfig_SECURITY_PROTOCOL_UNSPECIFIED LDAPIdentityProviderConfig_SecurityProtocol = 0
+ LDAPIdentityProviderConfig_START_TLS LDAPIdentityProviderConfig_SecurityProtocol = 1 // StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS.
+ LDAPIdentityProviderConfig_LDAPS LDAPIdentityProviderConfig_SecurityProtocol = 2 // LDAPS is the security protocol that uses TLS from the beginning.
+)
+
+// Enum value maps for LDAPIdentityProviderConfig_SecurityProtocol.
+var (
+ LDAPIdentityProviderConfig_SecurityProtocol_name = map[int32]string{
+ 0: "SECURITY_PROTOCOL_UNSPECIFIED",
+ 1: "START_TLS",
+ 2: "LDAPS",
+ }
+ LDAPIdentityProviderConfig_SecurityProtocol_value = map[string]int32{
+ "SECURITY_PROTOCOL_UNSPECIFIED": 0,
+ "START_TLS": 1,
+ "LDAPS": 2,
+ }
+)
+
+func (x LDAPIdentityProviderConfig_SecurityProtocol) Enum() *LDAPIdentityProviderConfig_SecurityProtocol {
+ p := new(LDAPIdentityProviderConfig_SecurityProtocol)
+ *p = x
+ return p
+}
+
+func (x LDAPIdentityProviderConfig_SecurityProtocol) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (LDAPIdentityProviderConfig_SecurityProtocol) Descriptor() protoreflect.EnumDescriptor {
+ return file_v1_idp_service_proto_enumTypes[2].Descriptor()
+}
+
+func (LDAPIdentityProviderConfig_SecurityProtocol) Type() protoreflect.EnumType {
+ return &file_v1_idp_service_proto_enumTypes[2]
+}
+
+func (x LDAPIdentityProviderConfig_SecurityProtocol) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use LDAPIdentityProviderConfig_SecurityProtocol.Descriptor instead.
+func (LDAPIdentityProviderConfig_SecurityProtocol) EnumDescriptor() ([]byte, []int) {
+ return file_v1_idp_service_proto_rawDescGZIP(), []int{13, 0}
+}
+
type GetIdentityProviderRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@@ -1029,8 +1078,8 @@ type LDAPIdentityProviderConfig struct {
// UserFilter is the filter to search for users, e.g. "(uid=%s)".
UserFilter string `protobuf:"bytes,7,opt,name=user_filter,json=userFilter,proto3" json:"user_filter,omitempty"`
// SecurityProtocol is the security protocol to be used for establishing
- // connections with the LDAP server. It must be StartTLS, LDAPS or None.
- SecurityProtocol string `protobuf:"bytes,8,opt,name=security_protocol,json=securityProtocol,proto3" json:"security_protocol,omitempty"`
+ // connections with the LDAP server.
+ SecurityProtocol LDAPIdentityProviderConfig_SecurityProtocol `protobuf:"varint,8,opt,name=security_protocol,json=securityProtocol,proto3,enum=bytebase.v1.LDAPIdentityProviderConfig_SecurityProtocol" json:"security_protocol,omitempty"`
// FieldMapping is the mapping of the user attributes returned by the LDAP
// server.
FieldMapping *FieldMapping `protobuf:"bytes,9,opt,name=field_mapping,json=fieldMapping,proto3" json:"field_mapping,omitempty"`
@@ -1117,11 +1166,11 @@ func (x *LDAPIdentityProviderConfig) GetUserFilter() string {
return ""
}
-func (x *LDAPIdentityProviderConfig) GetSecurityProtocol() string {
+func (x *LDAPIdentityProviderConfig) GetSecurityProtocol() LDAPIdentityProviderConfig_SecurityProtocol {
if x != nil {
return x.SecurityProtocol
}
- return ""
+ return LDAPIdentityProviderConfig_SECURITY_PROTOCOL_UNSPECIFIED
}
func (x *LDAPIdentityProviderConfig) GetFieldMapping() *FieldMapping {
@@ -1275,7 +1324,7 @@ const file_v1_idp_service_proto_rawDesc = "" +
"\x0fskip_tls_verify\x18\x06 \x01(\bR\rskipTlsVerify\x12;\n" +
"\n" +
"auth_style\x18\a \x01(\x0e2\x1c.bytebase.v1.OAuth2AuthStyleR\tauthStyle\x12)\n" +
- "\rauth_endpoint\x18\b \x01(\tB\x04\xe2A\x01\x03R\fauthEndpoint\"\xd1\x02\n" +
+ "\rauth_endpoint\x18\b \x01(\tB\x04\xe2A\x01\x03R\fauthEndpoint\"\xdc\x03\n" +
"\x1aLDAPIdentityProviderConfig\x12\x12\n" +
"\x04host\x18\x01 \x01(\tR\x04host\x12\x12\n" +
"\x04port\x18\x02 \x01(\x05R\x04port\x12&\n" +
@@ -1284,9 +1333,13 @@ const file_v1_idp_service_proto_rawDesc = "" +
"\rbind_password\x18\x05 \x01(\tR\fbindPassword\x12\x17\n" +
"\abase_dn\x18\x06 \x01(\tR\x06baseDn\x12\x1f\n" +
"\vuser_filter\x18\a \x01(\tR\n" +
- "userFilter\x12+\n" +
- "\x11security_protocol\x18\b \x01(\tR\x10securityProtocol\x12>\n" +
- "\rfield_mapping\x18\t \x01(\v2\x19.bytebase.v1.FieldMappingR\ffieldMapping\"\x85\x01\n" +
+ "userFilter\x12e\n" +
+ "\x11security_protocol\x18\b \x01(\x0e28.bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocolR\x10securityProtocol\x12>\n" +
+ "\rfield_mapping\x18\t \x01(\v2\x19.bytebase.v1.FieldMappingR\ffieldMapping\"O\n" +
+ "\x10SecurityProtocol\x12!\n" +
+ "\x1dSECURITY_PROTOCOL_UNSPECIFIED\x10\x00\x12\r\n" +
+ "\tSTART_TLS\x10\x01\x12\t\n" +
+ "\x05LDAPS\x10\x02\"\x85\x01\n" +
"\fFieldMapping\x12\x1e\n" +
"\n" +
"identifier\x18\x01 \x01(\tR\n" +
@@ -1325,63 +1378,65 @@ func file_v1_idp_service_proto_rawDescGZIP() []byte {
return file_v1_idp_service_proto_rawDescData
}
-var file_v1_idp_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
+var file_v1_idp_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_v1_idp_service_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_v1_idp_service_proto_goTypes = []any{
(IdentityProviderType)(0), // 0: bytebase.v1.IdentityProviderType
(OAuth2AuthStyle)(0), // 1: bytebase.v1.OAuth2AuthStyle
- (*GetIdentityProviderRequest)(nil), // 2: bytebase.v1.GetIdentityProviderRequest
- (*ListIdentityProvidersRequest)(nil), // 3: bytebase.v1.ListIdentityProvidersRequest
- (*ListIdentityProvidersResponse)(nil), // 4: bytebase.v1.ListIdentityProvidersResponse
- (*CreateIdentityProviderRequest)(nil), // 5: bytebase.v1.CreateIdentityProviderRequest
- (*UpdateIdentityProviderRequest)(nil), // 6: bytebase.v1.UpdateIdentityProviderRequest
- (*DeleteIdentityProviderRequest)(nil), // 7: bytebase.v1.DeleteIdentityProviderRequest
- (*TestIdentityProviderRequest)(nil), // 8: bytebase.v1.TestIdentityProviderRequest
- (*OAuth2IdentityProviderTestRequestContext)(nil), // 9: bytebase.v1.OAuth2IdentityProviderTestRequestContext
- (*TestIdentityProviderResponse)(nil), // 10: bytebase.v1.TestIdentityProviderResponse
- (*IdentityProvider)(nil), // 11: bytebase.v1.IdentityProvider
- (*IdentityProviderConfig)(nil), // 12: bytebase.v1.IdentityProviderConfig
- (*OAuth2IdentityProviderConfig)(nil), // 13: bytebase.v1.OAuth2IdentityProviderConfig
- (*OIDCIdentityProviderConfig)(nil), // 14: bytebase.v1.OIDCIdentityProviderConfig
- (*LDAPIdentityProviderConfig)(nil), // 15: bytebase.v1.LDAPIdentityProviderConfig
- (*FieldMapping)(nil), // 16: bytebase.v1.FieldMapping
- (*fieldmaskpb.FieldMask)(nil), // 17: google.protobuf.FieldMask
- (*emptypb.Empty)(nil), // 18: google.protobuf.Empty
+ (LDAPIdentityProviderConfig_SecurityProtocol)(0), // 2: bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol
+ (*GetIdentityProviderRequest)(nil), // 3: bytebase.v1.GetIdentityProviderRequest
+ (*ListIdentityProvidersRequest)(nil), // 4: bytebase.v1.ListIdentityProvidersRequest
+ (*ListIdentityProvidersResponse)(nil), // 5: bytebase.v1.ListIdentityProvidersResponse
+ (*CreateIdentityProviderRequest)(nil), // 6: bytebase.v1.CreateIdentityProviderRequest
+ (*UpdateIdentityProviderRequest)(nil), // 7: bytebase.v1.UpdateIdentityProviderRequest
+ (*DeleteIdentityProviderRequest)(nil), // 8: bytebase.v1.DeleteIdentityProviderRequest
+ (*TestIdentityProviderRequest)(nil), // 9: bytebase.v1.TestIdentityProviderRequest
+ (*OAuth2IdentityProviderTestRequestContext)(nil), // 10: bytebase.v1.OAuth2IdentityProviderTestRequestContext
+ (*TestIdentityProviderResponse)(nil), // 11: bytebase.v1.TestIdentityProviderResponse
+ (*IdentityProvider)(nil), // 12: bytebase.v1.IdentityProvider
+ (*IdentityProviderConfig)(nil), // 13: bytebase.v1.IdentityProviderConfig
+ (*OAuth2IdentityProviderConfig)(nil), // 14: bytebase.v1.OAuth2IdentityProviderConfig
+ (*OIDCIdentityProviderConfig)(nil), // 15: bytebase.v1.OIDCIdentityProviderConfig
+ (*LDAPIdentityProviderConfig)(nil), // 16: bytebase.v1.LDAPIdentityProviderConfig
+ (*FieldMapping)(nil), // 17: bytebase.v1.FieldMapping
+ (*fieldmaskpb.FieldMask)(nil), // 18: google.protobuf.FieldMask
+ (*emptypb.Empty)(nil), // 19: google.protobuf.Empty
}
var file_v1_idp_service_proto_depIdxs = []int32{
- 11, // 0: bytebase.v1.ListIdentityProvidersResponse.identity_providers:type_name -> bytebase.v1.IdentityProvider
- 11, // 1: bytebase.v1.CreateIdentityProviderRequest.identity_provider:type_name -> bytebase.v1.IdentityProvider
- 11, // 2: bytebase.v1.UpdateIdentityProviderRequest.identity_provider:type_name -> bytebase.v1.IdentityProvider
- 17, // 3: bytebase.v1.UpdateIdentityProviderRequest.update_mask:type_name -> google.protobuf.FieldMask
- 11, // 4: bytebase.v1.TestIdentityProviderRequest.identity_provider:type_name -> bytebase.v1.IdentityProvider
- 9, // 5: bytebase.v1.TestIdentityProviderRequest.oauth2_context:type_name -> bytebase.v1.OAuth2IdentityProviderTestRequestContext
+ 12, // 0: bytebase.v1.ListIdentityProvidersResponse.identity_providers:type_name -> bytebase.v1.IdentityProvider
+ 12, // 1: bytebase.v1.CreateIdentityProviderRequest.identity_provider:type_name -> bytebase.v1.IdentityProvider
+ 12, // 2: bytebase.v1.UpdateIdentityProviderRequest.identity_provider:type_name -> bytebase.v1.IdentityProvider
+ 18, // 3: bytebase.v1.UpdateIdentityProviderRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 12, // 4: bytebase.v1.TestIdentityProviderRequest.identity_provider:type_name -> bytebase.v1.IdentityProvider
+ 10, // 5: bytebase.v1.TestIdentityProviderRequest.oauth2_context:type_name -> bytebase.v1.OAuth2IdentityProviderTestRequestContext
0, // 6: bytebase.v1.IdentityProvider.type:type_name -> bytebase.v1.IdentityProviderType
- 12, // 7: bytebase.v1.IdentityProvider.config:type_name -> bytebase.v1.IdentityProviderConfig
- 13, // 8: bytebase.v1.IdentityProviderConfig.oauth2_config:type_name -> bytebase.v1.OAuth2IdentityProviderConfig
- 14, // 9: bytebase.v1.IdentityProviderConfig.oidc_config:type_name -> bytebase.v1.OIDCIdentityProviderConfig
- 15, // 10: bytebase.v1.IdentityProviderConfig.ldap_config:type_name -> bytebase.v1.LDAPIdentityProviderConfig
- 16, // 11: bytebase.v1.OAuth2IdentityProviderConfig.field_mapping:type_name -> bytebase.v1.FieldMapping
+ 13, // 7: bytebase.v1.IdentityProvider.config:type_name -> bytebase.v1.IdentityProviderConfig
+ 14, // 8: bytebase.v1.IdentityProviderConfig.oauth2_config:type_name -> bytebase.v1.OAuth2IdentityProviderConfig
+ 15, // 9: bytebase.v1.IdentityProviderConfig.oidc_config:type_name -> bytebase.v1.OIDCIdentityProviderConfig
+ 16, // 10: bytebase.v1.IdentityProviderConfig.ldap_config:type_name -> bytebase.v1.LDAPIdentityProviderConfig
+ 17, // 11: bytebase.v1.OAuth2IdentityProviderConfig.field_mapping:type_name -> bytebase.v1.FieldMapping
1, // 12: bytebase.v1.OAuth2IdentityProviderConfig.auth_style:type_name -> bytebase.v1.OAuth2AuthStyle
- 16, // 13: bytebase.v1.OIDCIdentityProviderConfig.field_mapping:type_name -> bytebase.v1.FieldMapping
+ 17, // 13: bytebase.v1.OIDCIdentityProviderConfig.field_mapping:type_name -> bytebase.v1.FieldMapping
1, // 14: bytebase.v1.OIDCIdentityProviderConfig.auth_style:type_name -> bytebase.v1.OAuth2AuthStyle
- 16, // 15: bytebase.v1.LDAPIdentityProviderConfig.field_mapping:type_name -> bytebase.v1.FieldMapping
- 2, // 16: bytebase.v1.IdentityProviderService.GetIdentityProvider:input_type -> bytebase.v1.GetIdentityProviderRequest
- 3, // 17: bytebase.v1.IdentityProviderService.ListIdentityProviders:input_type -> bytebase.v1.ListIdentityProvidersRequest
- 5, // 18: bytebase.v1.IdentityProviderService.CreateIdentityProvider:input_type -> bytebase.v1.CreateIdentityProviderRequest
- 6, // 19: bytebase.v1.IdentityProviderService.UpdateIdentityProvider:input_type -> bytebase.v1.UpdateIdentityProviderRequest
- 7, // 20: bytebase.v1.IdentityProviderService.DeleteIdentityProvider:input_type -> bytebase.v1.DeleteIdentityProviderRequest
- 8, // 21: bytebase.v1.IdentityProviderService.TestIdentityProvider:input_type -> bytebase.v1.TestIdentityProviderRequest
- 11, // 22: bytebase.v1.IdentityProviderService.GetIdentityProvider:output_type -> bytebase.v1.IdentityProvider
- 4, // 23: bytebase.v1.IdentityProviderService.ListIdentityProviders:output_type -> bytebase.v1.ListIdentityProvidersResponse
- 11, // 24: bytebase.v1.IdentityProviderService.CreateIdentityProvider:output_type -> bytebase.v1.IdentityProvider
- 11, // 25: bytebase.v1.IdentityProviderService.UpdateIdentityProvider:output_type -> bytebase.v1.IdentityProvider
- 18, // 26: bytebase.v1.IdentityProviderService.DeleteIdentityProvider:output_type -> google.protobuf.Empty
- 10, // 27: bytebase.v1.IdentityProviderService.TestIdentityProvider:output_type -> bytebase.v1.TestIdentityProviderResponse
- 22, // [22:28] is the sub-list for method output_type
- 16, // [16:22] is the sub-list for method input_type
- 16, // [16:16] is the sub-list for extension type_name
- 16, // [16:16] is the sub-list for extension extendee
- 0, // [0:16] is the sub-list for field type_name
+ 2, // 15: bytebase.v1.LDAPIdentityProviderConfig.security_protocol:type_name -> bytebase.v1.LDAPIdentityProviderConfig.SecurityProtocol
+ 17, // 16: bytebase.v1.LDAPIdentityProviderConfig.field_mapping:type_name -> bytebase.v1.FieldMapping
+ 3, // 17: bytebase.v1.IdentityProviderService.GetIdentityProvider:input_type -> bytebase.v1.GetIdentityProviderRequest
+ 4, // 18: bytebase.v1.IdentityProviderService.ListIdentityProviders:input_type -> bytebase.v1.ListIdentityProvidersRequest
+ 6, // 19: bytebase.v1.IdentityProviderService.CreateIdentityProvider:input_type -> bytebase.v1.CreateIdentityProviderRequest
+ 7, // 20: bytebase.v1.IdentityProviderService.UpdateIdentityProvider:input_type -> bytebase.v1.UpdateIdentityProviderRequest
+ 8, // 21: bytebase.v1.IdentityProviderService.DeleteIdentityProvider:input_type -> bytebase.v1.DeleteIdentityProviderRequest
+ 9, // 22: bytebase.v1.IdentityProviderService.TestIdentityProvider:input_type -> bytebase.v1.TestIdentityProviderRequest
+ 12, // 23: bytebase.v1.IdentityProviderService.GetIdentityProvider:output_type -> bytebase.v1.IdentityProvider
+ 5, // 24: bytebase.v1.IdentityProviderService.ListIdentityProviders:output_type -> bytebase.v1.ListIdentityProvidersResponse
+ 12, // 25: bytebase.v1.IdentityProviderService.CreateIdentityProvider:output_type -> bytebase.v1.IdentityProvider
+ 12, // 26: bytebase.v1.IdentityProviderService.UpdateIdentityProvider:output_type -> bytebase.v1.IdentityProvider
+ 19, // 27: bytebase.v1.IdentityProviderService.DeleteIdentityProvider:output_type -> google.protobuf.Empty
+ 11, // 28: bytebase.v1.IdentityProviderService.TestIdentityProvider:output_type -> bytebase.v1.TestIdentityProviderResponse
+ 23, // [23:29] is the sub-list for method output_type
+ 17, // [17:23] is the sub-list for method input_type
+ 17, // [17:17] is the sub-list for extension type_name
+ 17, // [17:17] is the sub-list for extension extendee
+ 0, // [0:17] is the sub-list for field type_name
}
func init() { file_v1_idp_service_proto_init() }
@@ -1403,7 +1458,7 @@ func file_v1_idp_service_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_idp_service_proto_rawDesc), len(file_v1_idp_service_proto_rawDesc)),
- NumEnums: 2,
+ NumEnums: 3,
NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
diff --git a/proto/store/store/idp.proto b/proto/store/store/idp.proto
index 6bfc99649b..a02ac537a3 100644
--- a/proto/store/store/idp.proto
+++ b/proto/store/store/idp.proto
@@ -78,12 +78,17 @@ message LDAPIdentityProviderConfig {
// UserFilter is the filter to search for users, e.g. "(uid=%s)".
string user_filter = 7;
// SecurityProtocol is the security protocol to be used for establishing
- // connections with the LDAP server. It should be either StartTLS or LDAPS, and
- // cannot be empty.
- string security_protocol = 8;
+ // connections with the LDAP server.
+ SecurityProtocol security_protocol = 8;
// FieldMapping is the mapping of the user attributes returned by the LDAP
// server.
FieldMapping field_mapping = 9;
+
+ enum SecurityProtocol {
+ SECURITY_PROTOCOL_UNSPECIFIED = 0;
+ START_TLS = 1; // StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS.
+ LDAPS = 2; // LDAPS is the security protocol that uses TLS from the beginning.
+ }
}
// FieldMapping saves the field names from user info API of identity provider.
diff --git a/proto/v1/v1/idp_service.proto b/proto/v1/v1/idp_service.proto
index 29f03a1ba4..dbc98d0b3c 100644
--- a/proto/v1/v1/idp_service.proto
+++ b/proto/v1/v1/idp_service.proto
@@ -252,11 +252,17 @@ message LDAPIdentityProviderConfig {
// UserFilter is the filter to search for users, e.g. "(uid=%s)".
string user_filter = 7;
// SecurityProtocol is the security protocol to be used for establishing
- // connections with the LDAP server. It must be StartTLS, LDAPS or None.
- string security_protocol = 8;
+ // connections with the LDAP server.
+ SecurityProtocol security_protocol = 8;
// FieldMapping is the mapping of the user attributes returned by the LDAP
// server.
FieldMapping field_mapping = 9;
+
+ enum SecurityProtocol {
+ SECURITY_PROTOCOL_UNSPECIFIED = 0;
+ START_TLS = 1; // StartTLS is the security protocol that starts with an unencrypted connection and then upgrades to TLS.
+ LDAPS = 2; // LDAPS is the security protocol that uses TLS from the beginning.
+ }
}
// FieldMapping saves the field names from user info API of identity provider.