Skip to content

Commit 7660a34

Browse files
Make "scopes" required for Okta Workforce Connections (#945)
* Make "scopes" required for Okta Workforce Connections * Fix TestAccOrganizationConnections testcases * Fix SCIMConfiguration testcases --------- Co-authored-by: ramya18101 <[email protected]>
1 parent 860da72 commit 7660a34

8 files changed

+3575
-3574
lines changed

internal/auth0/connection/data_source_scim_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ resource "auth0_connection" "my_connection" {
2424
client_id = "1234567"
2525
client_secret = "1234567"
2626
issuer = "https://example.okta.com"
27+
scopes = ["openid", "profile", "email"]
2728
jwks_uri = "https://example.okta.com/oauth2/v1/keys"
2829
token_endpoint = "https://example.okta.com/oauth2/v1/token"
2930
authorization_endpoint = "https://example.okta.com/oauth2/v1/authorize"

internal/auth0/connection/expand.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,10 @@ func expandConnectionOptionsOkta(data *schema.ResourceData, config cty.Value) (i
910910
return nil, diag.FromErr(err)
911911
}
912912

913+
if len(data.Get("options.0.scopes").(*schema.Set).List()) < 1 {
914+
return nil, diag.FromErr(fmt.Errorf("the scopes option is required for connection strategy %s", management.ConnectionStrategyOkta))
915+
}
916+
913917
expandConnectionOptionsScopes(data, options)
914918

915919
options.UpstreamParams, err = value.MapFromJSON(config.GetAttr("upstream_params"))

internal/auth0/connection/resource_scim_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ resource "auth0_connection" "my_connection" {
3535
options {
3636
client_id = "1234567"
3737
client_secret = "1234567"
38+
scopes = ["openid", "profile", "email"]
3839
issuer = "https://example.okta.com"
3940
jwks_uri = "https://example.okta.com/oauth2/v1/keys"
4041
token_endpoint = "https://example.okta.com/oauth2/v1/token"
@@ -124,7 +125,7 @@ func TestAccSCIMConfiguration(t *testing.T) {
124125
},
125126
{
126127
Config: acctest.ParseTestName(testAccSCIMConfigurationGivenAnUnsupportedConnection, t.Name()),
127-
ExpectError: regexp.MustCompile("404 Not Found: scim strategy not enabled"),
128+
ExpectError: regexp.MustCompile("404 Not Found: This connection type does not support SCIM."),
128129
},
129130
{
130131
Config: acctest.ParseTestName(testAccSCIMConfigurationWithDefaults, t.Name()),

internal/auth0/organization/resource_connections_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ resource "auth0_connection" "my_enterprise_connection" {
2727
options {
2828
client_id = "1234567"
2929
client_secret = "1234567"
30+
scopes = ["openid", "profile", "email"]
3031
issuer = "https://example.okta.com"
3132
jwks_uri = "https://example.okta.com/oauth2/v1/keys"
3233
token_endpoint = "https://example.okta.com/oauth2/v1/token"

test/data/recordings/TestAccDataSCIMConfiguration.yaml

Lines changed: 76 additions & 78 deletions
Large diffs are not rendered by default.

test/data/recordings/TestAccOrganizationConnection.yaml

Lines changed: 1269 additions & 1269 deletions
Large diffs are not rendered by default.

test/data/recordings/TestAccOrganizationConnections.yaml

Lines changed: 2052 additions & 2052 deletions
Large diffs are not rendered by default.

test/data/recordings/TestAccSCIMConfiguration.yaml

Lines changed: 170 additions & 174 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)