From cbaf973ed15bb02dab1f6bb3bf58f87788072797 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Sun, 3 Nov 2024 16:59:33 +0530 Subject: [PATCH 01/11] SSO v2 updates --- management/self_service_profiles.go | 43 +++++- management/self_service_profiles_test.go | 23 ++- .../TestSelfServiceProfileManager_Create.yaml | 26 ++-- ...elfServiceProfileManager_CreateTicket.yaml | 56 +++---- .../TestSelfServiceProfileManager_Delete.yaml | 32 ++-- .../TestSelfServiceProfileManager_List.yaml | 24 +-- .../TestSelfServiceProfileManager_Read.yaml | 26 ++-- ...erviceProfileManager_SetGetCustomText.yaml | 145 ++++++++++++++++++ .../TestSelfServiceProfileManager_Update.yaml | 26 ++-- 9 files changed, 299 insertions(+), 102 deletions(-) create mode 100644 test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml diff --git a/management/self_service_profiles.go b/management/self_service_profiles.go index adeb1cd1..6ef772d5 100644 --- a/management/self_service_profiles.go +++ b/management/self_service_profiles.go @@ -12,6 +12,15 @@ import ( type SelfServiceProfile struct { ID *string `json:"id,omitempty"` + // The name of the self-service Profile + Name *string `json:"name,omitempty"` + // The description of the self-service Profile. + Description *string `json:"description,omitempty"` + + // List of IdP strategies that will be shown to users during the Self-Service SSO flow. + // Possible values: [oidc, samlp, waad, google-apps, adfs, okta, keycloak-samlp] + AllowedStrategies []*string `json:"allowed_strategies,omitempty"` + // List of attributes to be mapped that // will be shown to the user during the SS-SSO flow. UserAttributes []*SelfServiceProfileUserAttributes `json:"user_attributes,omitempty"` @@ -34,6 +43,12 @@ type SelfServiceProfileUserAttributes struct { IsOptional *bool `json:"is_optional"` } +// SelfServiceProfileList is a list of SelfServiceProfiles. +type SelfServiceProfileList struct { + List + SelfServiceProfile []*SelfServiceProfile `json:"self_service_profiles"` +} + // SelfServiceProfileTicket is used to created self-service ticket for a set of clients and organizations. type SelfServiceProfileTicket struct { // If provided, this will allow editing of the @@ -72,13 +87,19 @@ type SelfServiceProfileTicketEnabledOrganizations struct { // MarshalJSON implements the json.Marshaller interface. func (ssp *SelfServiceProfile) MarshalJSON() ([]byte, error) { type SelfServiceProfileSubset struct { - UserAttributes []*SelfServiceProfileUserAttributes `json:"user_attributes,omitempty"` - Branding *Branding `json:"branding,omitempty"` + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + AllowedStrategies []*string `json:"allowed_strategies,omitempty"` + UserAttributes []*SelfServiceProfileUserAttributes `json:"user_attributes,omitempty"` + Branding *Branding `json:"branding,omitempty"` } return json.Marshal(&SelfServiceProfileSubset{ - UserAttributes: ssp.UserAttributes, - Branding: ssp.Branding, + Name: ssp.Name, + Description: ssp.Description, + AllowedStrategies: ssp.AllowedStrategies, + UserAttributes: ssp.UserAttributes, + Branding: ssp.Branding, }) } @@ -92,7 +113,7 @@ func (m *SelfServiceProfileManager) Create(ctx context.Context, s *SelfServicePr } // List all Self Service Profiles. -func (m *SelfServiceProfileManager) List(ctx context.Context, opts ...RequestOption) (s []*SelfServiceProfile, err error) { +func (m *SelfServiceProfileManager) List(ctx context.Context, opts ...RequestOption) (s *SelfServiceProfileList, err error) { err = m.management.Request(ctx, "GET", m.management.URI("self-service-profiles"), &s, applyListDefaults(opts)) return } @@ -113,6 +134,18 @@ func (m *SelfServiceProfileManager) Delete(ctx context.Context, id string, opts return m.management.Request(ctx, "DELETE", m.management.URI("self-service-profiles", id), nil, opts...) } +// GetCustomText retrieves text customizations for a given self-service profile, language and Self Service SSO Flow page. +func (m *SelfServiceProfileManager) GetCustomText(ctx context.Context, id string, language string, page string, opts ...RequestOption) (payload map[string]interface{}, err error) { + err = m.management.Request(ctx, "GET", m.management.URI("self-service-profiles", id, "custom-text", language, page), &payload, opts...) + return +} + +// SetCustomText updates text customizations for a given self-service profile, language and Self Service SSO Flow page. +func (m *SelfServiceProfileManager) SetCustomText(ctx context.Context, id string, language string, page string, payload map[string]interface{}, opts ...RequestOption) (err error) { + err = m.management.Request(ctx, "PUT", m.management.URI("self-service-profiles", id, "custom-text", language, page), payload, opts...) + return +} + // CreateTicket creates a sso-access ticket to initiate the Self Service SSO Flow. func (m *SelfServiceProfileManager) CreateTicket(ctx context.Context, id string, t *SelfServiceProfileTicket, opts ...RequestOption) (err error) { err = m.management.Request(ctx, "POST", m.management.URI("self-service-profiles", id, "sso-ticket"), t, opts...) diff --git a/management/self_service_profiles_test.go b/management/self_service_profiles_test.go index 12cbe935..d35c02b7 100644 --- a/management/self_service_profiles_test.go +++ b/management/self_service_profiles_test.go @@ -15,6 +15,9 @@ import ( func TestSelfServiceProfileManager_Create(t *testing.T) { configureHTTPTestRecordings(t) ssop := &SelfServiceProfile{ + Name: auth0.String("Sample Self Service Profile"), + Description: auth0.String("Sample Desc"), + AllowedStrategies: []*string{auth0.String("oidc")}, Branding: &Branding{ LogoURL: auth0.String("https://example.com/logo.png"), Colors: &BrandingColors{ @@ -45,8 +48,8 @@ func TestSelfServiceProfileManager_List(t *testing.T) { ssop := givenASelfServiceProfile(t) ssopList, err := api.SelfServiceProfile.List(context.Background()) assert.NoError(t, err) - assert.Greater(t, len(ssopList), 0) - assert.Contains(t, ssopList, ssop) + assert.Greater(t, len(ssopList.SelfServiceProfile), 0) + assert.Contains(t, ssopList.SelfServiceProfile, ssop) } func TestSelfServiceProfileManager_Read(t *testing.T) { @@ -92,6 +95,19 @@ func TestSelfServiceProfileManager_Delete(t *testing.T) { assert.Equal(t, http.StatusNotFound, err.(Error).Status()) } +func TestSelfServiceProfileManager_SetGetCustomText(t *testing.T) { + configureHTTPTestRecordings(t) + ssop := givenASelfServiceProfile(t) + payload := map[string]interface{}{ + "introduction": "\"Welcome! With only a few steps you'll be able to setup your new connection.\"\n", + } + err := api.SelfServiceProfile.SetCustomText(context.Background(), ssop.GetID(), "en", "get-started", payload) + assert.Equal(t, err, nil) + retrievedCustomText, err := api.SelfServiceProfile.GetCustomText(context.Background(), ssop.GetID(), "en", "get-started") + assert.Equal(t, err, nil) + assert.Equal(t, payload, retrievedCustomText) +} + func TestSelfServiceProfileManager_CreateTicket(t *testing.T) { configureHTTPTestRecordings(t) ssop := givenASelfServiceProfile(t) @@ -147,6 +163,9 @@ func TestSelfServiceProfileManager_MarshalJSON(t *testing.T) { func givenASelfServiceProfile(t *testing.T) *SelfServiceProfile { t.Helper() ssop := &SelfServiceProfile{ + Name: auth0.String("Sample Self Service Profile"), + Description: auth0.String("Sample Desc"), + AllowedStrategies: []*string{auth0.String("oidc")}, Branding: &Branding{ LogoURL: auth0.String("https://example.com/logo.png"), Colors: &BrandingColors{ diff --git a/test/data/recordings/TestSelfServiceProfileManager_Create.yaml b/test/data/recordings/TestSelfServiceProfileManager_Create.yaml index 5c7b4b86..26d80029 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Create.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Create.yaml @@ -6,20 +6,20 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 186 + content_length: 281 transfer_encoding: [] trailer: {} host: go-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} + {"name":"Sample Self Service Profile","description":"Sample Desc","allowed_strategies":["oidc"],"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles method: POST response: @@ -28,15 +28,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 299 + content_length: 394 uncompressed: false - body: '{"id":"ssp_8z3r5eqUUVBBC1QyZdV5Xq","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T06:32:10.792Z","updated_at":"2024-08-16T06:32:10.792Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_qJjPnZcqrYMQnn5XbrwjDp","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:35.206Z","updated_at":"2024-11-03T11:22:35.206Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 1.047568167s + duration: 999.470917ms - id: 1 request: proto: HTTP/1.1 @@ -54,8 +54,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_8z3r5eqUUVBBC1QyZdV5Xq + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_qJjPnZcqrYMQnn5XbrwjDp method: GET response: proto: HTTP/2.0 @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"ssp_8z3r5eqUUVBBC1QyZdV5Xq","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T06:32:10.792Z","updated_at":"2024-08-16T06:32:10.792Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_qJjPnZcqrYMQnn5XbrwjDp","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:35.206Z","updated_at":"2024-11-03T11:22:35.206Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 410.606208ms + duration: 421.911834ms - id: 2 request: proto: HTTP/1.1 @@ -89,8 +89,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_8z3r5eqUUVBBC1QyZdV5Xq + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_qJjPnZcqrYMQnn5XbrwjDp method: DELETE response: proto: HTTP/2.0 @@ -106,4 +106,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 405.070709ms + duration: 372.68675ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_CreateTicket.yaml b/test/data/recordings/TestSelfServiceProfileManager_CreateTicket.yaml index cd457272..d2003548 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_CreateTicket.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_CreateTicket.yaml @@ -6,20 +6,20 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 186 + content_length: 281 transfer_encoding: [] trailer: {} host: go-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} + {"name":"Sample Self Service Profile","description":"Sample Desc","allowed_strategies":["oidc"],"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles method: POST response: @@ -28,15 +28,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 299 + content_length: 394 uncompressed: false - body: '{"id":"ssp_ataTXvZB8LN7V8WTA5MkGi","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T11:28:41.125Z","updated_at":"2024-08-16T11:28:41.125Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_och8KqA3AkfUuCBi4D76j8","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:47.537Z","updated_at":"2024-11-03T11:22:47.537Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 931.360625ms + duration: 370.6825ms - id: 1 request: proto: HTTP/1.1 @@ -49,13 +49,13 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"Test Client (Aug 16 16:58:41.202)","description":"This is just a test client.","jwt_configuration":{"alg":"RS256"},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"name":"Test Credential (Aug 16 16:58:41.202)","credential_type":"public_key","pem":"-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAua6LXMfgDE/tDdkOL1Oe\n3oWUwg1r4dSTg9L7RCcI5hItUzmkVofHtWN0H4CH2lm2ANmaJUsnhzctYowYW2+R\ntHvU9afTmtbdhpy993972hUqZSYLsE3iGziphYkOKVsqq38+VRH3TNg93zSLoRao\nJnTTkMXseVqiyqYRmFN8+gQQoEclHSGPUWQG5XMZ+hhuXeFyo+Yw/qbZWca/6/2I\n3rsca9jXR1alhxhHrXrg8N4Dm3gBgGbmiht6YYYT2Tyl1OqB9+iOI/9D7dfoCF6X\nAWJXRE454cmC8k8oucpjZVpflA+ocKshwPDR6YTLQYbXYiaWxEoaz0QGUErNQBnG\nI+sr9jDY3ua/s6HF6h0qyi/HVZH4wx+m4CtOfJoYTjrGBbaRszzUxhtSN2/MhXDu\n+a35q9/2zcu/3fjkkfVvGUt+NyyiYOKQ9vsJC1g/xxdUWtowjNwjfZE2zcG4usi8\nr38Bp0lmiipAsMLduZM/D5dFXkRdWCBNDfULmmg/4nv2wwjbjQuLemAMh7mmrztW\ni/85WMnjKQZT8NqS43pmgyIzg1gK1neMqdS90YmQ/PvJ36qALxCs245w1JpN9BAL\nJbwxCg/dbmKT7PalfWrksx9hGcJxtGqebldaOpw+5GVIPxxtC1C0gVr9BKeiDS3f\naibASY5pIRiKENmbZELDtucCAwEAAQ==\n-----END PUBLIC KEY-----"}]}}} + {"name":"Test Client (Nov 3 16:52:47.523)","description":"This is just a test client.","jwt_configuration":{"alg":"RS256"},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"name":"Test Credential (Nov 3 16:52:47.523)","credential_type":"public_key","pem":"-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAua6LXMfgDE/tDdkOL1Oe\n3oWUwg1r4dSTg9L7RCcI5hItUzmkVofHtWN0H4CH2lm2ANmaJUsnhzctYowYW2+R\ntHvU9afTmtbdhpy993972hUqZSYLsE3iGziphYkOKVsqq38+VRH3TNg93zSLoRao\nJnTTkMXseVqiyqYRmFN8+gQQoEclHSGPUWQG5XMZ+hhuXeFyo+Yw/qbZWca/6/2I\n3rsca9jXR1alhxhHrXrg8N4Dm3gBgGbmiht6YYYT2Tyl1OqB9+iOI/9D7dfoCF6X\nAWJXRE454cmC8k8oucpjZVpflA+ocKshwPDR6YTLQYbXYiaWxEoaz0QGUErNQBnG\nI+sr9jDY3ua/s6HF6h0qyi/HVZH4wx+m4CtOfJoYTjrGBbaRszzUxhtSN2/MhXDu\n+a35q9/2zcu/3fjkkfVvGUt+NyyiYOKQ9vsJC1g/xxdUWtowjNwjfZE2zcG4usi8\nr38Bp0lmiipAsMLduZM/D5dFXkRdWCBNDfULmmg/4nv2wwjbjQuLemAMh7mmrztW\ni/85WMnjKQZT8NqS43pmgyIzg1gK1neMqdS90YmQ/PvJ36qALxCs245w1JpN9BAL\nJbwxCg/dbmKT7PalfWrksx9hGcJxtGqebldaOpw+5GVIPxxtC1C0gVr9BKeiDS3f\naibASY5pIRiKENmbZELDtucCAwEAAQ==\n-----END PUBLIC KEY-----"}]}}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/clients method: POST response: @@ -66,13 +66,13 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: '{"name":"Test Client (Aug 16 16:58:41.202)","description":"This is just a test client.","client_id":"8UJoAv2c7yghMFoPii3fMGwsUCCgplFG","client_secret":"[REDACTED]","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"alg":"RS256"},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"custom_login_page_on":true,"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"id":"cred_jtn6eX4JPWkTHqtbuASs1F","name":"Test Credential (Aug 16 16:58:41.202)","kid":"4e7yYf0TKdyTLbVnpq2wLN6mZ8t7eb9UJkMksyHj9iU","credential_type":"public_key","alg":"RS256","created_at":"2024-08-16T11:28:41.547Z","updated_at":"2024-08-16T11:28:41.547Z"}]}}}' + body: '{"name":"Test Client (Nov 3 16:52:47.523)","description":"This is just a test client.","client_id":"a3JzjSc3ul40MWEEjeg1KlQoCmjdjYc7","client_secret":"[REDACTED]","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"alg":"RS256"},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"custom_login_page_on":true,"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"id":"cred_1M67o2mntNLWYievZnaWuD","name":"Test Credential (Nov 3 16:52:47.523)","kid":"4e7yYf0TKdyTLbVnpq2wLN6mZ8t7eb9UJkMksyHj9iU","credential_type":"public_key","alg":"RS256","created_at":"2024-11-03T11:22:48.015Z","updated_at":"2024-11-03T11:22:48.015Z"}]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 496.51ms + duration: 693.030334ms - id: 2 request: proto: HTTP/1.1 @@ -85,13 +85,13 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"test-organization993","display_name":"Test Organization","branding":{"logo_url":"https://example.com/logo.gif"}} + {"name":"test-organization951","display_name":"Test Organization","branding":{"logo_url":"https://example.com/logo.gif"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/organizations method: POST response: @@ -102,13 +102,13 @@ interactions: trailer: {} content_length: 149 uncompressed: false - body: '{"branding":{"logo_url":"https://example.com/logo.gif"},"id":"org_it30IT2ZYGJGlGE8","display_name":"Test Organization","name":"test-organization993"}' + body: '{"branding":{"logo_url":"https://example.com/logo.gif"},"id":"org_jQN5TGbv2dCokEmh","display_name":"Test Organization","name":"test-organization951"}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 366.840083ms + duration: 404.32125ms - id: 3 request: proto: HTTP/1.1 @@ -121,14 +121,14 @@ interactions: remote_addr: "" request_uri: "" body: | - {"connection_config":{"name":"sso-generated-ticket"},"enabled_clients":["8UJoAv2c7yghMFoPii3fMGwsUCCgplFG"],"enabled_organizations":[{"organization_id":"org_it30IT2ZYGJGlGE8"}]} + {"connection_config":{"name":"sso-generated-ticket"},"enabled_clients":["a3JzjSc3ul40MWEEjeg1KlQoCmjdjYc7"],"enabled_organizations":[{"organization_id":"org_jQN5TGbv2dCokEmh"}]} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ataTXvZB8LN7V8WTA5MkGi/sso-ticket + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_och8KqA3AkfUuCBi4D76j8/sso-ticket method: POST response: proto: HTTP/2.0 @@ -138,13 +138,13 @@ interactions: trailer: {} content_length: 148 uncompressed: false - body: '{"ticket":"https://go-auth0-dev.eu.auth0.com.sus.auth0.com/self-service/connections-flow?ticket=dOfSMtXcNhwmLBHzQxhOzuV4gBjfOD6d"}' + body: '{"ticket":"https://go-auth0-dev.eu.auth0.com.sus.auth0.com/self-service/connections-flow?ticket=TALck89q5exmLiu6ojI2kBd1clWQBJXJ"}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 380.580875ms + duration: 516.263875ms - id: 4 request: proto: HTTP/1.1 @@ -162,8 +162,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/organizations/org_it30IT2ZYGJGlGE8 + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/organizations/org_jQN5TGbv2dCokEmh method: DELETE response: proto: HTTP/2.0 @@ -179,7 +179,7 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 350.997041ms + duration: 357.053ms - id: 5 request: proto: HTTP/1.1 @@ -197,8 +197,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/clients/8UJoAv2c7yghMFoPii3fMGwsUCCgplFG + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/clients/a3JzjSc3ul40MWEEjeg1KlQoCmjdjYc7 method: DELETE response: proto: HTTP/2.0 @@ -214,7 +214,7 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 414.216916ms + duration: 432.445458ms - id: 6 request: proto: HTTP/1.1 @@ -232,8 +232,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ataTXvZB8LN7V8WTA5MkGi + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_och8KqA3AkfUuCBi4D76j8 method: DELETE response: proto: HTTP/2.0 @@ -249,4 +249,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 318.091416ms + duration: 379.054791ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml b/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml index 41b28384..127a7964 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml @@ -6,20 +6,20 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 186 + content_length: 281 transfer_encoding: [] trailer: {} host: go-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} + {"name":"Sample Self Service Profile","description":"Sample Desc","allowed_strategies":["oidc"],"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles method: POST response: @@ -28,15 +28,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 299 + content_length: 394 uncompressed: false - body: '{"id":"ssp_5rVuEYmwYVsfZdeXWkBJGT","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T11:52:05.779Z","updated_at":"2024-08-16T11:52:05.779Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_xi7cRjfZUKe3ZDJRGfbQnP","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:43.087Z","updated_at":"2024-11-03T11:22:43.087Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 840.582833ms + duration: 1.390025625s - id: 1 request: proto: HTTP/1.1 @@ -54,8 +54,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_5rVuEYmwYVsfZdeXWkBJGT + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_xi7cRjfZUKe3ZDJRGfbQnP method: DELETE response: proto: HTTP/2.0 @@ -71,7 +71,7 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 345.848333ms + duration: 1.355147s - id: 2 request: proto: HTTP/1.1 @@ -89,8 +89,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_5rVuEYmwYVsfZdeXWkBJGT + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_xi7cRjfZUKe3ZDJRGfbQnP method: GET response: proto: HTTP/2.0 @@ -100,13 +100,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"statusCode":404,"error":"Not Found","message":"Profile with ID: ssp_5rVuEYmwYVsfZdeXWkBJGT not found"}' + body: '{"statusCode":404,"error":"Not Found","message":"Profile with ID: ssp_xi7cRjfZUKe3ZDJRGfbQnP not found"}' headers: Content-Type: - application/json; charset=utf-8 status: 404 Not Found code: 404 - duration: 350.736291ms + duration: 819.694833ms - id: 3 request: proto: HTTP/1.1 @@ -124,8 +124,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_5rVuEYmwYVsfZdeXWkBJGT + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_xi7cRjfZUKe3ZDJRGfbQnP method: DELETE response: proto: HTTP/2.0 @@ -141,4 +141,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 343.957583ms + duration: 440.794959ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_List.yaml b/test/data/recordings/TestSelfServiceProfileManager_List.yaml index 1bdce433..3baf0799 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_List.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_List.yaml @@ -6,20 +6,20 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 186 + content_length: 281 transfer_encoding: [] trailer: {} host: go-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} + {"name":"Sample Self Service Profile","description":"Sample Desc","allowed_strategies":["oidc"],"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles method: POST response: @@ -28,15 +28,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 299 + content_length: 394 uncompressed: false - body: '{"id":"ssp_qDHPZo3Num6pqrs3zJjpo5","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T04:47:26.042Z","updated_at":"2024-08-16T04:47:26.042Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_phtUR1GUidfLrYkboHXwEz","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:36.392Z","updated_at":"2024-11-03T11:22:36.392Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 364.893042ms + duration: 400.065125ms - id: 1 request: proto: HTTP/1.1 @@ -54,7 +54,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles?include_totals=true&per_page=50 method: GET response: @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '[{"id":"ssp_qDHPZo3Num6pqrs3zJjpo5","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T04:47:26.042Z","updated_at":"2024-08-16T04:47:26.042Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}]' + body: '{"self_service_profiles":[{"id":"ssp_iWfKxu6gD5yrdn5fFCJmPy","name":"Default","user_attributes":[{"name":"temporary-name","description":"temporary-description","is_optional":false},{"name":"Email","description":"Email of the user","is_optional":false}],"allowed_strategies":["oidc","samlp","waad","google-apps","adfs","okta"],"created_at":"2024-08-26T08:05:28.700Z","updated_at":"2024-09-05T10:24:25.448Z","branding":{"logo_url":"https://example1.com","colors":{"primary":"#000000"}}},{"id":"ssp_25cy2NK6URnoYznQjdKBhJ","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T21:47:20.662Z","updated_at":"2024-11-02T21:47:20.662Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_iRgrA1NCG6MssoSYTqaVkP","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:12:40.704Z","updated_at":"2024-11-02T22:12:40.704Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_qVGSXZKfPu52o3a9KPazoa","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:54:30.033Z","updated_at":"2024-11-02T22:54:30.033Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_92CJaWR1ANrhLaFcYkbtWM","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:56:32.638Z","updated_at":"2024-11-02T22:56:32.638Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_oUrXXpQpRUmGUgzN3yj9sS","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:59:49.720Z","updated_at":"2024-11-02T22:59:49.720Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_nPMRi5JbUj2Zwm3AQ61HGH","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T23:00:32.193Z","updated_at":"2024-11-02T23:00:32.193Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_2KaAu4XFJrspydjqdiHw5g","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T23:25:18.142Z","updated_at":"2024-11-02T23:25:18.142Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_f5xKkP6ADKPXYyM9UVAPk6","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:06:35.013Z","updated_at":"2024-11-03T11:06:35.013Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_phtUR1GUidfLrYkboHXwEz","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:36.392Z","updated_at":"2024-11-03T11:22:36.392Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}],"start":0,"limit":50,"total":10}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 328.563042ms + duration: 385.9405ms - id: 2 request: proto: HTTP/1.1 @@ -89,8 +89,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_qDHPZo3Num6pqrs3zJjpo5 + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_phtUR1GUidfLrYkboHXwEz method: DELETE response: proto: HTTP/2.0 @@ -106,4 +106,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 389.384ms + duration: 375.619875ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_Read.yaml b/test/data/recordings/TestSelfServiceProfileManager_Read.yaml index 2550f491..b6370daa 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Read.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Read.yaml @@ -6,20 +6,20 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 186 + content_length: 281 transfer_encoding: [] trailer: {} host: go-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} + {"name":"Sample Self Service Profile","description":"Sample Desc","allowed_strategies":["oidc"],"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles method: POST response: @@ -28,15 +28,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 299 + content_length: 394 uncompressed: false - body: '{"id":"ssp_5z7VgvtdZvRa2GKFgPubrV","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T04:47:27.100Z","updated_at":"2024-08-16T04:47:27.100Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_gWpVmhK4RAN2UGyhGYw6fa","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:37.535Z","updated_at":"2024-11-03T11:22:37.535Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 333.569334ms + duration: 372.946417ms - id: 1 request: proto: HTTP/1.1 @@ -54,8 +54,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_5z7VgvtdZvRa2GKFgPubrV + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_gWpVmhK4RAN2UGyhGYw6fa method: GET response: proto: HTTP/2.0 @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"ssp_5z7VgvtdZvRa2GKFgPubrV","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T04:47:27.100Z","updated_at":"2024-08-16T04:47:27.100Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_gWpVmhK4RAN2UGyhGYw6fa","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:37.535Z","updated_at":"2024-11-03T11:22:37.535Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 335.251209ms + duration: 372.472959ms - id: 2 request: proto: HTTP/1.1 @@ -89,8 +89,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_5z7VgvtdZvRa2GKFgPubrV + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_gWpVmhK4RAN2UGyhGYw6fa method: DELETE response: proto: HTTP/2.0 @@ -106,4 +106,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 326.430334ms + duration: 428.606917ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml b/test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml new file mode 100644 index 00000000..47dba9e7 --- /dev/null +++ b/test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml @@ -0,0 +1,145 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 281 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"Sample Self Service Profile","description":"Sample Desc","allowed_strategies":["oidc"],"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 394 + uncompressed: false + body: '{"id":"ssp_ewp8V2UgURp3k4d3AEVtdD","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:46.060Z","updated_at":"2024-11-03T11:22:46.060Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 343.682541ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 101 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"introduction":"\"Welcome! With only a few steps you'll be able to setup your new connection.\"\n"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ewp8V2UgURp3k4d3AEVtdD/custom-text/en/get-started + method: PUT + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"introduction":"\"Welcome! With only a few steps you''ll be able to setup your new connection.\"\n"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 361.896375ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ewp8V2UgURp3k4d3AEVtdD/custom-text/en/get-started + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"introduction":"\"Welcome! With only a few steps you''ll be able to setup your new connection.\"\n"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 362.033208ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ewp8V2UgURp3k4d3AEVtdD + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 370.916292ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_Update.yaml b/test/data/recordings/TestSelfServiceProfileManager_Update.yaml index 0741751d..77487baf 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Update.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Update.yaml @@ -6,20 +6,20 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 186 + content_length: 281 transfer_encoding: [] trailer: {} host: go-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} + {"name":"Sample Self Service Profile","description":"Sample Desc","allowed_strategies":["oidc"],"user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"branding":{"colors":{"primary":"#334455"},"logo_url":"https://example.com/logo.png"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 + - Go-Auth0/1.11.2 url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles method: POST response: @@ -28,15 +28,15 @@ interactions: proto_minor: 0 transfer_encoding: [] trailer: {} - content_length: 299 + content_length: 394 uncompressed: false - body: '{"id":"ssp_ucmMn4kiwy3cVSbcqd12ab","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T11:28:59.875Z","updated_at":"2024-08-16T11:28:59.875Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_6ZpGku5zb9rtSK5yeuNHgH","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:39.024Z","updated_at":"2024-11-03T11:22:39.024Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 812.088292ms + duration: 689.450959ms - id: 1 request: proto: HTTP/1.1 @@ -55,8 +55,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ucmMn4kiwy3cVSbcqd12ab + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_6ZpGku5zb9rtSK5yeuNHgH method: PATCH response: proto: HTTP/2.0 @@ -66,13 +66,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"ssp_ucmMn4kiwy3cVSbcqd12ab","user_attributes":[{"name":"some-new-name-here","description":"some-description","is_optional":true}],"created_at":"2024-08-16T11:28:59.875Z","updated_at":"2024-08-16T11:29:00.219Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_6ZpGku5zb9rtSK5yeuNHgH","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-new-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:39.024Z","updated_at":"2024-11-03T11:22:40.247Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 326.74275ms + duration: 1.216916s - id: 2 request: proto: HTTP/1.1 @@ -90,8 +90,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.8.0 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ucmMn4kiwy3cVSbcqd12ab + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_6ZpGku5zb9rtSK5yeuNHgH method: DELETE response: proto: HTTP/2.0 @@ -107,4 +107,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 338.375875ms + duration: 1.450706666s From a7d5b7ec237e78b5bf03523de9f8427c8dccf11c Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Sun, 3 Nov 2024 17:11:16 +0530 Subject: [PATCH 02/11] Added generate files --- management/management.gen.go | 21 +++++++++++++++++++++ management/management.gen_test.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/management/management.gen.go b/management/management.gen.go index 99685f73..1179187e 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -9987,6 +9987,14 @@ func (s *SelfServiceProfile) GetCreatedAt() time.Time { return *s.CreatedAt } +// GetDescription returns the Description field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfile) GetDescription() string { + if s == nil || s.Description == nil { + return "" + } + return *s.Description +} + // GetID returns the ID field if it's non-nil, zero value otherwise. func (s *SelfServiceProfile) GetID() string { if s == nil || s.ID == nil { @@ -9995,6 +10003,14 @@ func (s *SelfServiceProfile) GetID() string { return *s.ID } +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfile) GetName() string { + if s == nil || s.Name == nil { + return "" + } + return *s.Name +} + // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. func (s *SelfServiceProfile) GetUpdatedAt() time.Time { if s == nil || s.UpdatedAt == nil { @@ -10008,6 +10024,11 @@ func (s *SelfServiceProfile) String() string { return Stringify(s) } +// String returns a string representation of SelfServiceProfileList. +func (s *SelfServiceProfileList) String() string { + return Stringify(s) +} + // GetConnectionConfig returns the ConnectionConfig field. func (s *SelfServiceProfileTicket) GetConnectionConfig() *SelfServiceProfileTicketConnectionConfig { if s == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 54e4832d..12306943 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -12557,6 +12557,16 @@ func TestSelfServiceProfile_GetCreatedAt(tt *testing.T) { s.GetCreatedAt() } +func TestSelfServiceProfile_GetDescription(tt *testing.T) { + var zeroValue string + s := &SelfServiceProfile{Description: &zeroValue} + s.GetDescription() + s = &SelfServiceProfile{} + s.GetDescription() + s = nil + s.GetDescription() +} + func TestSelfServiceProfile_GetID(tt *testing.T) { var zeroValue string s := &SelfServiceProfile{ID: &zeroValue} @@ -12567,6 +12577,16 @@ func TestSelfServiceProfile_GetID(tt *testing.T) { s.GetID() } +func TestSelfServiceProfile_GetName(tt *testing.T) { + var zeroValue string + s := &SelfServiceProfile{Name: &zeroValue} + s.GetName() + s = &SelfServiceProfile{} + s.GetName() + s = nil + s.GetName() +} + func TestSelfServiceProfile_GetUpdatedAt(tt *testing.T) { var zeroValue time.Time s := &SelfServiceProfile{UpdatedAt: &zeroValue} @@ -12585,6 +12605,14 @@ func TestSelfServiceProfile_String(t *testing.T) { } } +func TestSelfServiceProfileList_String(t *testing.T) { + var rawJSON json.RawMessage + v := &SelfServiceProfileList{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + func TestSelfServiceProfileTicket_GetConnectionConfig(tt *testing.T) { s := &SelfServiceProfileTicket{} s.GetConnectionConfig() From 1e73ae9a07de8ef57c96c78058e11dcc2fb2eda5 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Thu, 7 Nov 2024 01:12:17 +0530 Subject: [PATCH 03/11] Added new endpoints --- management/management.gen.go | 77 +++++++++++++++ management/management.gen_test.go | 98 +++++++++++++++++++ management/self_service_profiles.go | 29 +++++- management/self_service_profiles_test.go | 26 ++++- .../TestSelfServiceProfileManager_Create.yaml | 14 +-- ...ProfileManager_CreateAndRevokeTicket.yaml} | 77 +++++++++++---- .../TestSelfServiceProfileManager_Delete.yaml | 18 ++-- .../TestSelfServiceProfileManager_List.yaml | 12 +-- .../TestSelfServiceProfileManager_Read.yaml | 14 +-- ...erviceProfileManager_SetGetCustomText.yaml | 16 +-- .../TestSelfServiceProfileManager_Update.yaml | 14 +-- 11 files changed, 325 insertions(+), 70 deletions(-) rename test/data/recordings/{TestSelfServiceProfileManager_CreateTicket.yaml => TestSelfServiceProfileManager_CreateAndRevokeTicket.yaml} (73%) diff --git a/management/management.gen.go b/management/management.gen.go index 1179187e..ae217604 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -10058,11 +10058,88 @@ func (s *SelfServiceProfileTicket) String() string { return Stringify(s) } +// GetDisplayName returns the DisplayName field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketConnectionConfig) GetDisplayName() string { + if s == nil || s.DisplayName == nil { + return "" + } + return *s.DisplayName +} + +// GetIsDomainConnection returns the IsDomainConnection field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketConnectionConfig) GetIsDomainConnection() bool { + if s == nil || s.IsDomainConnection == nil { + return false + } + return *s.IsDomainConnection +} + +// GetMetadata returns the Metadata field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketConnectionConfig) GetMetadata() map[string]interface{} { + if s == nil || s.Metadata == nil { + return map[string]interface{}{} + } + return *s.Metadata +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketConnectionConfig) GetName() string { + if s == nil || s.Name == nil { + return "" + } + return *s.Name +} + +// GetShowAsButton returns the ShowAsButton field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketConnectionConfig) GetShowAsButton() bool { + if s == nil || s.ShowAsButton == nil { + return false + } + return *s.ShowAsButton +} + // String returns a string representation of SelfServiceProfileTicketConnectionConfig. func (s *SelfServiceProfileTicketConnectionConfig) String() string { return Stringify(s) } +// GetIconURL returns the IconURL field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketConnectionConfigOptions) GetIconURL() string { + if s == nil || s.IconURL == nil { + return "" + } + return *s.IconURL +} + +// String returns a string representation of SelfServiceProfileTicketConnectionConfigOptions. +func (s *SelfServiceProfileTicketConnectionConfigOptions) String() string { + return Stringify(s) +} + +// GetAssignMembershipOnLogin returns the AssignMembershipOnLogin field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketEnabledOrganizations) GetAssignMembershipOnLogin() bool { + if s == nil || s.AssignMembershipOnLogin == nil { + return false + } + return *s.AssignMembershipOnLogin +} + +// GetOrganizationID returns the OrganizationID field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketEnabledOrganizations) GetOrganizationID() string { + if s == nil || s.OrganizationID == nil { + return "" + } + return *s.OrganizationID +} + +// GetShowAsButton returns the ShowAsButton field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketEnabledOrganizations) GetShowAsButton() bool { + if s == nil || s.ShowAsButton == nil { + return false + } + return *s.ShowAsButton +} + // String returns a string representation of SelfServiceProfileTicketEnabledOrganizations. func (s *SelfServiceProfileTicketEnabledOrganizations) String() string { return Stringify(s) diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 12306943..2670c6b1 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -12648,6 +12648,56 @@ func TestSelfServiceProfileTicket_String(t *testing.T) { } } +func TestSelfServiceProfileTicketConnectionConfig_GetDisplayName(tt *testing.T) { + var zeroValue string + s := &SelfServiceProfileTicketConnectionConfig{DisplayName: &zeroValue} + s.GetDisplayName() + s = &SelfServiceProfileTicketConnectionConfig{} + s.GetDisplayName() + s = nil + s.GetDisplayName() +} + +func TestSelfServiceProfileTicketConnectionConfig_GetIsDomainConnection(tt *testing.T) { + var zeroValue bool + s := &SelfServiceProfileTicketConnectionConfig{IsDomainConnection: &zeroValue} + s.GetIsDomainConnection() + s = &SelfServiceProfileTicketConnectionConfig{} + s.GetIsDomainConnection() + s = nil + s.GetIsDomainConnection() +} + +func TestSelfServiceProfileTicketConnectionConfig_GetMetadata(tt *testing.T) { + var zeroValue map[string]interface{} + s := &SelfServiceProfileTicketConnectionConfig{Metadata: &zeroValue} + s.GetMetadata() + s = &SelfServiceProfileTicketConnectionConfig{} + s.GetMetadata() + s = nil + s.GetMetadata() +} + +func TestSelfServiceProfileTicketConnectionConfig_GetName(tt *testing.T) { + var zeroValue string + s := &SelfServiceProfileTicketConnectionConfig{Name: &zeroValue} + s.GetName() + s = &SelfServiceProfileTicketConnectionConfig{} + s.GetName() + s = nil + s.GetName() +} + +func TestSelfServiceProfileTicketConnectionConfig_GetShowAsButton(tt *testing.T) { + var zeroValue bool + s := &SelfServiceProfileTicketConnectionConfig{ShowAsButton: &zeroValue} + s.GetShowAsButton() + s = &SelfServiceProfileTicketConnectionConfig{} + s.GetShowAsButton() + s = nil + s.GetShowAsButton() +} + func TestSelfServiceProfileTicketConnectionConfig_String(t *testing.T) { var rawJSON json.RawMessage v := &SelfServiceProfileTicketConnectionConfig{} @@ -12656,6 +12706,54 @@ func TestSelfServiceProfileTicketConnectionConfig_String(t *testing.T) { } } +func TestSelfServiceProfileTicketConnectionConfigOptions_GetIconURL(tt *testing.T) { + var zeroValue string + s := &SelfServiceProfileTicketConnectionConfigOptions{IconURL: &zeroValue} + s.GetIconURL() + s = &SelfServiceProfileTicketConnectionConfigOptions{} + s.GetIconURL() + s = nil + s.GetIconURL() +} + +func TestSelfServiceProfileTicketConnectionConfigOptions_String(t *testing.T) { + var rawJSON json.RawMessage + v := &SelfServiceProfileTicketConnectionConfigOptions{} + if err := json.Unmarshal([]byte(v.String()), &rawJSON); err != nil { + t.Errorf("failed to produce a valid json") + } +} + +func TestSelfServiceProfileTicketEnabledOrganizations_GetAssignMembershipOnLogin(tt *testing.T) { + var zeroValue bool + s := &SelfServiceProfileTicketEnabledOrganizations{AssignMembershipOnLogin: &zeroValue} + s.GetAssignMembershipOnLogin() + s = &SelfServiceProfileTicketEnabledOrganizations{} + s.GetAssignMembershipOnLogin() + s = nil + s.GetAssignMembershipOnLogin() +} + +func TestSelfServiceProfileTicketEnabledOrganizations_GetOrganizationID(tt *testing.T) { + var zeroValue string + s := &SelfServiceProfileTicketEnabledOrganizations{OrganizationID: &zeroValue} + s.GetOrganizationID() + s = &SelfServiceProfileTicketEnabledOrganizations{} + s.GetOrganizationID() + s = nil + s.GetOrganizationID() +} + +func TestSelfServiceProfileTicketEnabledOrganizations_GetShowAsButton(tt *testing.T) { + var zeroValue bool + s := &SelfServiceProfileTicketEnabledOrganizations{ShowAsButton: &zeroValue} + s.GetShowAsButton() + s = &SelfServiceProfileTicketEnabledOrganizations{} + s.GetShowAsButton() + s = nil + s.GetShowAsButton() +} + func TestSelfServiceProfileTicketEnabledOrganizations_String(t *testing.T) { var rawJSON json.RawMessage v := &SelfServiceProfileTicketEnabledOrganizations{} diff --git a/management/self_service_profiles.go b/management/self_service_profiles.go index 6ef772d5..bb14eb31 100644 --- a/management/self_service_profiles.go +++ b/management/self_service_profiles.go @@ -67,6 +67,8 @@ type SelfServiceProfileTicket struct { // connection will be enabled for. EnabledOrganizations []*SelfServiceProfileTicketEnabledOrganizations `json:"enabled_organizations,omitempty"` + TTLSec int `json:"ttl_sec"` + // The ticket that is generated. Ticket *string `json:"ticket,omitempty"` } @@ -75,13 +77,30 @@ type SelfServiceProfileTicket struct { type SelfServiceProfileTicketConnectionConfig struct { // The name of the connection that will be // created as a part of the SSO flow. - Name string `json:"name,omitempty"` + Name *string `json:"name,omitempty"` + + // The display name of the connection that will be + // created as a part of the SSO flow. + DisplayName *string `json:"display_name,omitempty"` + + IsDomainConnection *bool `json:"is_domain_connection,omitempty"` + ShowAsButton *bool `json:"show_as_button,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Options SelfServiceProfileTicketConnectionConfigOptions `json:"options,omitempty"` +} + +// SelfServiceProfileTicketConnectionConfigOptions is the list of Options for SSO Ticket. +type SelfServiceProfileTicketConnectionConfigOptions struct { + IconURL *string `json:"icon_url,omitempty"` + DomainAliases []*string `json:"domain_aliases,omitempty"` } // SelfServiceProfileTicketEnabledOrganizations is the list of Organizations associated with the SSO Ticket. type SelfServiceProfileTicketEnabledOrganizations struct { // Organization identifier. - OrganizationID string `json:"organization_id,omitempty"` + OrganizationID *string `json:"organization_id,omitempty"` + AssignMembershipOnLogin *bool `json:"assign_membership_on_login,omitempty"` + ShowAsButton *bool `json:"show_as_button,omitempty"` } // MarshalJSON implements the json.Marshaller interface. @@ -151,3 +170,9 @@ func (m *SelfServiceProfileManager) CreateTicket(ctx context.Context, id string, err = m.management.Request(ctx, "POST", m.management.URI("self-service-profiles", id, "sso-ticket"), t, opts...) return } + +// RevokeTicket revokes the sso-access ticket against a specific SSO Profile. +func (m *SelfServiceProfileManager) RevokeTicket(ctx context.Context, id string, ticketID string, opts ...RequestOption) (err error) { + err = m.management.Request(ctx, "POST", m.management.URI("self-service-profiles", id, "sso-ticket", ticketID, "revoke"), nil, opts...) + return +} diff --git a/management/self_service_profiles_test.go b/management/self_service_profiles_test.go index d35c02b7..4b7d2a8a 100644 --- a/management/self_service_profiles_test.go +++ b/management/self_service_profiles_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "net/http" + "strings" "testing" "time" @@ -108,7 +109,7 @@ func TestSelfServiceProfileManager_SetGetCustomText(t *testing.T) { assert.Equal(t, payload, retrievedCustomText) } -func TestSelfServiceProfileManager_CreateTicket(t *testing.T) { +func TestSelfServiceProfileManager_CreateAndRevokeTicket(t *testing.T) { configureHTTPTestRecordings(t) ssop := givenASelfServiceProfile(t) client := givenAClient(t) @@ -116,18 +117,37 @@ func TestSelfServiceProfileManager_CreateTicket(t *testing.T) { ticket := &SelfServiceProfileTicket{ ConnectionConfig: &SelfServiceProfileTicketConnectionConfig{ - Name: "sso-generated-ticket", + Name: auth0.String("sso-generated-ticket"), + DisplayName: auth0.String("sso-generated-ticket-display-name"), + IsDomainConnection: auth0.Bool(true), + ShowAsButton: auth0.Bool(true), + Metadata: &map[string]interface{}{ + "key1": "value1", + "key2": "value2", + }, + Options: SelfServiceProfileTicketConnectionConfigOptions{ + IconURL: auth0.String("https://metabox.com/my_icon.jpeg"), + DomainAliases: []*string{auth0.String("okta.com")}, + }, }, EnabledClients: []*string{auth0.String(client.GetClientID())}, EnabledOrganizations: []*SelfServiceProfileTicketEnabledOrganizations{ { - org.GetID(), + AssignMembershipOnLogin: auth0.Bool(true), + ShowAsButton: auth0.Bool(true), + OrganizationID: auth0.String(org.GetID()), }, }, } err := api.SelfServiceProfile.CreateTicket(context.Background(), ssop.GetID(), ticket) assert.NoError(t, err) assert.NotEmpty(t, ticket.GetTicket()) + + ticketURL := ticket.GetTicket() + ticketID := ticketURL[strings.LastIndex(ticketURL, "=")+1:] + + err = api.SelfServiceProfile.RevokeTicket(context.Background(), ssop.GetID(), ticketID) + assert.NoError(t, err) } func TestSelfServiceProfileManager_MarshalJSON(t *testing.T) { diff --git a/test/data/recordings/TestSelfServiceProfileManager_Create.yaml b/test/data/recordings/TestSelfServiceProfileManager_Create.yaml index 26d80029..8caba64a 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Create.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Create.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 394 uncompressed: false - body: '{"id":"ssp_qJjPnZcqrYMQnn5XbrwjDp","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:35.206Z","updated_at":"2024-11-03T11:22:35.206Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_rRN6NKjp1Xk3SoghgjovRx","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:31.394Z","updated_at":"2024-11-06T19:41:31.394Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 999.470917ms + duration: 1.290922208s - id: 1 request: proto: HTTP/1.1 @@ -55,7 +55,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_qJjPnZcqrYMQnn5XbrwjDp + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_rRN6NKjp1Xk3SoghgjovRx method: GET response: proto: HTTP/2.0 @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"ssp_qJjPnZcqrYMQnn5XbrwjDp","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:35.206Z","updated_at":"2024-11-03T11:22:35.206Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_rRN6NKjp1Xk3SoghgjovRx","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:31.394Z","updated_at":"2024-11-06T19:41:31.394Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 421.911834ms + duration: 437.787458ms - id: 2 request: proto: HTTP/1.1 @@ -90,7 +90,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_qJjPnZcqrYMQnn5XbrwjDp + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_rRN6NKjp1Xk3SoghgjovRx method: DELETE response: proto: HTTP/2.0 @@ -106,4 +106,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 372.68675ms + duration: 364.379833ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_CreateTicket.yaml b/test/data/recordings/TestSelfServiceProfileManager_CreateAndRevokeTicket.yaml similarity index 73% rename from test/data/recordings/TestSelfServiceProfileManager_CreateTicket.yaml rename to test/data/recordings/TestSelfServiceProfileManager_CreateAndRevokeTicket.yaml index d2003548..633c3e2c 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_CreateTicket.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_CreateAndRevokeTicket.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 394 uncompressed: false - body: '{"id":"ssp_och8KqA3AkfUuCBi4D76j8","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:47.537Z","updated_at":"2024-11-03T11:22:47.537Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_b49fzgD4KpifFwcjHRHGUZ","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:53.127Z","updated_at":"2024-11-06T19:41:53.127Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 370.6825ms + duration: 418.79275ms - id: 1 request: proto: HTTP/1.1 @@ -49,7 +49,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"Test Client (Nov 3 16:52:47.523)","description":"This is just a test client.","jwt_configuration":{"alg":"RS256"},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"name":"Test Credential (Nov 3 16:52:47.523)","credential_type":"public_key","pem":"-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAua6LXMfgDE/tDdkOL1Oe\n3oWUwg1r4dSTg9L7RCcI5hItUzmkVofHtWN0H4CH2lm2ANmaJUsnhzctYowYW2+R\ntHvU9afTmtbdhpy993972hUqZSYLsE3iGziphYkOKVsqq38+VRH3TNg93zSLoRao\nJnTTkMXseVqiyqYRmFN8+gQQoEclHSGPUWQG5XMZ+hhuXeFyo+Yw/qbZWca/6/2I\n3rsca9jXR1alhxhHrXrg8N4Dm3gBgGbmiht6YYYT2Tyl1OqB9+iOI/9D7dfoCF6X\nAWJXRE454cmC8k8oucpjZVpflA+ocKshwPDR6YTLQYbXYiaWxEoaz0QGUErNQBnG\nI+sr9jDY3ua/s6HF6h0qyi/HVZH4wx+m4CtOfJoYTjrGBbaRszzUxhtSN2/MhXDu\n+a35q9/2zcu/3fjkkfVvGUt+NyyiYOKQ9vsJC1g/xxdUWtowjNwjfZE2zcG4usi8\nr38Bp0lmiipAsMLduZM/D5dFXkRdWCBNDfULmmg/4nv2wwjbjQuLemAMh7mmrztW\ni/85WMnjKQZT8NqS43pmgyIzg1gK1neMqdS90YmQ/PvJ36qALxCs245w1JpN9BAL\nJbwxCg/dbmKT7PalfWrksx9hGcJxtGqebldaOpw+5GVIPxxtC1C0gVr9BKeiDS3f\naibASY5pIRiKENmbZELDtucCAwEAAQ==\n-----END PUBLIC KEY-----"}]}}} + {"name":"Test Client (Nov 7 01:11:53.163)","description":"This is just a test client.","jwt_configuration":{"alg":"RS256"},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"name":"Test Credential (Nov 7 01:11:53.163)","credential_type":"public_key","pem":"-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAua6LXMfgDE/tDdkOL1Oe\n3oWUwg1r4dSTg9L7RCcI5hItUzmkVofHtWN0H4CH2lm2ANmaJUsnhzctYowYW2+R\ntHvU9afTmtbdhpy993972hUqZSYLsE3iGziphYkOKVsqq38+VRH3TNg93zSLoRao\nJnTTkMXseVqiyqYRmFN8+gQQoEclHSGPUWQG5XMZ+hhuXeFyo+Yw/qbZWca/6/2I\n3rsca9jXR1alhxhHrXrg8N4Dm3gBgGbmiht6YYYT2Tyl1OqB9+iOI/9D7dfoCF6X\nAWJXRE454cmC8k8oucpjZVpflA+ocKshwPDR6YTLQYbXYiaWxEoaz0QGUErNQBnG\nI+sr9jDY3ua/s6HF6h0qyi/HVZH4wx+m4CtOfJoYTjrGBbaRszzUxhtSN2/MhXDu\n+a35q9/2zcu/3fjkkfVvGUt+NyyiYOKQ9vsJC1g/xxdUWtowjNwjfZE2zcG4usi8\nr38Bp0lmiipAsMLduZM/D5dFXkRdWCBNDfULmmg/4nv2wwjbjQuLemAMh7mmrztW\ni/85WMnjKQZT8NqS43pmgyIzg1gK1neMqdS90YmQ/PvJ36qALxCs245w1JpN9BAL\nJbwxCg/dbmKT7PalfWrksx9hGcJxtGqebldaOpw+5GVIPxxtC1C0gVr9BKeiDS3f\naibASY5pIRiKENmbZELDtucCAwEAAQ==\n-----END PUBLIC KEY-----"}]}}} form: {} headers: Content-Type: @@ -66,13 +66,13 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: '{"name":"Test Client (Nov 3 16:52:47.523)","description":"This is just a test client.","client_id":"a3JzjSc3ul40MWEEjeg1KlQoCmjdjYc7","client_secret":"[REDACTED]","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"alg":"RS256"},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"custom_login_page_on":true,"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"id":"cred_1M67o2mntNLWYievZnaWuD","name":"Test Credential (Nov 3 16:52:47.523)","kid":"4e7yYf0TKdyTLbVnpq2wLN6mZ8t7eb9UJkMksyHj9iU","credential_type":"public_key","alg":"RS256","created_at":"2024-11-03T11:22:48.015Z","updated_at":"2024-11-03T11:22:48.015Z"}]}}}' + body: '{"name":"Test Client (Nov 7 01:11:53.163)","description":"This is just a test client.","client_id":"gneapOPWyHQd1V74TUujvupxgN7DtnHr","client_secret":"[REDACTED]","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"alg":"RS256"},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token","client_credentials"],"custom_login_page_on":true,"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"organization_usage":"allow","client_authentication_methods":{"private_key_jwt":{"credentials":[{"id":"cred_49aa13Y7XBtvEoh6B7pxwN","name":"Test Credential (Nov 7 01:11:53.163)","kid":"4e7yYf0TKdyTLbVnpq2wLN6mZ8t7eb9UJkMksyHj9iU","credential_type":"public_key","alg":"RS256","created_at":"2024-11-06T19:41:53.581Z","updated_at":"2024-11-06T19:41:53.581Z"}]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 693.030334ms + duration: 553.813583ms - id: 2 request: proto: HTTP/1.1 @@ -85,7 +85,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"test-organization951","display_name":"Test Organization","branding":{"logo_url":"https://example.com/logo.gif"}} + {"name":"test-organization663","display_name":"Test Organization","branding":{"logo_url":"https://example.com/logo.gif"}} form: {} headers: Content-Type: @@ -102,33 +102,33 @@ interactions: trailer: {} content_length: 149 uncompressed: false - body: '{"branding":{"logo_url":"https://example.com/logo.gif"},"id":"org_jQN5TGbv2dCokEmh","display_name":"Test Organization","name":"test-organization951"}' + body: '{"id":"org_rhKNJ9LILljaHbkL","display_name":"Test Organization","name":"test-organization663","branding":{"logo_url":"https://example.com/logo.gif"}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 404.32125ms + duration: 415.160625ms - id: 3 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 178 + content_length: 480 transfer_encoding: [] trailer: {} host: go-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"connection_config":{"name":"sso-generated-ticket"},"enabled_clients":["a3JzjSc3ul40MWEEjeg1KlQoCmjdjYc7"],"enabled_organizations":[{"organization_id":"org_jQN5TGbv2dCokEmh"}]} + {"connection_config":{"name":"sso-generated-ticket","display_name":"sso-generated-ticket-display-name","is_domain_connection":true,"show_as_button":true,"metadata":{"key1":"value1","key2":"value2"},"options":{"icon_url":"https://metabox.com/my_icon.jpeg","domain_aliases":["okta.com"]}},"enabled_clients":["gneapOPWyHQd1V74TUujvupxgN7DtnHr"],"enabled_organizations":[{"organization_id":"org_rhKNJ9LILljaHbkL","assign_membership_on_login":true,"show_as_button":true}],"ttl_sec":0} form: {} headers: Content-Type: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_och8KqA3AkfUuCBi4D76j8/sso-ticket + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_b49fzgD4KpifFwcjHRHGUZ/sso-ticket method: POST response: proto: HTTP/2.0 @@ -138,13 +138,13 @@ interactions: trailer: {} content_length: 148 uncompressed: false - body: '{"ticket":"https://go-auth0-dev.eu.auth0.com.sus.auth0.com/self-service/connections-flow?ticket=TALck89q5exmLiu6ojI2kBd1clWQBJXJ"}' + body: '{"ticket":"https://go-auth0-dev.eu.auth0.com.sus.auth0.com/self-service/connections-flow?ticket=1vJz1F68UUUKat7iZHLYBsfVP481VljX"}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 516.263875ms + duration: 435.449208ms - id: 4 request: proto: HTTP/1.1 @@ -163,7 +163,42 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/organizations/org_jQN5TGbv2dCokEmh + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_b49fzgD4KpifFwcjHRHGUZ/sso-ticket/1vJz1F68UUUKat7iZHLYBsfVP481VljX/revoke + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 2 + uncompressed: false + body: '{}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 202 Accepted + code: 202 + duration: 488.219667ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: go-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.11.2 + url: https://go-auth0-dev.eu.auth0.com/api/v2/organizations/org_rhKNJ9LILljaHbkL method: DELETE response: proto: HTTP/2.0 @@ -179,8 +214,8 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 357.053ms - - id: 5 + duration: 366.146541ms + - id: 6 request: proto: HTTP/1.1 proto_major: 1 @@ -198,7 +233,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/clients/a3JzjSc3ul40MWEEjeg1KlQoCmjdjYc7 + url: https://go-auth0-dev.eu.auth0.com/api/v2/clients/gneapOPWyHQd1V74TUujvupxgN7DtnHr method: DELETE response: proto: HTTP/2.0 @@ -214,8 +249,8 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 432.445458ms - - id: 6 + duration: 441.780416ms + - id: 7 request: proto: HTTP/1.1 proto_major: 1 @@ -233,7 +268,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_och8KqA3AkfUuCBi4D76j8 + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_b49fzgD4KpifFwcjHRHGUZ method: DELETE response: proto: HTTP/2.0 @@ -249,4 +284,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 379.054791ms + duration: 399.275208ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml b/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml index 127a7964..103d7749 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Delete.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 394 uncompressed: false - body: '{"id":"ssp_xi7cRjfZUKe3ZDJRGfbQnP","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:43.087Z","updated_at":"2024-11-03T11:22:43.087Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_kRVNooW1CXsSWPmQ3nt47z","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:44.615Z","updated_at":"2024-11-06T19:41:44.615Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 1.390025625s + duration: 2.742884s - id: 1 request: proto: HTTP/1.1 @@ -55,7 +55,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_xi7cRjfZUKe3ZDJRGfbQnP + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_kRVNooW1CXsSWPmQ3nt47z method: DELETE response: proto: HTTP/2.0 @@ -71,7 +71,7 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 1.355147s + duration: 3.272491084s - id: 2 request: proto: HTTP/1.1 @@ -90,7 +90,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_xi7cRjfZUKe3ZDJRGfbQnP + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_kRVNooW1CXsSWPmQ3nt47z method: GET response: proto: HTTP/2.0 @@ -100,13 +100,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"statusCode":404,"error":"Not Found","message":"Profile with ID: ssp_xi7cRjfZUKe3ZDJRGfbQnP not found"}' + body: '{"statusCode":404,"error":"Not Found","message":"Profile with ID: ssp_kRVNooW1CXsSWPmQ3nt47z not found"}' headers: Content-Type: - application/json; charset=utf-8 status: 404 Not Found code: 404 - duration: 819.694833ms + duration: 2.693900125s - id: 3 request: proto: HTTP/1.1 @@ -125,7 +125,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_xi7cRjfZUKe3ZDJRGfbQnP + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_kRVNooW1CXsSWPmQ3nt47z method: DELETE response: proto: HTTP/2.0 @@ -141,4 +141,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 440.794959ms + duration: 393.546083ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_List.yaml b/test/data/recordings/TestSelfServiceProfileManager_List.yaml index 3baf0799..3ce27658 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_List.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_List.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 394 uncompressed: false - body: '{"id":"ssp_phtUR1GUidfLrYkboHXwEz","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:36.392Z","updated_at":"2024-11-03T11:22:36.392Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_2bVfcfqT4rsWXcCA2mbeM6","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:32.604Z","updated_at":"2024-11-06T19:41:32.604Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 400.065125ms + duration: 464.711417ms - id: 1 request: proto: HTTP/1.1 @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"self_service_profiles":[{"id":"ssp_iWfKxu6gD5yrdn5fFCJmPy","name":"Default","user_attributes":[{"name":"temporary-name","description":"temporary-description","is_optional":false},{"name":"Email","description":"Email of the user","is_optional":false}],"allowed_strategies":["oidc","samlp","waad","google-apps","adfs","okta"],"created_at":"2024-08-26T08:05:28.700Z","updated_at":"2024-09-05T10:24:25.448Z","branding":{"logo_url":"https://example1.com","colors":{"primary":"#000000"}}},{"id":"ssp_25cy2NK6URnoYznQjdKBhJ","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T21:47:20.662Z","updated_at":"2024-11-02T21:47:20.662Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_iRgrA1NCG6MssoSYTqaVkP","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:12:40.704Z","updated_at":"2024-11-02T22:12:40.704Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_qVGSXZKfPu52o3a9KPazoa","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:54:30.033Z","updated_at":"2024-11-02T22:54:30.033Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_92CJaWR1ANrhLaFcYkbtWM","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:56:32.638Z","updated_at":"2024-11-02T22:56:32.638Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_oUrXXpQpRUmGUgzN3yj9sS","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:59:49.720Z","updated_at":"2024-11-02T22:59:49.720Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_nPMRi5JbUj2Zwm3AQ61HGH","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T23:00:32.193Z","updated_at":"2024-11-02T23:00:32.193Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_2KaAu4XFJrspydjqdiHw5g","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T23:25:18.142Z","updated_at":"2024-11-02T23:25:18.142Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_f5xKkP6ADKPXYyM9UVAPk6","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:06:35.013Z","updated_at":"2024-11-03T11:06:35.013Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_phtUR1GUidfLrYkboHXwEz","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:36.392Z","updated_at":"2024-11-03T11:22:36.392Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}],"start":0,"limit":50,"total":10}' + body: '{"self_service_profiles":[{"id":"ssp_iWfKxu6gD5yrdn5fFCJmPy","name":"Default","user_attributes":[{"name":"temporary-name","description":"temporary-description","is_optional":false},{"name":"Email","description":"Email of the user","is_optional":false}],"allowed_strategies":["oidc","samlp","waad","google-apps","adfs","okta"],"created_at":"2024-08-26T08:05:28.700Z","updated_at":"2024-09-05T10:24:25.448Z","branding":{"logo_url":"https://example1.com","colors":{"primary":"#000000"}}},{"id":"ssp_25cy2NK6URnoYznQjdKBhJ","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T21:47:20.662Z","updated_at":"2024-11-02T21:47:20.662Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_iRgrA1NCG6MssoSYTqaVkP","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:12:40.704Z","updated_at":"2024-11-02T22:12:40.704Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_qVGSXZKfPu52o3a9KPazoa","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:54:30.033Z","updated_at":"2024-11-02T22:54:30.033Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_92CJaWR1ANrhLaFcYkbtWM","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:56:32.638Z","updated_at":"2024-11-02T22:56:32.638Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_oUrXXpQpRUmGUgzN3yj9sS","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T22:59:49.720Z","updated_at":"2024-11-02T22:59:49.720Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_nPMRi5JbUj2Zwm3AQ61HGH","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T23:00:32.193Z","updated_at":"2024-11-02T23:00:32.193Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_2KaAu4XFJrspydjqdiHw5g","name":"Test Self Service Profile","description":"Sample Description","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-02T23:25:18.142Z","updated_at":"2024-11-02T23:25:18.142Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_f5xKkP6ADKPXYyM9UVAPk6","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:06:35.013Z","updated_at":"2024-11-03T11:06:35.013Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}},{"id":"ssp_2bVfcfqT4rsWXcCA2mbeM6","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:32.604Z","updated_at":"2024-11-06T19:41:32.604Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}],"start":0,"limit":50,"total":10}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 385.9405ms + duration: 390.826291ms - id: 2 request: proto: HTTP/1.1 @@ -90,7 +90,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_phtUR1GUidfLrYkboHXwEz + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_2bVfcfqT4rsWXcCA2mbeM6 method: DELETE response: proto: HTTP/2.0 @@ -106,4 +106,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 375.619875ms + duration: 368.053166ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_Read.yaml b/test/data/recordings/TestSelfServiceProfileManager_Read.yaml index b6370daa..90d6339d 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Read.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Read.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 394 uncompressed: false - body: '{"id":"ssp_gWpVmhK4RAN2UGyhGYw6fa","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:37.535Z","updated_at":"2024-11-03T11:22:37.535Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_c3fLmJYCpM1ePJ4e1Aq5JR","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:33.783Z","updated_at":"2024-11-06T19:41:33.783Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 372.946417ms + duration: 359.438416ms - id: 1 request: proto: HTTP/1.1 @@ -55,7 +55,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_gWpVmhK4RAN2UGyhGYw6fa + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_c3fLmJYCpM1ePJ4e1Aq5JR method: GET response: proto: HTTP/2.0 @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"ssp_gWpVmhK4RAN2UGyhGYw6fa","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:37.535Z","updated_at":"2024-11-03T11:22:37.535Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_c3fLmJYCpM1ePJ4e1Aq5JR","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:33.783Z","updated_at":"2024-11-06T19:41:33.783Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 372.472959ms + duration: 405.539541ms - id: 2 request: proto: HTTP/1.1 @@ -90,7 +90,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_gWpVmhK4RAN2UGyhGYw6fa + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_c3fLmJYCpM1ePJ4e1Aq5JR method: DELETE response: proto: HTTP/2.0 @@ -106,4 +106,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 428.606917ms + duration: 553.023958ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml b/test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml index 47dba9e7..be536476 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_SetGetCustomText.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 394 uncompressed: false - body: '{"id":"ssp_ewp8V2UgURp3k4d3AEVtdD","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:46.060Z","updated_at":"2024-11-03T11:22:46.060Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_g8DfHGvRxQHrvYNPfA9PiE","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:51.341Z","updated_at":"2024-11-06T19:41:51.341Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 343.682541ms + duration: 349.985208ms - id: 1 request: proto: HTTP/1.1 @@ -56,7 +56,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ewp8V2UgURp3k4d3AEVtdD/custom-text/en/get-started + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_g8DfHGvRxQHrvYNPfA9PiE/custom-text/en/get-started method: PUT response: proto: HTTP/2.0 @@ -72,7 +72,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 361.896375ms + duration: 382.627667ms - id: 2 request: proto: HTTP/1.1 @@ -91,7 +91,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ewp8V2UgURp3k4d3AEVtdD/custom-text/en/get-started + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_g8DfHGvRxQHrvYNPfA9PiE/custom-text/en/get-started method: GET response: proto: HTTP/2.0 @@ -107,7 +107,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 362.033208ms + duration: 407.142708ms - id: 3 request: proto: HTTP/1.1 @@ -126,7 +126,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_ewp8V2UgURp3k4d3AEVtdD + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_g8DfHGvRxQHrvYNPfA9PiE method: DELETE response: proto: HTTP/2.0 @@ -142,4 +142,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 370.916292ms + duration: 628.272292ms diff --git a/test/data/recordings/TestSelfServiceProfileManager_Update.yaml b/test/data/recordings/TestSelfServiceProfileManager_Update.yaml index 77487baf..9e044eb8 100644 --- a/test/data/recordings/TestSelfServiceProfileManager_Update.yaml +++ b/test/data/recordings/TestSelfServiceProfileManager_Update.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 394 uncompressed: false - body: '{"id":"ssp_6ZpGku5zb9rtSK5yeuNHgH","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:39.024Z","updated_at":"2024-11-03T11:22:39.024Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_pXsK5yP6h2XmXwiAoXYvdi","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:35.806Z","updated_at":"2024-11-06T19:41:35.806Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 689.450959ms + duration: 1.063988375s - id: 1 request: proto: HTTP/1.1 @@ -56,7 +56,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_6ZpGku5zb9rtSK5yeuNHgH + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_pXsK5yP6h2XmXwiAoXYvdi method: PATCH response: proto: HTTP/2.0 @@ -66,13 +66,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"ssp_6ZpGku5zb9rtSK5yeuNHgH","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-new-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-03T11:22:39.024Z","updated_at":"2024-11-03T11:22:40.247Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' + body: '{"id":"ssp_pXsK5yP6h2XmXwiAoXYvdi","name":"Sample Self Service Profile","description":"Sample Desc","user_attributes":[{"name":"some-new-name-here","description":"some-description","is_optional":true}],"allowed_strategies":["oidc"],"created_at":"2024-11-06T19:41:35.806Z","updated_at":"2024-11-06T19:41:38.728Z","branding":{"logo_url":"https://example.com/logo.png","colors":{"primary":"#334455"}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 1.216916s + duration: 2.925993334s - id: 2 request: proto: HTTP/1.1 @@ -91,7 +91,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.11.2 - url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_6ZpGku5zb9rtSK5yeuNHgH + url: https://go-auth0-dev.eu.auth0.com/api/v2/self-service-profiles/ssp_pXsK5yP6h2XmXwiAoXYvdi method: DELETE response: proto: HTTP/2.0 @@ -107,4 +107,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 1.450706666s + duration: 3.13637775s From 2e422f2a9431d163ea6737bb1cf748a72bf140e0 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Mon, 11 Nov 2024 14:32:29 +0530 Subject: [PATCH 04/11] minor update --- management/self_service_profiles.go | 8 ++++---- management/self_service_profiles_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/management/self_service_profiles.go b/management/self_service_profiles.go index bb14eb31..17815e6f 100644 --- a/management/self_service_profiles.go +++ b/management/self_service_profiles.go @@ -83,10 +83,10 @@ type SelfServiceProfileTicketConnectionConfig struct { // created as a part of the SSO flow. DisplayName *string `json:"display_name,omitempty"` - IsDomainConnection *bool `json:"is_domain_connection,omitempty"` - ShowAsButton *bool `json:"show_as_button,omitempty"` - Metadata *map[string]interface{} `json:"metadata,omitempty"` - Options SelfServiceProfileTicketConnectionConfigOptions `json:"options,omitempty"` + IsDomainConnection *bool `json:"is_domain_connection,omitempty"` + ShowAsButton *bool `json:"show_as_button,omitempty"` + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Options *SelfServiceProfileTicketConnectionConfigOptions `json:"options,omitempty"` } // SelfServiceProfileTicketConnectionConfigOptions is the list of Options for SSO Ticket. diff --git a/management/self_service_profiles_test.go b/management/self_service_profiles_test.go index 4b7d2a8a..e5c595a1 100644 --- a/management/self_service_profiles_test.go +++ b/management/self_service_profiles_test.go @@ -125,7 +125,7 @@ func TestSelfServiceProfileManager_CreateAndRevokeTicket(t *testing.T) { "key1": "value1", "key2": "value2", }, - Options: SelfServiceProfileTicketConnectionConfigOptions{ + Options: &SelfServiceProfileTicketConnectionConfigOptions{ IconURL: auth0.String("https://metabox.com/my_icon.jpeg"), DomainAliases: []*string{auth0.String("okta.com")}, }, From 46578faea3fcab7f73aa41fe87482afc8e5e1f8b Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Mon, 11 Nov 2024 14:50:11 +0530 Subject: [PATCH 05/11] gen docs updated --- management/management.gen.go | 8 ++++++++ management/management.gen_test.go | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/management/management.gen.go b/management/management.gen.go index 845a97e2..cdf6e3f9 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -10156,6 +10156,14 @@ func (s *SelfServiceProfileTicketConnectionConfig) GetName() string { return *s.Name } +// GetOptions returns the Options field. +func (s *SelfServiceProfileTicketConnectionConfig) GetOptions() *SelfServiceProfileTicketConnectionConfigOptions { + if s == nil { + return nil + } + return s.Options +} + // GetShowAsButton returns the ShowAsButton field if it's non-nil, zero value otherwise. func (s *SelfServiceProfileTicketConnectionConfig) GetShowAsButton() bool { if s == nil || s.ShowAsButton == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index b6a0fb51..117fc4d8 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -12774,6 +12774,13 @@ func TestSelfServiceProfileTicketConnectionConfig_GetName(tt *testing.T) { s.GetName() } +func TestSelfServiceProfileTicketConnectionConfig_GetOptions(tt *testing.T) { + s := &SelfServiceProfileTicketConnectionConfig{} + s.GetOptions() + s = nil + s.GetOptions() +} + func TestSelfServiceProfileTicketConnectionConfig_GetShowAsButton(tt *testing.T) { var zeroValue bool s := &SelfServiceProfileTicketConnectionConfig{ShowAsButton: &zeroValue} From a0cf7a08f44db843ca71be45e088017f9aac4db4 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Mon, 11 Nov 2024 14:53:26 +0530 Subject: [PATCH 06/11] Updated var name to remove linting issue --- internal/client/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/client/client.go b/internal/client/client.go index e0d73ef2..2bef50a3 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -161,9 +161,9 @@ func backoffDelay() rehttp.DelayFn { return func(attempt rehttp.Attempt) time.Duration { wait := baseDelay * math.Pow(2, float64(attempt.Index)) - min := wait + 1 - max := wait + baseDelay - wait = PRNG.Float64()*(max-min) + min + minValue := wait + 1 + maxValue := wait + baseDelay + wait = PRNG.Float64()*(maxValue-minValue) + minValue wait = math.Min(wait, maxDelay) wait = math.Max(wait, minDelay) From 5387e0cfb42bbba3a3a5065a5e1df1ba8878b0ed Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Mon, 11 Nov 2024 15:05:33 +0530 Subject: [PATCH 07/11] minor data structure update --- management/self_service_profiles.go | 8 ++++---- management/self_service_profiles_test.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/management/self_service_profiles.go b/management/self_service_profiles.go index 17815e6f..31584e34 100644 --- a/management/self_service_profiles.go +++ b/management/self_service_profiles.go @@ -19,7 +19,7 @@ type SelfServiceProfile struct { // List of IdP strategies that will be shown to users during the Self-Service SSO flow. // Possible values: [oidc, samlp, waad, google-apps, adfs, okta, keycloak-samlp] - AllowedStrategies []*string `json:"allowed_strategies,omitempty"` + AllowedStrategies *[]string `json:"allowed_strategies,omitempty"` // List of attributes to be mapped that // will be shown to the user during the SS-SSO flow. @@ -61,7 +61,7 @@ type SelfServiceProfileTicket struct { // List of client_ids that the // connection will be enabled for. - EnabledClients []*string `json:"enabled_clients,omitempty"` + EnabledClients *[]string `json:"enabled_clients,omitempty"` // List of organizations that the // connection will be enabled for. @@ -92,7 +92,7 @@ type SelfServiceProfileTicketConnectionConfig struct { // SelfServiceProfileTicketConnectionConfigOptions is the list of Options for SSO Ticket. type SelfServiceProfileTicketConnectionConfigOptions struct { IconURL *string `json:"icon_url,omitempty"` - DomainAliases []*string `json:"domain_aliases,omitempty"` + DomainAliases *[]string `json:"domain_aliases,omitempty"` } // SelfServiceProfileTicketEnabledOrganizations is the list of Organizations associated with the SSO Ticket. @@ -108,7 +108,7 @@ func (ssp *SelfServiceProfile) MarshalJSON() ([]byte, error) { type SelfServiceProfileSubset struct { Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` - AllowedStrategies []*string `json:"allowed_strategies,omitempty"` + AllowedStrategies *[]string `json:"allowed_strategies,omitempty"` UserAttributes []*SelfServiceProfileUserAttributes `json:"user_attributes,omitempty"` Branding *Branding `json:"branding,omitempty"` } diff --git a/management/self_service_profiles_test.go b/management/self_service_profiles_test.go index e5c595a1..85869dfb 100644 --- a/management/self_service_profiles_test.go +++ b/management/self_service_profiles_test.go @@ -18,7 +18,7 @@ func TestSelfServiceProfileManager_Create(t *testing.T) { ssop := &SelfServiceProfile{ Name: auth0.String("Sample Self Service Profile"), Description: auth0.String("Sample Desc"), - AllowedStrategies: []*string{auth0.String("oidc")}, + AllowedStrategies: &[]string{"oidc"}, Branding: &Branding{ LogoURL: auth0.String("https://example.com/logo.png"), Colors: &BrandingColors{ @@ -127,10 +127,10 @@ func TestSelfServiceProfileManager_CreateAndRevokeTicket(t *testing.T) { }, Options: &SelfServiceProfileTicketConnectionConfigOptions{ IconURL: auth0.String("https://metabox.com/my_icon.jpeg"), - DomainAliases: []*string{auth0.String("okta.com")}, + DomainAliases: &[]string{"okta.com"}, }, }, - EnabledClients: []*string{auth0.String(client.GetClientID())}, + EnabledClients: &[]string{client.GetClientID()}, EnabledOrganizations: []*SelfServiceProfileTicketEnabledOrganizations{ { AssignMembershipOnLogin: auth0.Bool(true), @@ -185,7 +185,7 @@ func givenASelfServiceProfile(t *testing.T) *SelfServiceProfile { ssop := &SelfServiceProfile{ Name: auth0.String("Sample Self Service Profile"), Description: auth0.String("Sample Desc"), - AllowedStrategies: []*string{auth0.String("oidc")}, + AllowedStrategies: &[]string{"oidc"}, Branding: &Branding{ LogoURL: auth0.String("https://example.com/logo.png"), Colors: &BrandingColors{ From ddfd407304f51b1ff377689dab6e2fbaf960628a Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Thu, 14 Nov 2024 00:11:28 +0530 Subject: [PATCH 08/11] updated gen files --- management/management.gen.go | 24 +++++++++++++++++++++++ management/management.gen_test.go | 30 +++++++++++++++++++++++++++++ management/self_service_profiles.go | 2 +- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/management/management.gen.go b/management/management.gen.go index cdf6e3f9..ba3231ec 100644 --- a/management/management.gen.go +++ b/management/management.gen.go @@ -10037,6 +10037,14 @@ func (s *ScreenPartials) String() string { return Stringify(s) } +// GetAllowedStrategies returns the AllowedStrategies field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfile) GetAllowedStrategies() []string { + if s == nil || s.AllowedStrategies == nil { + return nil + } + return *s.AllowedStrategies +} + // GetBranding returns the Branding field. func (s *SelfServiceProfile) GetBranding() *Branding { if s == nil { @@ -10111,6 +10119,14 @@ func (s *SelfServiceProfileTicket) GetConnectionID() string { return *s.ConnectionID } +// GetEnabledClients returns the EnabledClients field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicket) GetEnabledClients() []string { + if s == nil || s.EnabledClients == nil { + return nil + } + return *s.EnabledClients +} + // GetTicket returns the Ticket field if it's non-nil, zero value otherwise. func (s *SelfServiceProfileTicket) GetTicket() string { if s == nil || s.Ticket == nil { @@ -10177,6 +10193,14 @@ func (s *SelfServiceProfileTicketConnectionConfig) String() string { return Stringify(s) } +// GetDomainAliases returns the DomainAliases field if it's non-nil, zero value otherwise. +func (s *SelfServiceProfileTicketConnectionConfigOptions) GetDomainAliases() []string { + if s == nil || s.DomainAliases == nil { + return nil + } + return *s.DomainAliases +} + // GetIconURL returns the IconURL field if it's non-nil, zero value otherwise. func (s *SelfServiceProfileTicketConnectionConfigOptions) GetIconURL() string { if s == nil || s.IconURL == nil { diff --git a/management/management.gen_test.go b/management/management.gen_test.go index 117fc4d8..94d79d2e 100644 --- a/management/management.gen_test.go +++ b/management/management.gen_test.go @@ -12626,6 +12626,16 @@ func TestScreenPartials_String(t *testing.T) { } } +func TestSelfServiceProfile_GetAllowedStrategies(tt *testing.T) { + var zeroValue []string + s := &SelfServiceProfile{AllowedStrategies: &zeroValue} + s.GetAllowedStrategies() + s = &SelfServiceProfile{} + s.GetAllowedStrategies() + s = nil + s.GetAllowedStrategies() +} + func TestSelfServiceProfile_GetBranding(tt *testing.T) { s := &SelfServiceProfile{} s.GetBranding() @@ -12716,6 +12726,16 @@ func TestSelfServiceProfileTicket_GetConnectionID(tt *testing.T) { s.GetConnectionID() } +func TestSelfServiceProfileTicket_GetEnabledClients(tt *testing.T) { + var zeroValue []string + s := &SelfServiceProfileTicket{EnabledClients: &zeroValue} + s.GetEnabledClients() + s = &SelfServiceProfileTicket{} + s.GetEnabledClients() + s = nil + s.GetEnabledClients() +} + func TestSelfServiceProfileTicket_GetTicket(tt *testing.T) { var zeroValue string s := &SelfServiceProfileTicket{Ticket: &zeroValue} @@ -12799,6 +12819,16 @@ func TestSelfServiceProfileTicketConnectionConfig_String(t *testing.T) { } } +func TestSelfServiceProfileTicketConnectionConfigOptions_GetDomainAliases(tt *testing.T) { + var zeroValue []string + s := &SelfServiceProfileTicketConnectionConfigOptions{DomainAliases: &zeroValue} + s.GetDomainAliases() + s = &SelfServiceProfileTicketConnectionConfigOptions{} + s.GetDomainAliases() + s = nil + s.GetDomainAliases() +} + func TestSelfServiceProfileTicketConnectionConfigOptions_GetIconURL(tt *testing.T) { var zeroValue string s := &SelfServiceProfileTicketConnectionConfigOptions{IconURL: &zeroValue} diff --git a/management/self_service_profiles.go b/management/self_service_profiles.go index 31584e34..5fe135d4 100644 --- a/management/self_service_profiles.go +++ b/management/self_service_profiles.go @@ -67,7 +67,7 @@ type SelfServiceProfileTicket struct { // connection will be enabled for. EnabledOrganizations []*SelfServiceProfileTicketEnabledOrganizations `json:"enabled_organizations,omitempty"` - TTLSec int `json:"ttl_sec"` + TTLSec int `json:"ttl_sec,omitempty"` // The ticket that is generated. Ticket *string `json:"ticket,omitempty"` From b9de027e54f695763d35d971d08f68ce83f5f4b7 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 15 Nov 2024 22:07:26 +0530 Subject: [PATCH 09/11] Addressed review comment to use String.Slice instead --- management/self_service_profiles_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/self_service_profiles_test.go b/management/self_service_profiles_test.go index 85869dfb..f084f151 100644 --- a/management/self_service_profiles_test.go +++ b/management/self_service_profiles_test.go @@ -144,7 +144,8 @@ func TestSelfServiceProfileManager_CreateAndRevokeTicket(t *testing.T) { assert.NotEmpty(t, ticket.GetTicket()) ticketURL := ticket.GetTicket() - ticketID := ticketURL[strings.LastIndex(ticketURL, "=")+1:] + ticketURLSliced := strings.Split(ticketURL, "=") + ticketID := ticketURLSliced[len(ticketURLSliced)-1] err = api.SelfServiceProfile.RevokeTicket(context.Background(), ssop.GetID(), ticketID) assert.NoError(t, err) From f86749c241a77dc817e94b8000c36f406e304e12 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 15 Nov 2024 22:30:20 +0530 Subject: [PATCH 10/11] further change --- management/self_service_profiles_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/management/self_service_profiles_test.go b/management/self_service_profiles_test.go index f084f151..635f4293 100644 --- a/management/self_service_profiles_test.go +++ b/management/self_service_profiles_test.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "net/http" - "strings" + "net/url" "testing" "time" @@ -144,11 +144,13 @@ func TestSelfServiceProfileManager_CreateAndRevokeTicket(t *testing.T) { assert.NotEmpty(t, ticket.GetTicket()) ticketURL := ticket.GetTicket() - ticketURLSliced := strings.Split(ticketURL, "=") - ticketID := ticketURLSliced[len(ticketURLSliced)-1] - - err = api.SelfServiceProfile.RevokeTicket(context.Background(), ssop.GetID(), ticketID) + ticketIDMap, err := url.ParseQuery(ticketURL) + if err != nil { + ticketID := ticketIDMap["ticketId"][0] + err = api.SelfServiceProfile.RevokeTicket(context.Background(), ssop.GetID(), ticketID) + } assert.NoError(t, err) + } func TestSelfServiceProfileManager_MarshalJSON(t *testing.T) { From 8fd2a073146ccd6e46a46b304e79ab132e84dc89 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 15 Nov 2024 22:56:22 +0530 Subject: [PATCH 11/11] make lint --- management/self_service_profiles_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/management/self_service_profiles_test.go b/management/self_service_profiles_test.go index 635f4293..b7e4a63c 100644 --- a/management/self_service_profiles_test.go +++ b/management/self_service_profiles_test.go @@ -150,7 +150,6 @@ func TestSelfServiceProfileManager_CreateAndRevokeTicket(t *testing.T) { err = api.SelfServiceProfile.RevokeTicket(context.Background(), ssop.GetID(), ticketID) } assert.NoError(t, err) - } func TestSelfServiceProfileManager_MarshalJSON(t *testing.T) {