Skip to content

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

chore: expose scopes config of oidc (#15743)

boojack676102cb135b
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.go
index 38aa43b92c..a022f62bca 100644
--- a/backend/api/v1/auth_service.go
+++ b/backend/api/v1/auth_service.go
@@ -335,18 +335,7 @@ func (s *AuthService) getOrCreateUserWithIDP(ctx context.Context, request *v1pb.
return nil, status.Errorf(codes.InvalidArgument, "missing OAuth2 context")
}
- idpConfig := idp.Config.GetOidcConfig()
- oidcIDP, err := oidc.NewIdentityProvider(
- ctx,
- oidc.IdentityProviderConfig{
- Issuer: idpConfig.Issuer,
- ClientID: idpConfig.ClientId,
- ClientSecret: idpConfig.ClientSecret,
- FieldMapping: idpConfig.FieldMapping,
- SkipTLSVerify: idpConfig.SkipTlsVerify,
- AuthStyle: idpConfig.GetAuthStyle(),
- },
- )
+ oidcIDP, err := oidc.NewIdentityProvider(ctx, idp.Config.GetOidcConfig())
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to create new OIDC identity provider: %v", err)
}
diff --git a/backend/api/v1/idp_service.go b/backend/api/v1/idp_service.go
index 9ae69542c5..1864602c49 100644
--- a/backend/api/v1/idp_service.go
+++ b/backend/api/v1/idp_service.go
@@ -317,17 +317,8 @@ func (s *IdentityProviderService) TestIdentityProvider(ctx context.Context, requ
if oauth2Context == nil {
return nil, status.Errorf(codes.InvalidArgument, "missing OAuth2 context")
}
- identityProviderConfig := convertIdentityProviderConfigToStore(identityProvider.Config).GetOidcConfig()
- oidcIdentityProvider, err := oidc.NewIdentityProvider(
- ctx,
- oidc.IdentityProviderConfig{
- Issuer: identityProviderConfig.Issuer,
- ClientID: identityProviderConfig.ClientId,
- ClientSecret: identityProviderConfig.ClientSecret,
- FieldMapping: identityProviderConfig.FieldMapping,
- SkipTLSVerify: identityProviderConfig.SkipTlsVerify,
- AuthStyle: identityProviderConfig.GetAuthStyle(),
- })
+ identityProviderConfig := convertIdentityProviderConfigToStore(identityProvider.Config)
+ oidcIdentityProvider, err := oidc.NewIdentityProvider(ctx, identityProviderConfig.GetOidcConfig())
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to create new OIDC identity provider: %v", err)
}
@@ -453,7 +444,7 @@ func convertIdentityProviderConfigFromStore(identityProviderConfig *storepb.Iden
FieldMapping: &fieldMapping,
SkipTlsVerify: v.SkipTlsVerify,
AuthStyle: v1pb.OAuth2AuthStyle(v.AuthStyle),
- Scopes: oidc.DefaultScopes,
+ Scopes: v.Scopes,
AuthEndpoint: "", // Leave it empty as it's not stored in the database.
}
@@ -537,6 +528,7 @@ func convertIdentityProviderConfigToStore(identityProviderConfig *v1pb.IdentityP
FieldMapping: &fieldMapping,
SkipTlsVerify: v.SkipTlsVerify,
AuthStyle: storepb.OAuth2AuthStyle(v.AuthStyle),
+ Scopes: v.Scopes,
},
},
}
diff --git a/backend/migrator/migration/3.5/0017##oidc_scopes.sql b/backend/migrator/migration/3.5/0017##oidc_scopes.sql
new file mode 100644
index 0000000000..66d15f2e56
--- /dev/null
+++ b/backend/migrator/migration/3.5/0017##oidc_scopes.sql
@@ -0,0 +1,8 @@
+UPDATE idp
+SET config = jsonb_set(
+ config,
+ '{scopes}',
+ '["openid", "profile", "email"]'::jsonb,
+ true
+)
+WHERE type = 'OIDC';
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 8966e82c2c..f622c0cf65 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.5.16"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.5.17"), *files[len(files)-1].version)
}
func TestGetVersionFromPath(t *testing.T) {
diff --git a/backend/plugin/idp/oidc/oidc.go b/backend/plugin/idp/oidc/oidc.go
index 63cdd8980d..c2661a834b 100644
--- a/backend/plugin/idp/oidc/oidc.go
+++ b/backend/plugin/idp/oidc/oidc.go
@@ -23,26 +23,15 @@ import (
type IdentityProvider struct {
client *http.Client
provider *oidc.Provider
- config IdentityProviderConfig
-}
-
-// IdentityProviderConfig is the configuration to be consumed by the OIDC
-// Identity Provider.
-type IdentityProviderConfig struct {
- Issuer string `json:"issuer"`
- ClientID string `json:"clientId"`
- ClientSecret string `json:"clientSecret"`
- FieldMapping *storepb.FieldMapping `json:"fieldMapping"`
- SkipTLSVerify bool `json:"skipTlsVerify"`
- AuthStyle storepb.OAuth2AuthStyle `json:"authStyle"`
+ config *storepb.OIDCIdentityProviderConfig
}
// NewIdentityProvider initializes a new OIDC Identity Provider with the given
// configuration.
-func NewIdentityProvider(ctx context.Context, config IdentityProviderConfig) (*IdentityProvider, error) {
+func NewIdentityProvider(ctx context.Context, config *storepb.OIDCIdentityProviderConfig) (*IdentityProvider, error) {
for v, field := range map[string]string{
config.Issuer: "issuer",
- config.ClientID: "clientId",
+ config.ClientId: "clientId",
config.ClientSecret: "clientSecret",
config.FieldMapping.Identifier: "fieldMapping.identifier",
} {
@@ -54,7 +43,7 @@ func NewIdentityProvider(ctx context.Context, config IdentityProviderConfig) (*I
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
- InsecureSkipVerify: config.SkipTLSVerify,
+ InsecureSkipVerify: config.SkipTlsVerify,
},
},
}
@@ -70,21 +59,17 @@ func NewIdentityProvider(ctx context.Context, config IdentityProviderConfig) (*I
}, nil
}
-// DefaultScopes 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.
-var DefaultScopes = []string{oidc.ScopeOpenID, "profile", "email"}
-
// ExchangeToken returns the exchanged OAuth2 token using the given redirect
// URL and authorization code.
func (p *IdentityProvider) ExchangeToken(ctx context.Context, redirectURL, code string) (*oauth2.Token, error) {
oauth2Config := oauth2.Config{
- ClientID: p.config.ClientID,
+ ClientID: p.config.ClientId,
ClientSecret: p.config.ClientSecret,
RedirectURL: redirectURL,
// Discovery returns the OAuth2 endpoints.
Endpoint: p.provider.Endpoint(),
- Scopes: DefaultScopes,
+ Scopes: p.config.Scopes,
}
authStyle := oauth2.AuthStyleInParams
@@ -113,7 +98,7 @@ func (p *IdentityProvider) UserInfo(ctx context.Context, token *oauth2.Token, no
}
ctx = context.WithValue(ctx, oauth2.HTTPClient, p.client)
- verifier := p.provider.Verifier(&oidc.Config{ClientID: p.config.ClientID})
+ verifier := p.provider.Verifier(&oidc.Config{ClientID: p.config.ClientId})
idToken, err := verifier.Verify(ctx, rawIDToken)
if err != nil {
return nil, errors.Wrap(err, "verify raw ID Token")
diff --git a/backend/plugin/idp/oidc/oidc_test.go b/backend/plugin/idp/oidc/oidc_test.go
index f70205d945..f11cc74f95 100644
--- a/backend/plugin/idp/oidc/oidc_test.go
+++ b/backend/plugin/idp/oidc/oidc_test.go
@@ -24,14 +24,14 @@ func TestNewIdentityProvider(t *testing.T) {
ctx := context.Background()
tests := []struct {
name string
- config IdentityProviderConfig
+ config *storepb.OIDCIdentityProviderConfig
containsErr string
}{
{
name: "no issuer",
- config: IdentityProviderConfig{
+ config: &storepb.OIDCIdentityProviderConfig{
Issuer: "",
- ClientID: "test-client-id",
+ ClientId: "test-client-id",
ClientSecret: "test-client-secret",
FieldMapping: &storepb.FieldMapping{
Identifier: "sub",
@@ -41,9 +41,9 @@ func TestNewIdentityProvider(t *testing.T) {
},
{
name: "no clientId",
- config: IdentityProviderConfig{
+ config: &storepb.OIDCIdentityProviderConfig{
Issuer: "https://oidc.example.com",
- ClientID: "",
+ ClientId: "",
ClientSecret: "test-client-secret",
FieldMapping: &storepb.FieldMapping{
Identifier: "sub",
@@ -53,9 +53,9 @@ func TestNewIdentityProvider(t *testing.T) {
},
{
name: "no clientSecret",
- config: IdentityProviderConfig{
+ config: &storepb.OIDCIdentityProviderConfig{
Issuer: "https://oidc.example.com",
- ClientID: "test-client-id",
+ ClientId: "test-client-id",
ClientSecret: "",
FieldMapping: &storepb.FieldMapping{
Identifier: "sub",
@@ -65,9 +65,9 @@ func TestNewIdentityProvider(t *testing.T) {
},
{
name: "no fieldMapping.identifier",
- config: IdentityProviderConfig{
+ config: &storepb.OIDCIdentityProviderConfig{
Issuer: "https://oidc.example.com",
- ClientID: "test-client-id",
+ ClientId: "test-client-id",
ClientSecret: "test-client-secret",
FieldMapping: &storepb.FieldMapping{
DisplayName: "name",
@@ -199,9 +199,9 @@ func TestIdentityProvider(t *testing.T) {
s := newMockServer(t, false, testClientID, testCode, testAccessToken, testNonce, userinfo)
oidc, err := NewIdentityProvider(
ctx,
- IdentityProviderConfig{
+ &storepb.OIDCIdentityProviderConfig{
Issuer: s.URL,
- ClientID: testClientID,
+ ClientId: testClientID,
ClientSecret: "test-client-secret",
FieldMapping: &storepb.FieldMapping{
Identifier: "sub",
@@ -252,9 +252,9 @@ func TestIdentityProvider_SelfSigned(t *testing.T) {
s := newMockServer(t, true, testClientID, testCode, testAccessToken, testNonce, userinfo)
_, err := NewIdentityProvider(
ctx,
- IdentityProviderConfig{
+ &storepb.OIDCIdentityProviderConfig{
Issuer: s.URL,
- ClientID: testClientID,
+ ClientId: testClientID,
ClientSecret: "test-client-secret",
FieldMapping: &storepb.FieldMapping{
Identifier: "sub",
@@ -270,16 +270,16 @@ func TestIdentityProvider_SelfSigned(t *testing.T) {
s := newMockServer(t, true, testClientID, testCode, testAccessToken, testNonce, userinfo)
oidc, err := NewIdentityProvider(
ctx,
- IdentityProviderConfig{
+ &storepb.OIDCIdentityProviderConfig{
Issuer: s.URL,
- ClientID: testClientID,
+ ClientId: testClientID,
ClientSecret: "test-client-secret",
FieldMapping: &storepb.FieldMapping{
Identifier: "sub",
DisplayName: "name",
Email: "email",
},
- SkipTLSVerify: true,
+ SkipTlsVerify: true,
},
)
require.NoError(t, err)
diff --git a/frontend/src/components/SSO/IdentityProviderCreateForm.vue b/frontend/src/components/SSO/IdentityProviderCreateForm.vue
index 9188454fe7..4a4a5846dd 100644
--- a/frontend/src/components/SSO/IdentityProviderCreateForm.vue
+++ b/frontend/src/components/SSO/IdentityProviderCreateForm.vue
@@ -384,6 +384,22 @@
"
/>
</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") }}
@@ -1083,6 +1099,7 @@ const editedIdentityProvider = computed(() => {
} 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) {
@@ -1320,6 +1337,7 @@ const updateEditState = (updatedIdentityProvider: IdentityProvider) => {
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 ??
@@ -1394,6 +1412,12 @@ watch(
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";
+ }
}
},
{
diff --git a/frontend/src/types/proto/store/idp.ts b/frontend/src/types/proto/store/idp.ts
index 5726f797e3..36acf5b427 100644
--- a/frontend/src/types/proto/store/idp.ts
+++ b/frontend/src/types/proto/store/idp.ts
@@ -159,6 +159,7 @@ export interface OIDCIdentityProviderConfig {
fieldMapping: FieldMapping | undefined;
skipTlsVerify: boolean;
authStyle: OAuth2AuthStyle;
+ scopes: string[];
}
/** LDAPIdentityProviderConfig is the structure for LDAP identity provider config. */
@@ -540,6 +541,7 @@ function createBaseOIDCIdentityProviderConfig(): OIDCIdentityProviderConfig {
fieldMapping: undefined,
skipTlsVerify: false,
authStyle: OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED,
+ scopes: [],
};
}
@@ -563,6 +565,9 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
if (message.authStyle !== OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED) {
writer.uint32(48).int32(oAuth2AuthStyleToNumber(message.authStyle));
}
+ for (const v of message.scopes) {
+ writer.uint32(58).string(v!);
+ }
return writer;
},
@@ -621,6 +626,14 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
message.authStyle = oAuth2AuthStyleFromJSON(reader.int32());
continue;
}
+ case 7: {
+ if (tag !== 58) {
+ break;
+ }
+
+ message.scopes.push(reader.string());
+ continue;
+ }
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -640,6 +653,7 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
authStyle: isSet(object.authStyle)
? oAuth2AuthStyleFromJSON(object.authStyle)
: OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED,
+ scopes: globalThis.Array.isArray(object?.scopes) ? object.scopes.map((e: any) => globalThis.String(e)) : [],
};
},
@@ -663,6 +677,9 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
if (message.authStyle !== OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED) {
obj.authStyle = oAuth2AuthStyleToJSON(message.authStyle);
}
+ if (message.scopes?.length) {
+ obj.scopes = message.scopes;
+ }
return obj;
},
@@ -679,6 +696,7 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
: undefined;
message.skipTlsVerify = object.skipTlsVerify ?? false;
message.authStyle = object.authStyle ?? OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED;
+ message.scopes = object.scopes?.map((e) => e) || [];
return message;
},
};
diff --git a/frontend/src/types/proto/v1/idp_service.ts b/frontend/src/types/proto/v1/idp_service.ts
index e344e9e9f1..faf376dd93 100644
--- a/frontend/src/types/proto/v1/idp_service.ts
+++ b/frontend/src/types/proto/v1/idp_service.ts
@@ -269,14 +269,14 @@ export interface OIDCIdentityProviderConfig {
issuer: string;
clientId: string;
clientSecret: string;
- fieldMapping: FieldMapping | undefined;
- skipTlsVerify: boolean;
- authStyle: OAuth2AuthStyle;
/**
* The scopes that the OIDC provider supports.
* Should be fetched from the well-known configuration file of the OIDC provider.
*/
scopes: string[];
+ fieldMapping: FieldMapping | undefined;
+ skipTlsVerify: boolean;
+ authStyle: OAuth2AuthStyle;
/**
* The authorization endpoint of the OIDC provider.
* Should be fetched from the well-known configuration file of the OIDC provider.
@@ -1498,10 +1498,10 @@ function createBaseOIDCIdentityProviderConfig(): OIDCIdentityProviderConfig {
issuer: "",
clientId: "",
clientSecret: "",
+ scopes: [],
fieldMapping: undefined,
skipTlsVerify: false,
authStyle: OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED,
- scopes: [],
authEndpoint: "",
};
}
@@ -1517,6 +1517,9 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
if (message.clientSecret !== "") {
writer.uint32(26).string(message.clientSecret);
}
+ for (const v of message.scopes) {
+ writer.uint32(34).string(v!);
+ }
if (message.fieldMapping !== undefined) {
FieldMapping.encode(message.fieldMapping, writer.uint32(42).fork()).join();
}
@@ -1526,9 +1529,6 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
if (message.authStyle !== OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED) {
writer.uint32(56).int32(oAuth2AuthStyleToNumber(message.authStyle));
}
- for (const v of message.scopes) {
- writer.uint32(34).string(v!);
- }
if (message.authEndpoint !== "") {
writer.uint32(66).string(message.authEndpoint);
}
@@ -1566,6 +1566,14 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
message.clientSecret = reader.string();
continue;
}
+ case 4: {
+ if (tag !== 34) {
+ break;
+ }
+
+ message.scopes.push(reader.string());
+ continue;
+ }
case 5: {
if (tag !== 42) {
break;
@@ -1590,14 +1598,6 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
message.authStyle = oAuth2AuthStyleFromJSON(reader.int32());
continue;
}
- case 4: {
- if (tag !== 34) {
- break;
- }
-
- message.scopes.push(reader.string());
- continue;
- }
case 8: {
if (tag !== 66) {
break;
@@ -1620,12 +1620,12 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "",
clientId: isSet(object.clientId) ? globalThis.String(object.clientId) : "",
clientSecret: isSet(object.clientSecret) ? globalThis.String(object.clientSecret) : "",
+ scopes: globalThis.Array.isArray(object?.scopes) ? object.scopes.map((e: any) => globalThis.String(e)) : [],
fieldMapping: isSet(object.fieldMapping) ? FieldMapping.fromJSON(object.fieldMapping) : undefined,
skipTlsVerify: isSet(object.skipTlsVerify) ? globalThis.Boolean(object.skipTlsVerify) : false,
authStyle: isSet(object.authStyle)
? oAuth2AuthStyleFromJSON(object.authStyle)
: OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED,
- scopes: globalThis.Array.isArray(object?.scopes) ? object.scopes.map((e: any) => globalThis.String(e)) : [],
authEndpoint: isSet(object.authEndpoint) ? globalThis.String(object.authEndpoint) : "",
};
},
@@ -1641,6 +1641,9 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
if (message.clientSecret !== "") {
obj.clientSecret = message.clientSecret;
}
+ if (message.scopes?.length) {
+ obj.scopes = message.scopes;
+ }
if (message.fieldMapping !== undefined) {
obj.fieldMapping = FieldMapping.toJSON(message.fieldMapping);
}
@@ -1650,9 +1653,6 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
if (message.authStyle !== OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED) {
obj.authStyle = oAuth2AuthStyleToJSON(message.authStyle);
}
- if (message.scopes?.length) {
- obj.scopes = message.scopes;
- }
if (message.authEndpoint !== "") {
obj.authEndpoint = message.authEndpoint;
}
@@ -1667,12 +1667,12 @@ export const OIDCIdentityProviderConfig: MessageFns<OIDCIdentityProviderConfig>
message.issuer = object.issuer ?? "";
message.clientId = object.clientId ?? "";
message.clientSecret = object.clientSecret ?? "";
+ message.scopes = object.scopes?.map((e) => e) || [];
message.fieldMapping = (object.fieldMapping !== undefined && object.fieldMapping !== null)
? FieldMapping.fromPartial(object.fieldMapping)
: undefined;
message.skipTlsVerify = object.skipTlsVerify ?? false;
message.authStyle = object.authStyle ?? OAuth2AuthStyle.OAUTH2_AUTH_STYLE_UNSPECIFIED;
- message.scopes = object.scopes?.map((e) => e) || [];
message.authEndpoint = object.authEndpoint ?? "";
return message;
},
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index d7e8b288b8..61a7339b7d 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -10902,6 +10902,13 @@ components:
type: string
clientSecret:
type: string
+ scopes:
+ type: array
+ items:
+ type: string
+ description: |-
+ The scopes that the OIDC provider supports.
+ Should be fetched from the well-known configuration file of the OIDC provider.
fieldMapping:
$ref: '#/components/schemas/FieldMapping'
skipTlsVerify:
@@ -10913,14 +10920,6 @@ components:
- IN_HEADER
type: string
format: enum
- scopes:
- readOnly: true
- type: array
- items:
- type: string
- description: |-
- The scopes that the OIDC provider supports.
- Should be fetched from the well-known configuration file of the OIDC provider.
authEndpoint:
readOnly: true
type: string
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 7ed5d09778..bfb6145938 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -2215,6 +2215,7 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.
| field_mapping | [FieldMapping](#bytebase-store-FieldMapping) | | |
| skip_tls_verify | [bool](#bool) | | |
| auth_style | [OAuth2AuthStyle](#bytebase-store-OAuth2AuthStyle) | | |
+| scopes | [string](#string) | repeated | |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index 6d0cf05df1..85cc451245 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -6286,6 +6286,13 @@ server. </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>scopes</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p> </p></td>
+ </tr>
+
</tbody>
</table>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 278ce52e01..b1bdcee0ed 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -6855,10 +6855,10 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.
| issuer | [string](#string) | | |
| client_id | [string](#string) | | |
| client_secret | [string](#string) | | |
+| scopes | [string](#string) | repeated | The scopes that the OIDC provider supports. Should be fetched from the well-known configuration file of the OIDC provider. |
| field_mapping | [FieldMapping](#bytebase-v1-FieldMapping) | | |
| skip_tls_verify | [bool](#bool) | | |
| auth_style | [OAuth2AuthStyle](#bytebase-v1-OAuth2AuthStyle) | | |
-| scopes | [string](#string) | repeated | The scopes that the OIDC provider supports. Should be fetched from the well-known configuration file of the OIDC provider. |
| auth_endpoint | [string](#string) | | The authorization endpoint of the OIDC provider. Should be fetched from the well-known configuration file of the OIDC provider. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 3554c1903c..5c7775b041 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -19190,6 +19190,14 @@ If this field is omitted, there are no subsequent pages. </p></td>
<td><p> </p></td>
</tr>
+ <tr>
+ <td>scopes</td>
+ <td><a href="#string">string</a></td>
+ <td>repeated</td>
+ <td><p>The scopes that the OIDC provider supports.
+Should be fetched from the well-known configuration file of the OIDC provider. </p></td>
+ </tr>
+
<tr>
<td>field_mapping</td>
<td><a href="#bytebase.v1.FieldMapping">FieldMapping</a></td>
@@ -19211,14 +19219,6 @@ If this field is omitted, there are no subsequent pages. </p></td>
<td><p> </p></td>
</tr>
- <tr>
- <td>scopes</td>
- <td><a href="#string">string</a></td>
- <td>repeated</td>
- <td><p>The scopes that the OIDC provider supports.
-Should be fetched from the well-known configuration file of the OIDC provider. </p></td>
- </tr>
-
<tr>
<td>auth_endpoint</td>
<td><a href="#string">string</a></td>
diff --git a/proto/generated-go/store/idp.pb.go b/proto/generated-go/store/idp.pb.go
index 4870a7551e..41b90d8516 100644
--- a/proto/generated-go/store/idp.pb.go
+++ b/proto/generated-go/store/idp.pb.go
@@ -342,6 +342,7 @@ type OIDCIdentityProviderConfig struct {
FieldMapping *FieldMapping `protobuf:"bytes,4,opt,name=field_mapping,json=fieldMapping,proto3" json:"field_mapping,omitempty"`
SkipTlsVerify bool `protobuf:"varint,5,opt,name=skip_tls_verify,json=skipTlsVerify,proto3" json:"skip_tls_verify,omitempty"`
AuthStyle OAuth2AuthStyle `protobuf:"varint,6,opt,name=auth_style,json=authStyle,proto3,enum=bytebase.store.OAuth2AuthStyle" json:"auth_style,omitempty"`
+ Scopes []string `protobuf:"bytes,7,rep,name=scopes,proto3" json:"scopes,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -418,6 +419,13 @@ func (x *OIDCIdentityProviderConfig) GetAuthStyle() OAuth2AuthStyle {
return OAuth2AuthStyle_OAUTH2_AUTH_STYLE_UNSPECIFIED
}
+func (x *OIDCIdentityProviderConfig) GetScopes() []string {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
// LDAPIdentityProviderConfig is the structure for LDAP identity provider config.
type LDAPIdentityProviderConfig struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -717,7 +725,7 @@ const file_store_idp_proto_rawDesc = "" +
"\rfield_mapping\x18\a \x01(\v2\x1c.bytebase.store.FieldMappingR\ffieldMapping\x12&\n" +
"\x0fskip_tls_verify\x18\b \x01(\bR\rskipTlsVerify\x12>\n" +
"\n" +
- "auth_style\x18\t \x01(\x0e2\x1f.bytebase.store.OAuth2AuthStyleR\tauthStyle\"\xa1\x02\n" +
+ "auth_style\x18\t \x01(\x0e2\x1f.bytebase.store.OAuth2AuthStyleR\tauthStyle\"\xb9\x02\n" +
"\x1aOIDCIdentityProviderConfig\x12\x16\n" +
"\x06issuer\x18\x01 \x01(\tR\x06issuer\x12\x1b\n" +
"\tclient_id\x18\x02 \x01(\tR\bclientId\x12#\n" +
@@ -725,7 +733,8 @@ const file_store_idp_proto_rawDesc = "" +
"\rfield_mapping\x18\x04 \x01(\v2\x1c.bytebase.store.FieldMappingR\ffieldMapping\x12&\n" +
"\x0fskip_tls_verify\x18\x05 \x01(\bR\rskipTlsVerify\x12>\n" +
"\n" +
- "auth_style\x18\x06 \x01(\x0e2\x1f.bytebase.store.OAuth2AuthStyleR\tauthStyle\"\xd4\x02\n" +
+ "auth_style\x18\x06 \x01(\x0e2\x1f.bytebase.store.OAuth2AuthStyleR\tauthStyle\x12\x16\n" +
+ "\x06scopes\x18\a \x03(\tR\x06scopes\"\xd4\x02\n" +
"\x1aLDAPIdentityProviderConfig\x12\x12\n" +
"\x04host\x18\x01 \x01(\tR\x04host\x12\x12\n" +
"\x04port\x18\x02 \x01(\x05R\x04port\x12&\n" +
diff --git a/proto/generated-go/v1/idp_service.pb.go b/proto/generated-go/v1/idp_service.pb.go
index ea961bbe5f..de63ae83ce 100644
--- a/proto/generated-go/v1/idp_service.pb.go
+++ b/proto/generated-go/v1/idp_service.pb.go
@@ -967,16 +967,16 @@ func (x *OAuth2IdentityProviderConfig) GetAuthStyle() OAuth2AuthStyle {
// OIDCIdentityProviderConfig is the structure for OIDC identity provider config.
type OIDCIdentityProviderConfig struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Issuer string `protobuf:"bytes,1,opt,name=issuer,proto3" json:"issuer,omitempty"`
- ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
- ClientSecret string `protobuf:"bytes,3,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
- FieldMapping *FieldMapping `protobuf:"bytes,5,opt,name=field_mapping,json=fieldMapping,proto3" json:"field_mapping,omitempty"`
- SkipTlsVerify bool `protobuf:"varint,6,opt,name=skip_tls_verify,json=skipTlsVerify,proto3" json:"skip_tls_verify,omitempty"`
- AuthStyle OAuth2AuthStyle `protobuf:"varint,7,opt,name=auth_style,json=authStyle,proto3,enum=bytebase.v1.OAuth2AuthStyle" json:"auth_style,omitempty"`
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Issuer string `protobuf:"bytes,1,opt,name=issuer,proto3" json:"issuer,omitempty"`
+ ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
+ ClientSecret string `protobuf:"bytes,3,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret,omitempty"`
// The scopes that the OIDC provider supports.
// Should be fetched from the well-known configuration file of the OIDC provider.
- Scopes []string `protobuf:"bytes,4,rep,name=scopes,proto3" json:"scopes,omitempty"`
+ Scopes []string `protobuf:"bytes,4,rep,name=scopes,proto3" json:"scopes,omitempty"`
+ FieldMapping *FieldMapping `protobuf:"bytes,5,opt,name=field_mapping,json=fieldMapping,proto3" json:"field_mapping,omitempty"`
+ SkipTlsVerify bool `protobuf:"varint,6,opt,name=skip_tls_verify,json=skipTlsVerify,proto3" json:"skip_tls_verify,omitempty"`
+ AuthStyle OAuth2AuthStyle `protobuf:"varint,7,opt,name=auth_style,json=authStyle,proto3,enum=bytebase.v1.OAuth2AuthStyle" json:"auth_style,omitempty"`
// The authorization endpoint of the OIDC provider.
// Should be fetched from the well-known configuration file of the OIDC provider.
AuthEndpoint string `protobuf:"bytes,8,opt,name=auth_endpoint,json=authEndpoint,proto3" json:"auth_endpoint,omitempty"`
@@ -1035,6 +1035,13 @@ func (x *OIDCIdentityProviderConfig) GetClientSecret() string {
return ""
}
+func (x *OIDCIdentityProviderConfig) GetScopes() []string {
+ if x != nil {
+ return x.Scopes
+ }
+ return nil
+}
+
func (x *OIDCIdentityProviderConfig) GetFieldMapping() *FieldMapping {
if x != nil {
return x.FieldMapping
@@ -1056,13 +1063,6 @@ func (x *OIDCIdentityProviderConfig) GetAuthStyle() OAuth2AuthStyle {
return OAuth2AuthStyle_OAUTH2_AUTH_STYLE_UNSPECIFIED
}
-func (x *OIDCIdentityProviderConfig) GetScopes() []string {
- if x != nil {
- return x.Scopes
- }
- return nil
-}
-
func (x *OIDCIdentityProviderConfig) GetAuthEndpoint() string {
if x != nil {
return x.AuthEndpoint
@@ -1337,16 +1337,16 @@ const file_v1_idp_service_proto_rawDesc = "" +
"\rfield_mapping\x18\a \x01(\v2\x19.bytebase.v1.FieldMappingR\ffieldMapping\x12&\n" +
"\x0fskip_tls_verify\x18\b \x01(\bR\rskipTlsVerify\x12;\n" +
"\n" +
- "auth_style\x18\t \x01(\x0e2\x1c.bytebase.v1.OAuth2AuthStyleR\tauthStyle\"\xe4\x02\n" +
+ "auth_style\x18\t \x01(\x0e2\x1c.bytebase.v1.OAuth2AuthStyleR\tauthStyle\"\xde\x02\n" +
"\x1aOIDCIdentityProviderConfig\x12\x16\n" +
"\x06issuer\x18\x01 \x01(\tR\x06issuer\x12\x1b\n" +
"\tclient_id\x18\x02 \x01(\tR\bclientId\x12#\n" +
- "\rclient_secret\x18\x03 \x01(\tR\fclientSecret\x12>\n" +
+ "\rclient_secret\x18\x03 \x01(\tR\fclientSecret\x12\x16\n" +
+ "\x06scopes\x18\x04 \x03(\tR\x06scopes\x12>\n" +
"\rfield_mapping\x18\x05 \x01(\v2\x19.bytebase.v1.FieldMappingR\ffieldMapping\x12&\n" +
"\x0fskip_tls_verify\x18\x06 \x01(\bR\rskipTlsVerify\x12;\n" +
"\n" +
- "auth_style\x18\a \x01(\x0e2\x1c.bytebase.v1.OAuth2AuthStyleR\tauthStyle\x12\x1c\n" +
- "\x06scopes\x18\x04 \x03(\tB\x04\xe2A\x01\x03R\x06scopes\x12)\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" +
"\x1aLDAPIdentityProviderConfig\x12\x12\n" +
"\x04host\x18\x01 \x01(\tR\x04host\x12\x12\n" +
diff --git a/proto/store/idp.proto b/proto/store/idp.proto
index 21302b4773..f1d3b0cdb1 100644
--- a/proto/store/idp.proto
+++ b/proto/store/idp.proto
@@ -53,6 +53,8 @@ message OIDCIdentityProviderConfig {
bool skip_tls_verify = 5;
OAuth2AuthStyle auth_style = 6;
+
+ repeated string scopes = 7;
}
// LDAPIdentityProviderConfig is the structure for LDAP identity provider config.
diff --git a/proto/v1/idp_service.proto b/proto/v1/idp_service.proto
index b4f6ad8145..1a07cd1d62 100644
--- a/proto/v1/idp_service.proto
+++ b/proto/v1/idp_service.proto
@@ -241,16 +241,16 @@ message OIDCIdentityProviderConfig {
string client_secret = 3;
+ // The scopes that the OIDC provider supports.
+ // Should be fetched from the well-known configuration file of the OIDC provider.
+ repeated string scopes = 4;
+
FieldMapping field_mapping = 5;
bool skip_tls_verify = 6;
OAuth2AuthStyle auth_style = 7;
- // The scopes that the OIDC provider supports.
- // Should be fetched from the well-known configuration file of the OIDC provider.
- repeated string scopes = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
-
// The authorization endpoint of the OIDC provider.
// Should be fetched from the well-known configuration file of the OIDC provider.
string auth_endpoint = 8 [(google.api.field_behavior) = OUTPUT_ONLY];