diff --git a/management/connection.go b/management/connection.go index b0a75369..53f7fe94 100644 --- a/management/connection.go +++ b/management/connection.go @@ -11,6 +11,8 @@ import ( const ( // ConnectionStrategyAuth0 constant. ConnectionStrategyAuth0 = "auth0" + // ConnectionStrategyOkta constant. + ConnectionStrategyOkta = "okta" // ConnectionStrategyGoogleOAuth2 constant. ConnectionStrategyGoogleOAuth2 = "google-oauth2" // ConnectionStrategyFacebook constant. @@ -111,7 +113,7 @@ type Connection struct { // "salesforce", "samlp", "sharepoint", "shopify", "sms", "soundcloud", // "thecity-sandbox", "thecity", "thirtysevensignals", "twitter", "untappd", // "vkontakte", "waad", "weibo", "windowslive", "wordpress", "yahoo", - // "yammer" or "yandex". + // "yammer", "okta" or "yandex". Strategy *string `json:"strategy,omitempty"` // True if the connection is domain level @@ -181,6 +183,8 @@ func (c *Connection) UnmarshalJSON(b []byte) error { switch *c.Strategy { case ConnectionStrategyAuth0: v = &ConnectionOptions{} + case ConnectionStrategyOkta: + v = &ConnectionOptionsOkta{} case ConnectionStrategyGoogleOAuth2: v = &ConnectionOptionsGoogleOAuth2{} case ConnectionStrategyFacebook: @@ -298,6 +302,48 @@ type ConnectionOptions struct { UpstreamParams map[string]interface{} `json:"upstream_params,omitempty"` } +// ConnectionOptionsOkta is used to configure an Okta Workforce Connection. +type ConnectionOptionsOkta struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + Domain *string `json:"domain,omitempty"` + DomainAliases *[]string `json:"domain_aliases,omitempty"` + AuthorizationEndpoint *string `json:"authorization_endpoint"` + Issuer *string `json:"issuer"` + JWKSURI *string `json:"jwks_uri"` + UserInfoEndpoint *string `json:"userinfo_endpoint"` + TokenEndpoint *string `json:"token_endpoint"` + Scope *string `json:"scope,omitempty"` + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` + NonPersistentAttrs *[]string `json:"non_persistent_attrs,omitempty"` + UpstreamParams map[string]interface{} `json:"upstream_params,omitempty"` +} + +// Scopes returns the scopes for ConnectionOptionsOkta. +func (c *ConnectionOptionsOkta) Scopes() []string { + return strings.Fields(c.GetScope()) +} + +// SetScopes sets the scopes for ConnectionOptionsOkta. +func (c *ConnectionOptionsOkta) SetScopes(enable bool, scopes ...string) { + scopeMap := make(map[string]bool) + for _, scope := range c.Scopes() { + scopeMap[scope] = true + } + for _, scope := range scopes { + scopeMap[scope] = enable + } + scopeSlice := make([]string, 0, len(scopeMap)) + for scope, enabled := range scopeMap { + if enabled { + scopeSlice = append(scopeSlice, scope) + } + } + sort.Strings(scopeSlice) + scope := strings.Join(scopeSlice, " ") + c.Scope = &scope +} + // ConnectionOptionsGoogleOAuth2 is used to configure a GoogleOAuth2 Connection. type ConnectionOptionsGoogleOAuth2 struct { ClientID *string `json:"client_id,omitempty"` diff --git a/management/connection_test.go b/management/connection_test.go index 8d041b53..c3a4dca9 100644 --- a/management/connection_test.go +++ b/management/connection_test.go @@ -322,6 +322,27 @@ ZsUkLw2I7zI/dNlWdB8Xp7v+3w9sX5N3J/WuJ1KOO5m26kRlHQo7EzT3974g }, }, }, + { + name: "Okta Connection", + connection: Connection{ + Name: auth0.Stringf("Test-Okta-Connection-%d", time.Now().Unix()), + Strategy: auth0.String("okta"), + }, + options: &ConnectionOptionsOkta{ + ClientID: auth0.String("4ef8d976-71bd-4473-a7ce-087d3f0fafd8"), + ClientSecret: auth0.String("mySecret"), + Scope: auth0.String("openid"), + Domain: auth0.String("domain.okta.com"), + Issuer: auth0.String("https://example.com"), + AuthorizationEndpoint: auth0.String("https://example.com"), + JWKSURI: auth0.String("https://example.com/jwks"), + UpstreamParams: map[string]interface{}{ + "screen_name": map[string]interface{}{ + "alias": "login_hint", + }, + }, + }, + }, } type connectionTestCase struct { @@ -405,8 +426,10 @@ func TestConnectionManager_ReadByName(t *testing.T) { func TestConnectionManager_Update(t *testing.T) { for _, testCase := range connectionTestCases { t.Run("It can successfully update a "+testCase.name, func(t *testing.T) { - if testCase.connection.GetStrategy() == "oidc" || testCase.connection.GetStrategy() == "samlp" { - t.Skip("Skipping because we can't create an oidc or samlp connection with no options") + if testCase.connection.GetStrategy() == "oidc" || + testCase.connection.GetStrategy() == "samlp" || + testCase.connection.GetStrategy() == "okta" { + t.Skip("Skipping because we can't create an oidc, okta or samlp connection with no options") } setupHTTPRecordings(t) @@ -477,7 +500,7 @@ func TestConnectionOptionsScopes(t *testing.T) { assert.Equal(t, []string{"bar"}, options.Scopes()) }) - t.Run("It can successfully set the scopes on the options of a OAuth2 connection", func(t *testing.T) { + t.Run("It can successfully set the scopes on the options of an OAuth2 connection", func(t *testing.T) { options := &ConnectionOptionsOAuth2{} options.SetScopes(true, "foo", "bar", "baz") @@ -486,6 +509,16 @@ func TestConnectionOptionsScopes(t *testing.T) { options.SetScopes(false, "foo", "baz") assert.Equal(t, []string{"bar"}, options.Scopes()) }) + + t.Run("It can successfully set the scopes on the options of an Okta connection", func(t *testing.T) { + options := &ConnectionOptionsOkta{} + + options.SetScopes(true, "foo", "bar", "baz") + assert.Equal(t, []string{"bar", "baz", "foo"}, options.Scopes()) + + options.SetScopes(false, "foo", "baz") + assert.Equal(t, []string{"bar"}, options.Scopes()) + }) } func cleanupConnection(t *testing.T, connectionID string) { diff --git a/management/management.gen.go b/management/management.gen.go index 6aab3fee..eb906b68 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -3278,6 +3278,107 @@ func (c *ConnectionOptionsOIDC) String() string { return Stringify(c) } +// GetAuthorizationEndpoint returns the AuthorizationEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetAuthorizationEndpoint() string { + if c == nil || c.AuthorizationEndpoint == nil { + return "" + } + return *c.AuthorizationEndpoint +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetDomain() string { + if c == nil || c.Domain == nil { + return "" + } + return *c.Domain +} + +// GetDomainAliases returns the DomainAliases field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetDomainAliases() []string { + if c == nil || c.DomainAliases == nil { + return nil + } + return *c.DomainAliases +} + +// GetIssuer returns the Issuer field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetIssuer() string { + if c == nil || c.Issuer == nil { + return "" + } + return *c.Issuer +} + +// GetJWKSURI returns the JWKSURI field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetJWKSURI() string { + if c == nil || c.JWKSURI == nil { + return "" + } + return *c.JWKSURI +} + +// GetNonPersistentAttrs returns the NonPersistentAttrs field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetNonPersistentAttrs() []string { + if c == nil || c.NonPersistentAttrs == nil { + return nil + } + return *c.NonPersistentAttrs +} + +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetScope() string { + if c == nil || c.Scope == nil { + return "" + } + return *c.Scope +} + +// GetSetUserAttributes returns the SetUserAttributes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetSetUserAttributes() string { + if c == nil || c.SetUserAttributes == nil { + return "" + } + return *c.SetUserAttributes +} + +// GetTokenEndpoint returns the TokenEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetTokenEndpoint() string { + if c == nil || c.TokenEndpoint == nil { + return "" + } + return *c.TokenEndpoint +} + +// GetUserInfoEndpoint returns the UserInfoEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOkta) GetUserInfoEndpoint() string { + if c == nil || c.UserInfoEndpoint == nil { + return "" + } + return *c.UserInfoEndpoint +} + +// String returns a string representation of ConnectionOptionsOkta. +func (c *ConnectionOptionsOkta) String() string { + return Stringify(c) +} + // GetLength returns the Length field if it's non-nil, zero value otherwise. func (c *ConnectionOptionsOTP) GetLength() int { if c == nil || c.Length == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index ac829830..59ece71e 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -4150,6 +4150,134 @@ func TestConnectionOptionsOIDC_String(t *testing.T) { } } +func TestConnectionOptionsOkta_GetAuthorizationEndpoint(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{AuthorizationEndpoint: &zeroValue} + c.GetAuthorizationEndpoint() + c = &ConnectionOptionsOkta{} + c.GetAuthorizationEndpoint() + c = nil + c.GetAuthorizationEndpoint() +} + +func TestConnectionOptionsOkta_GetClientID(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{ClientID: &zeroValue} + c.GetClientID() + c = &ConnectionOptionsOkta{} + c.GetClientID() + c = nil + c.GetClientID() +} + +func TestConnectionOptionsOkta_GetClientSecret(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{ClientSecret: &zeroValue} + c.GetClientSecret() + c = &ConnectionOptionsOkta{} + c.GetClientSecret() + c = nil + c.GetClientSecret() +} + +func TestConnectionOptionsOkta_GetDomain(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{Domain: &zeroValue} + c.GetDomain() + c = &ConnectionOptionsOkta{} + c.GetDomain() + c = nil + c.GetDomain() +} + +func TestConnectionOptionsOkta_GetDomainAliases(tt *testing.T) { + var zeroValue []string + c := &ConnectionOptionsOkta{DomainAliases: &zeroValue} + c.GetDomainAliases() + c = &ConnectionOptionsOkta{} + c.GetDomainAliases() + c = nil + c.GetDomainAliases() +} + +func TestConnectionOptionsOkta_GetIssuer(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{Issuer: &zeroValue} + c.GetIssuer() + c = &ConnectionOptionsOkta{} + c.GetIssuer() + c = nil + c.GetIssuer() +} + +func TestConnectionOptionsOkta_GetJWKSURI(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{JWKSURI: &zeroValue} + c.GetJWKSURI() + c = &ConnectionOptionsOkta{} + c.GetJWKSURI() + c = nil + c.GetJWKSURI() +} + +func TestConnectionOptionsOkta_GetNonPersistentAttrs(tt *testing.T) { + var zeroValue []string + c := &ConnectionOptionsOkta{NonPersistentAttrs: &zeroValue} + c.GetNonPersistentAttrs() + c = &ConnectionOptionsOkta{} + c.GetNonPersistentAttrs() + c = nil + c.GetNonPersistentAttrs() +} + +func TestConnectionOptionsOkta_GetScope(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{Scope: &zeroValue} + c.GetScope() + c = &ConnectionOptionsOkta{} + c.GetScope() + c = nil + c.GetScope() +} + +func TestConnectionOptionsOkta_GetSetUserAttributes(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{SetUserAttributes: &zeroValue} + c.GetSetUserAttributes() + c = &ConnectionOptionsOkta{} + c.GetSetUserAttributes() + c = nil + c.GetSetUserAttributes() +} + +func TestConnectionOptionsOkta_GetTokenEndpoint(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{TokenEndpoint: &zeroValue} + c.GetTokenEndpoint() + c = &ConnectionOptionsOkta{} + c.GetTokenEndpoint() + c = nil + c.GetTokenEndpoint() +} + +func TestConnectionOptionsOkta_GetUserInfoEndpoint(tt *testing.T) { + var zeroValue string + c := &ConnectionOptionsOkta{UserInfoEndpoint: &zeroValue} + c.GetUserInfoEndpoint() + c = &ConnectionOptionsOkta{} + c.GetUserInfoEndpoint() + c = nil + c.GetUserInfoEndpoint() +} + +func TestConnectionOptionsOkta_String(t *testing.T) { + var rawJSON json.RawMessage + v := &ConnectionOptionsOkta{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestConnectionOptionsOTP_GetLength(tt *testing.T) { var zeroValue int c := &ConnectionOptionsOTP{Length: &zeroValue} diff --git a/management/testdata/recordings/TestConnectionManager_Create/It_can_successfully_create_a_Okta_Connection.yaml b/management/testdata/recordings/TestConnectionManager_Create/It_can_successfully_create_a_Okta_Connection.yaml new file mode 100644 index 00000000..530e2a6e --- /dev/null +++ b/management/testdata/recordings/TestConnectionManager_Create/It_can_successfully_create_a_Okta_Connection.yaml @@ -0,0 +1,48 @@ +--- +version: 1 +interactions: + - request: + body: | + {"name":"Test-Okta-Connection-1667572671","strategy":"okta","options":{"client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","domain":"domain.okta.com","authorization_endpoint":"https://example.com","issuer":"https://example.com","jwks_uri":"https://example.com/jwks","userinfo_endpoint":null,"token_endpoint":null,"scope":"openid","upstream_params":{"screen_name":{"alias":"login_hint"}}}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections + method: POST + response: + body: '{"id":"con_fqCtOHApPvrLKyXQ","options":{"client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","domain":"domain.okta.com","authorization_endpoint":"https://domain.okta.com/oauth2/v1/authorize","issuer":"https://domain.okta.com","jwks_uri":"https://domain.okta.com/oauth2/v1/keys","userinfo_endpoint":"https://domain.okta.com/oauth2/v1/userinfo","token_endpoint":"https://domain.okta.com/oauth2/v1/token","scope":"openid profile","upstream_params":{"screen_name":{"alias":"login_hint"}}},"strategy":"okta","name":"Test-Okta-Connection-1667572671","is_domain_connection":false,"show_as_button":false,"enabled_clients":[],"realms":["Test-Okta-Connection-1667572671"]}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Length: + - "687" + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 1ms + - request: + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections/con_fqCtOHApPvrLKyXQ + method: DELETE + response: + body: '{"deleted_at":"2022-11-04T14:37:53.766Z"}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Length: + - "41" + Content-Type: + - application/json; charset=utf-8 + status: 202 Accepted + code: 202 + duration: 1ms diff --git a/management/testdata/recordings/TestConnectionManager_Read/It_can_successfully_read_a_Okta_Connection.yaml b/management/testdata/recordings/TestConnectionManager_Read/It_can_successfully_read_a_Okta_Connection.yaml new file mode 100644 index 00000000..0a211ade --- /dev/null +++ b/management/testdata/recordings/TestConnectionManager_Read/It_can_successfully_read_a_Okta_Connection.yaml @@ -0,0 +1,89 @@ +--- +version: 1 +interactions: + - request: + body: | + {"name":"Test-Okta-Connection-1667572689","strategy":"okta","options":{"client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","domain":"domain.okta.com","authorization_endpoint":"https://example.com","issuer":"https://example.com","jwks_uri":"https://example.com/jwks","userinfo_endpoint":null,"token_endpoint":null,"scope":"openid","upstream_params":{"screen_name":{"alias":"login_hint"}}}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections + method: POST + response: + body: '{"id":"con_xORW5E3rAtlFASyf","options":{"client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","domain":"domain.okta.com","authorization_endpoint":"https://domain.okta.com/oauth2/v1/authorize","issuer":"https://domain.okta.com","jwks_uri":"https://domain.okta.com/oauth2/v1/keys","userinfo_endpoint":"https://domain.okta.com/oauth2/v1/userinfo","token_endpoint":"https://domain.okta.com/oauth2/v1/token","scope":"openid profile","upstream_params":{"screen_name":{"alias":"login_hint"}}},"strategy":"okta","name":"Test-Okta-Connection-1667572689","is_domain_connection":false,"show_as_button":false,"enabled_clients":[],"realms":["Test-Okta-Connection-1667572689"]}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Length: + - "687" + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 1ms + - request: + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections/con_xORW5E3rAtlFASyf + method: GET + response: + body: '{"id":"con_xORW5E3rAtlFASyf","options":{"scope":"openid profile","domain":"domain.okta.com","issuer":"https://domain.okta.com","jwks_uri":"https://domain.okta.com/oauth2/v1/keys","client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","token_endpoint":"https://domain.okta.com/oauth2/v1/token","upstream_params":{"screen_name":{"alias":"login_hint"}},"userinfo_endpoint":"https://domain.okta.com/oauth2/v1/userinfo","authorization_endpoint":"https://domain.okta.com/oauth2/v1/authorize"},"strategy":"okta","name":"Test-Okta-Connection-1667572689","is_domain_connection":false,"show_as_button":false,"enabled_clients":[],"realms":["Test-Okta-Connection-1667572689"]}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 1ms + - request: + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections/con_xORW5E3rAtlFASyf + method: DELETE + response: + body: '{"deleted_at":"2022-11-04T14:38:11.809Z"}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Length: + - "41" + Content-Type: + - application/json; charset=utf-8 + status: 202 Accepted + code: 202 + duration: 1ms + - request: + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections/con_xORW5E3rAtlFASyf + method: DELETE + response: + body: "" + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 1ms diff --git a/management/testdata/recordings/TestConnectionManager_ReadByName/It_can_successfully_find_a_Okta_Connection_by_its_name.yaml b/management/testdata/recordings/TestConnectionManager_ReadByName/It_can_successfully_find_a_Okta_Connection_by_its_name.yaml new file mode 100644 index 00000000..bc3e2b2e --- /dev/null +++ b/management/testdata/recordings/TestConnectionManager_ReadByName/It_can_successfully_find_a_Okta_Connection_by_its_name.yaml @@ -0,0 +1,91 @@ +--- +version: 1 +interactions: + - request: + body: | + {"name":"Test-Okta-Connection-1667572702","strategy":"okta","options":{"client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","domain":"domain.okta.com","authorization_endpoint":"https://example.com","issuer":"https://example.com","jwks_uri":"https://example.com/jwks","userinfo_endpoint":null,"token_endpoint":null,"scope":"openid","upstream_params":{"screen_name":{"alias":"login_hint"}}}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections + method: POST + response: + body: '{"id":"con_tFVpxsc813qywLsc","options":{"client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","domain":"domain.okta.com","authorization_endpoint":"https://domain.okta.com/oauth2/v1/authorize","issuer":"https://domain.okta.com","jwks_uri":"https://domain.okta.com/oauth2/v1/keys","userinfo_endpoint":"https://domain.okta.com/oauth2/v1/userinfo","token_endpoint":"https://domain.okta.com/oauth2/v1/token","scope":"openid profile","upstream_params":{"screen_name":{"alias":"login_hint"}}},"strategy":"okta","name":"Test-Okta-Connection-1667572702","is_domain_connection":false,"show_as_button":false,"enabled_clients":[],"realms":["Test-Okta-Connection-1667572702"]}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Length: + - "687" + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 1ms + - request: + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections?include_totals=true&name=Test-Okta-Connection-1667572702&per_page=50 + method: GET + response: + body: '{"total":1,"start":0,"limit":50,"connections":[{"id":"con_tFVpxsc813qywLsc","options":{"scope":"openid profile","domain":"domain.okta.com","issuer":"https://domain.okta.com","jwks_uri":"https://domain.okta.com/oauth2/v1/keys","client_id":"4ef8d976-71bd-4473-a7ce-087d3f0fafd8","client_secret":"mySecret","token_endpoint":"https://domain.okta.com/oauth2/v1/token","upstream_params":{"screen_name":{"alias":"login_hint"}},"userinfo_endpoint":"https://domain.okta.com/oauth2/v1/userinfo","authorization_endpoint":"https://domain.okta.com/oauth2/v1/authorize"},"strategy":"okta","name":"Test-Okta-Connection-1667572702","is_domain_connection":false,"show_as_button":false,"realms":["Test-Okta-Connection-1667572702"],"enabled_clients":[]}]}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Type: + - application/json; charset=utf-8 + Link: + - ; rel="first", ; rel="last" + status: 200 OK + code: 200 + duration: 1ms + - request: + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections/con_tFVpxsc813qywLsc + method: DELETE + response: + body: '{"deleted_at":"2022-11-04T14:38:25.136Z"}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Length: + - "41" + Content-Type: + - application/json; charset=utf-8 + status: 202 Accepted + code: 202 + duration: 1ms + - request: + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections/con_tFVpxsc813qywLsc + method: DELETE + response: + body: "" + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 1ms diff --git a/management/testdata/recordings/TestConnectionManager_Update/It_can_successfully_update_a_Okta_Connection.yaml b/management/testdata/recordings/TestConnectionManager_Update/It_can_successfully_update_a_Okta_Connection.yaml new file mode 100644 index 00000000..3e10ea02 --- /dev/null +++ b/management/testdata/recordings/TestConnectionManager_Update/It_can_successfully_update_a_Okta_Connection.yaml @@ -0,0 +1,26 @@ +--- +version: 1 +interactions: + - request: + body: | + {"name":"Test-Okta-Connection-1667572714","strategy":"okta"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://go-auth0-dev.eu.auth0.com/api/v2/connections + method: POST + response: + body: '{"statusCode":400,"error":"Bad Request","message":"options.domain is required","errorCode":"invalid_body"}' + headers: + Access-Control-Expose-Headers: + - WWW-Authenticate,Server-Authorization + Content-Length: + - "106" + Content-Type: + - application/json; charset=utf-8 + status: 400 Bad Request + code: 400 + duration: 1ms