Add Google Workspace connector to bootstrap
The SCIM bridge for Google Workspace already exists but the bootstrap builder did not register it, preventing deployment via environment variables. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -325,6 +325,17 @@ func (b *Builder) Build() (*probod.FullConfig, error) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if googleWorkspaceClientID := b.getEnv("CONNECTOR_GOOGLE_WORKSPACE_CLIENT_ID"); googleWorkspaceClientID != "" {
|
||||||
|
cfg.Probod.Connectors = append(cfg.Probod.Connectors, probod.ConnectorConfig{
|
||||||
|
Provider: "GOOGLE_WORKSPACE",
|
||||||
|
Protocol: "oauth2",
|
||||||
|
RawConfig: probod.ConnectorConfigOAuth2{
|
||||||
|
ClientID: googleWorkspaceClientID,
|
||||||
|
ClientSecret: b.getEnv("CONNECTOR_GOOGLE_WORKSPACE_CLIENT_SECRET"),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,6 +381,7 @@ func (b *Builder) validateRequired() error {
|
|||||||
{"CONNECTOR_SENTRY", []string{"CLIENT_SECRET"}},
|
{"CONNECTOR_SENTRY", []string{"CLIENT_SECRET"}},
|
||||||
{"CONNECTOR_INTERCOM", []string{"CLIENT_SECRET"}},
|
{"CONNECTOR_INTERCOM", []string{"CLIENT_SECRET"}},
|
||||||
{"CONNECTOR_BREX", []string{"CLIENT_SECRET"}},
|
{"CONNECTOR_BREX", []string{"CLIENT_SECRET"}},
|
||||||
|
{"CONNECTOR_GOOGLE_WORKSPACE", []string{"CLIENT_SECRET"}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range oauthProviders {
|
for _, p := range oauthProviders {
|
||||||
|
|||||||
@@ -85,6 +85,16 @@ func TestBuilder_Build_MissingRequiredEnvVars(t *testing.T) {
|
|||||||
},
|
},
|
||||||
wantMissing: []string{"CONNECTOR_SLACK_CLIENT_SECRET", "CONNECTOR_SLACK_SIGNING_SECRET"},
|
wantMissing: []string{"CONNECTOR_SLACK_CLIENT_SECRET", "CONNECTOR_SLACK_SIGNING_SECRET"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "google workspace connector missing required fields",
|
||||||
|
env: map[string]string{
|
||||||
|
"PROBOD_ENCRYPTION_KEY": "key",
|
||||||
|
"AUTH_COOKIE_SECRET": "secret",
|
||||||
|
"AUTH_PASSWORD_PEPPER": "pepper",
|
||||||
|
"CONNECTOR_GOOGLE_WORKSPACE_CLIENT_ID": "client-id",
|
||||||
|
},
|
||||||
|
wantMissing: []string{"CONNECTOR_GOOGLE_WORKSPACE_CLIENT_SECRET"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
@@ -367,6 +377,27 @@ func TestBuilder_Build_CustomValues(t *testing.T) {
|
|||||||
assert.False(t, cfg.Probod.Branding)
|
assert.False(t, cfg.Probod.Branding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBuilder_Build_GoogleWorkspaceConnector(t *testing.T) {
|
||||||
|
env := requiredEnv()
|
||||||
|
env["CONNECTOR_GOOGLE_WORKSPACE_CLIENT_ID"] = "gw-client-id"
|
||||||
|
env["CONNECTOR_GOOGLE_WORKSPACE_CLIENT_SECRET"] = "gw-client-secret"
|
||||||
|
|
||||||
|
b := NewBuilder(mockEnv(env))
|
||||||
|
b.samlCertificate = "test-cert"
|
||||||
|
b.samlPrivateKey = "test-key"
|
||||||
|
|
||||||
|
cfg, err := b.Build()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
require.Len(t, cfg.Probod.Connectors, 1)
|
||||||
|
connector := cfg.Probod.Connectors[0]
|
||||||
|
assert.Equal(t, "GOOGLE_WORKSPACE", connector.Provider)
|
||||||
|
assert.Equal(t, "oauth2", string(connector.Protocol))
|
||||||
|
rawConfig := connector.RawConfig.(probod.ConnectorConfigOAuth2)
|
||||||
|
assert.Equal(t, "gw-client-id", rawConfig.ClientID)
|
||||||
|
assert.Equal(t, "gw-client-secret", rawConfig.ClientSecret)
|
||||||
|
}
|
||||||
|
|
||||||
func TestBuilder_Build_SlackConnector(t *testing.T) {
|
func TestBuilder_Build_SlackConnector(t *testing.T) {
|
||||||
env := requiredEnv()
|
env := requiredEnv()
|
||||||
env["CONNECTOR_SLACK_CLIENT_ID"] = "slack-client-id"
|
env["CONNECTOR_SLACK_CLIENT_ID"] = "slack-client-id"
|
||||||
|
|||||||
Reference in New Issue
Block a user