From 1baee73b12df0aa4e9953c2871e0deef7ab1459b Mon Sep 17 00:00:00 2001 From: nialdaly Date: Fri, 27 Jan 2023 12:21:40 +0000 Subject: [PATCH 01/10] inital logic for breached_password_detection stage support --- docs/resources/attack_protection.md | 22 ++++++ .../auth0_attack_protection/resource.tf | 6 ++ .../resource_auth0_attack_protection.go | 74 +++++++++++++++++++ .../resource_auth0_attack_protection_test.go | 6 ++ 4 files changed, 108 insertions(+) diff --git a/docs/resources/attack_protection.md b/docs/resources/attack_protection.md index 57ccecced..7fdaf5204 100644 --- a/docs/resources/attack_protection.md +++ b/docs/resources/attack_protection.md @@ -41,6 +41,11 @@ resource "auth0_attack_protection" "my_protection" { enabled = true method = "standard" shields = ["admin_notification", "block"] + stage { + pre_user_registration { + shields = ["block"] + } + } } } ``` @@ -67,6 +72,23 @@ Optional: - `enabled` (Boolean) Whether breached password detection is active. - `method` (String) The subscription level for breached password detection methods. Use "enhanced" to enable Credential Guard. Possible values: `standard`, `enhanced`. - `shields` (Set of String) Action to take when a breached password is detected. +- `stage` (Block List) (see [below for nested schema](#nestedblock--breached_password_detection--stage)) + + +### Nested Schema for `breached_password_detection.stage` + +Read-Only: + +- `pre_user_registration` (List of Object) (see [below for nested schema](#nestedatt--breached_password_detection--stage--pre_user_registration)) + + +### Nested Schema for `breached_password_detection.stage.pre_user_registration` + +Read-Only: + +- `shields` (Set of String) Action to take when a breached password is detected during a signup. Possible values: `block`, `admin_notification`. + + diff --git a/examples/resources/auth0_attack_protection/resource.tf b/examples/resources/auth0_attack_protection/resource.tf index 888f849a1..9d1e5a446 100644 --- a/examples/resources/auth0_attack_protection/resource.tf +++ b/examples/resources/auth0_attack_protection/resource.tf @@ -28,5 +28,11 @@ resource "auth0_attack_protection" "my_protection" { enabled = true method = "standard" shields = ["admin_notification", "block"] + + stage { + pre_user_registration = { + shields = ["block"] + } + } } } diff --git a/internal/provider/resource_auth0_attack_protection.go b/internal/provider/resource_auth0_attack_protection.go index 4a7de599a..bdd0e8cd3 100644 --- a/internal/provider/resource_auth0_attack_protection.go +++ b/internal/provider/resource_auth0_attack_protection.go @@ -82,6 +82,36 @@ func newAttackProtection() *schema.Resource { Description: "The subscription level for breached password detection methods. " + "Use \"enhanced\" to enable Credential Guard. Possible values: `standard`, `enhanced`.", }, + "stage": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "pre_user_registration": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "shields": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "block", + "admin_notification", + }, false), + }, + Description: "Action to take when a breached password is detected during a signup.", + }, + }, + }, + }, + }, + }, + }, }, }, }, @@ -371,6 +401,21 @@ func flattenBreachedPasswordProtection(bpd *management.BreachedPasswordDetection "method": bpd.GetMethod(), "admin_notification_frequency": bpd.GetAdminNotificationFrequency(), "shields": bpd.GetShields(), + "stage": flattenBreachedPasswordProtectionStage(bpd.GetStage()), + }, + } +} + +func flattenBreachedPasswordProtectionStage(breachedPasswordDetectionStage *management.BreachedPasswordDetectionStage) []interface{} { + if breachedPasswordDetectionStage == nil { + return nil + } + + return []interface{}{ + map[string]interface{}{ + "pre-user-registration": map[string]interface{}{ + "shields": breachedPasswordDetectionStage.GetPreUserRegistration().GetShields(), + }, }, } } @@ -488,6 +533,7 @@ func expandBreachedPasswordDetection(d *schema.ResourceData) *management.Breache Method: value.String(breach.GetAttr("method")), Shields: value.Strings(breach.GetAttr("shields")), AdminNotificationFrequency: value.Strings(breach.GetAttr("admin_notification_frequency")), + Stage: expandBreachedPasswordDetectionStage(breach.GetAttr("stage")), } return stop @@ -496,3 +542,31 @@ func expandBreachedPasswordDetection(d *schema.ResourceData) *management.Breache return bpd } + +func expandBreachedPasswordDetectionStage(stageMap cty.Value) *management.BreachedPasswordDetectionStage { + var breachedPasswordDetectionStage *management.BreachedPasswordDetectionStage + + stageMap.ForEachElement(func(_ cty.Value, stage cty.Value) (stop bool) { + breachedPasswordDetectionStage = &management.BreachedPasswordDetectionStage{ + PreUserRegistration: expandBreachedPasswordDetectionPreUserRegistration(stage.GetAttr("pre-user-registration")), + } + + return stop + }) + + return breachedPasswordDetectionStage +} + +func expandBreachedPasswordDetectionPreUserRegistration(preUserRegistrationMap cty.Value) *management.BreachedPasswordDetectionPreUserRegistration { + var breachedPasswordDetectionStagePreUserRegistration *management.BreachedPasswordDetectionPreUserRegistration + + preUserRegistrationMap.ForEachElement(func(_ cty.Value, preUserRegistration cty.Value) (stop bool) { + breachedPasswordDetectionStagePreUserRegistration = &management.BreachedPasswordDetectionPreUserRegistration{ + Shields: value.Strings(preUserRegistration.GetAttr("shields")), + } + + return stop + }) + + return breachedPasswordDetectionStagePreUserRegistration +} diff --git a/internal/provider/resource_auth0_attack_protection_test.go b/internal/provider/resource_auth0_attack_protection_test.go index e05f4333b..e42691448 100644 --- a/internal/provider/resource_auth0_attack_protection_test.go +++ b/internal/provider/resource_auth0_attack_protection_test.go @@ -34,6 +34,11 @@ resource "auth0_attack_protection" "my_protection" { shields = ["user_notification", "block", "admin_notification"] admin_notification_frequency = ["daily", "monthly", "immediately", "weekly"] method = "standard" + stage = { + pre_user_registration = { + shields = ["block"] + } + } } } ` @@ -93,6 +98,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "immediately"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "weekly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.stage.0.pre_user_registration.0.shields.*", "block"), ), }, { From b733e7a89a69e94470e82395fb711627ad19da8c Mon Sep 17 00:00:00 2001 From: nialdaly Date: Fri, 27 Jan 2023 12:35:25 +0000 Subject: [PATCH 02/10] make docs ran --- docs/resources/attack_protection.md | 8 ++++++-- internal/provider/resource_auth0_attack_protection.go | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/resources/attack_protection.md b/docs/resources/attack_protection.md index 7fdaf5204..a46509162 100644 --- a/docs/resources/attack_protection.md +++ b/docs/resources/attack_protection.md @@ -41,8 +41,9 @@ resource "auth0_attack_protection" "my_protection" { enabled = true method = "standard" shields = ["admin_notification", "block"] + stage { - pre_user_registration { + pre_user_registration = { shields = ["block"] } } @@ -72,6 +73,9 @@ Optional: - `enabled` (Boolean) Whether breached password detection is active. - `method` (String) The subscription level for breached password detection methods. Use "enhanced" to enable Credential Guard. Possible values: `standard`, `enhanced`. - `shields` (Set of String) Action to take when a breached password is detected. + +Read-Only: + - `stage` (Block List) (see [below for nested schema](#nestedblock--breached_password_detection--stage)) @@ -86,7 +90,7 @@ Read-Only: Read-Only: -- `shields` (Set of String) Action to take when a breached password is detected during a signup. Possible values: `block`, `admin_notification`. +- `shields` (Set of String) diff --git a/internal/provider/resource_auth0_attack_protection.go b/internal/provider/resource_auth0_attack_protection.go index bdd0e8cd3..a5fc43a54 100644 --- a/internal/provider/resource_auth0_attack_protection.go +++ b/internal/provider/resource_auth0_attack_protection.go @@ -413,7 +413,7 @@ func flattenBreachedPasswordProtectionStage(breachedPasswordDetectionStage *mana return []interface{}{ map[string]interface{}{ - "pre-user-registration": map[string]interface{}{ + "pre_user_registration": map[string]interface{}{ "shields": breachedPasswordDetectionStage.GetPreUserRegistration().GetShields(), }, }, @@ -548,7 +548,7 @@ func expandBreachedPasswordDetectionStage(stageMap cty.Value) *management.Breach stageMap.ForEachElement(func(_ cty.Value, stage cty.Value) (stop bool) { breachedPasswordDetectionStage = &management.BreachedPasswordDetectionStage{ - PreUserRegistration: expandBreachedPasswordDetectionPreUserRegistration(stage.GetAttr("pre-user-registration")), + PreUserRegistration: expandBreachedPasswordDetectionPreUserRegistration(stage.GetAttr("pre_user_registration")), } return stop From 66f3867d28fa4da5872d637f4378115594e1a85b Mon Sep 17 00:00:00 2001 From: nialdaly Date: Fri, 27 Jan 2023 13:13:07 +0000 Subject: [PATCH 03/10] test recordings updated --- .../resource_auth0_attack_protection_test.go | 10 +++++-- ...ckProtectionBreachedPasswordDetection.yaml | 28 +++++++++---------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/internal/provider/resource_auth0_attack_protection_test.go b/internal/provider/resource_auth0_attack_protection_test.go index e42691448..a5615aa9d 100644 --- a/internal/provider/resource_auth0_attack_protection_test.go +++ b/internal/provider/resource_auth0_attack_protection_test.go @@ -23,6 +23,11 @@ resource "auth0_attack_protection" "my_protection" { shields = ["admin_notification","block"] admin_notification_frequency = ["daily", "monthly"] method = "standard" + stage = { + pre_user_registration = { + shields = ["block"] + } + } } } ` @@ -36,7 +41,7 @@ resource "auth0_attack_protection" "my_protection" { method = "standard" stage = { pre_user_registration = { - shields = ["block"] + shields = ["block", "admin_notification"] } } } @@ -98,7 +103,8 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "immediately"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "weekly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.stage.0.pre_user_registration.0.shields.*", "block"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.stage.pre_user_registration.0.shields.*", "block"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.stage.pre_user_registration.0.shields.*", "admin_notification"), ), }, { diff --git a/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml b/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml index 2e01ddf77..87a6d48fa 100644 --- a/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml +++ b/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml @@ -30,7 +30,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -66,7 +66,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -174,7 +174,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -282,7 +282,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -373,7 +373,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["daily","monthly"],"method":"standard"} + {"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["daily","monthly"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}} form: { } headers: Content-Type: @@ -390,7 +390,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","admin_notification"],"admin_notification_frequency":["daily","monthly"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["block","admin_notification"],"admin_notification_frequency":["daily","monthly"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -426,7 +426,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -534,7 +534,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -642,7 +642,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -733,7 +733,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard"} + {"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}} form: { } headers: Content-Type: @@ -750,7 +750,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -786,7 +786,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -894,7 +894,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -1002,7 +1002,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' headers: Content-Type: - application/json; charset=utf-8 From 80b1733a112ccbd9226e82afbb58472617a37490 Mon Sep 17 00:00:00 2001 From: nialdaly Date: Fri, 27 Jan 2023 14:36:05 +0000 Subject: [PATCH 04/10] pre_user_registration logic updated --- docs/resources/attack_protection.md | 27 ++--- .../auth0_attack_protection/resource.tf | 6 +- .../resource_auth0_attack_protection.go | 102 +++++++----------- .../resource_auth0_attack_protection_test.go | 27 +++-- 4 files changed, 61 insertions(+), 101 deletions(-) diff --git a/docs/resources/attack_protection.md b/docs/resources/attack_protection.md index a46509162..c76899113 100644 --- a/docs/resources/attack_protection.md +++ b/docs/resources/attack_protection.md @@ -42,10 +42,8 @@ resource "auth0_attack_protection" "my_protection" { method = "standard" shields = ["admin_notification", "block"] - stage { - pre_user_registration = { - shields = ["block"] - } + pre_user_registration = { + shields = ["block"] } } } @@ -72,26 +70,15 @@ Optional: - `admin_notification_frequency` (Set of String) When "admin_notification" is enabled, determines how often email notifications are sent. Possible values: `immediately`, `daily`, `weekly`, `monthly`. - `enabled` (Boolean) Whether breached password detection is active. - `method` (String) The subscription level for breached password detection methods. Use "enhanced" to enable Credential Guard. Possible values: `standard`, `enhanced`. +- `pre_user_registration` (Block List, Max: 1) Configuration options that apply before every user registration attempt. Only available on public tenants. (see [below for nested schema](#nestedblock--breached_password_detection--pre_user_registration)) - `shields` (Set of String) Action to take when a breached password is detected. -Read-Only: + +### Nested Schema for `breached_password_detection.pre_user_registration` -- `stage` (Block List) (see [below for nested schema](#nestedblock--breached_password_detection--stage)) - - -### Nested Schema for `breached_password_detection.stage` - -Read-Only: - -- `pre_user_registration` (List of Object) (see [below for nested schema](#nestedatt--breached_password_detection--stage--pre_user_registration)) - - -### Nested Schema for `breached_password_detection.stage.pre_user_registration` - -Read-Only: - -- `shields` (Set of String) +Optional: +- `shields` (Set of String) Action to take when a breached password is detected during a signup. diff --git a/examples/resources/auth0_attack_protection/resource.tf b/examples/resources/auth0_attack_protection/resource.tf index 9d1e5a446..32e1b1df1 100644 --- a/examples/resources/auth0_attack_protection/resource.tf +++ b/examples/resources/auth0_attack_protection/resource.tf @@ -29,10 +29,8 @@ resource "auth0_attack_protection" "my_protection" { method = "standard" shields = ["admin_notification", "block"] - stage { - pre_user_registration = { - shields = ["block"] - } + pre_user_registration = { + shields = ["block"] } } } diff --git a/internal/provider/resource_auth0_attack_protection.go b/internal/provider/resource_auth0_attack_protection.go index a5fc43a54..e99eaa70a 100644 --- a/internal/provider/resource_auth0_attack_protection.go +++ b/internal/provider/resource_auth0_attack_protection.go @@ -82,32 +82,27 @@ func newAttackProtection() *schema.Resource { Description: "The subscription level for breached password detection methods. " + "Use \"enhanced\" to enable Credential Guard. Possible values: `standard`, `enhanced`.", }, - "stage": { + "pre_user_registration": { Type: schema.TypeList, Optional: true, Computed: true, + MaxItems: 1, + Description: "Configuration options that apply before every user registration attempt. " + + "Only available on public tenants.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "pre_user_registration": { - Type: schema.TypeList, + "shields": { + Type: schema.TypeSet, + Optional: true, Computed: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "shields": { - Type: schema.TypeSet, - Optional: true, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - "block", - "admin_notification", - }, false), - }, - Description: "Action to take when a breached password is detected during a signup.", - }, - }, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "block", + "admin_notification", + }, false), }, + Description: "Action to take when a breached password is detected during a signup.", }, }, }, @@ -400,21 +395,10 @@ func flattenBreachedPasswordProtection(bpd *management.BreachedPasswordDetection "enabled": bpd.GetEnabled(), "method": bpd.GetMethod(), "admin_notification_frequency": bpd.GetAdminNotificationFrequency(), - "shields": bpd.GetShields(), - "stage": flattenBreachedPasswordProtectionStage(bpd.GetStage()), - }, - } -} - -func flattenBreachedPasswordProtectionStage(breachedPasswordDetectionStage *management.BreachedPasswordDetectionStage) []interface{} { - if breachedPasswordDetectionStage == nil { - return nil - } - - return []interface{}{ - map[string]interface{}{ - "pre_user_registration": map[string]interface{}{ - "shields": breachedPasswordDetectionStage.GetPreUserRegistration().GetShields(), + "pre_user_registration": []interface{}{ + map[string][]string{ + "shields": bpd.GetStage().GetPreUserRegistration().GetShields(), + }, }, }, } @@ -533,7 +517,27 @@ func expandBreachedPasswordDetection(d *schema.ResourceData) *management.Breache Method: value.String(breach.GetAttr("method")), Shields: value.Strings(breach.GetAttr("shields")), AdminNotificationFrequency: value.Strings(breach.GetAttr("admin_notification_frequency")), - Stage: expandBreachedPasswordDetectionStage(breach.GetAttr("stage")), + } + + pur := breach.GetAttr("pre_user_registration") + if !pur.IsNull() { + pur.ForEachElement( + func(_ cty.Value, preUserReg cty.Value) (stop bool) { + preUserRegistration := &management.BreachedPasswordDetectionPreUserRegistration{ + Shields: value.Strings(preUserReg.GetAttr("shields")), + } + + if bpd.Stage != nil { + bpd.Stage.PreUserRegistration = preUserRegistration + } else { + bpd.Stage = &management.BreachedPasswordDetectionStage{ + PreUserRegistration: preUserRegistration, + } + } + + return stop + }, + ) } return stop @@ -542,31 +546,3 @@ func expandBreachedPasswordDetection(d *schema.ResourceData) *management.Breache return bpd } - -func expandBreachedPasswordDetectionStage(stageMap cty.Value) *management.BreachedPasswordDetectionStage { - var breachedPasswordDetectionStage *management.BreachedPasswordDetectionStage - - stageMap.ForEachElement(func(_ cty.Value, stage cty.Value) (stop bool) { - breachedPasswordDetectionStage = &management.BreachedPasswordDetectionStage{ - PreUserRegistration: expandBreachedPasswordDetectionPreUserRegistration(stage.GetAttr("pre_user_registration")), - } - - return stop - }) - - return breachedPasswordDetectionStage -} - -func expandBreachedPasswordDetectionPreUserRegistration(preUserRegistrationMap cty.Value) *management.BreachedPasswordDetectionPreUserRegistration { - var breachedPasswordDetectionStagePreUserRegistration *management.BreachedPasswordDetectionPreUserRegistration - - preUserRegistrationMap.ForEachElement(func(_ cty.Value, preUserRegistration cty.Value) (stop bool) { - breachedPasswordDetectionStagePreUserRegistration = &management.BreachedPasswordDetectionPreUserRegistration{ - Shields: value.Strings(preUserRegistration.GetAttr("shields")), - } - - return stop - }) - - return breachedPasswordDetectionStagePreUserRegistration -} diff --git a/internal/provider/resource_auth0_attack_protection_test.go b/internal/provider/resource_auth0_attack_protection_test.go index a5615aa9d..c5f91ea62 100644 --- a/internal/provider/resource_auth0_attack_protection_test.go +++ b/internal/provider/resource_auth0_attack_protection_test.go @@ -23,10 +23,9 @@ resource "auth0_attack_protection" "my_protection" { shields = ["admin_notification","block"] admin_notification_frequency = ["daily", "monthly"] method = "standard" - stage = { - pre_user_registration = { - shields = ["block"] - } + + pre_user_registration { + shields = ["block"] } } } @@ -39,10 +38,9 @@ resource "auth0_attack_protection" "my_protection" { shields = ["user_notification", "block", "admin_notification"] admin_notification_frequency = ["daily", "monthly", "immediately", "weekly"] method = "standard" - stage = { - pre_user_registration = { - shields = ["block", "admin_notification"] - } + + pre_user_registration { + shields = ["block", "admin_notification"] } } } @@ -68,7 +66,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "brute_force_protection.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "suspicious_ip_throttling.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.#", "1"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "4"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "5"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.enabled", "true"), ), }, @@ -78,13 +76,14 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "brute_force_protection.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "suspicious_ip_throttling.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.#", "1"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "4"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "5"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.enabled", "true"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.shields.*", "admin_notification"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.shields.*", "block"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "daily"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "monthly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "block"), ), }, { @@ -93,7 +92,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "brute_force_protection.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "suspicious_ip_throttling.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.#", "1"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "4"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "5"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.enabled", "true"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.shields.*", "admin_notification"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.shields.*", "block"), @@ -103,8 +102,8 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "immediately"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "weekly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.stage.pre_user_registration.0.shields.*", "block"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.stage.pre_user_registration.0.shields.*", "admin_notification"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "block"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "admin_notification"), ), }, { @@ -113,7 +112,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "brute_force_protection.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "suspicious_ip_throttling.#", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.#", "1"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "4"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.%", "5"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.enabled", "false"), ), }, From d6c99381ca1f84d29343c09e91ecb2e67d9dbc90 Mon Sep 17 00:00:00 2001 From: nialdaly Date: Fri, 27 Jan 2023 15:43:56 +0000 Subject: [PATCH 05/10] additional test changes made --- docs/resources/attack_protection.md | 2 +- .../auth0_attack_protection/resource.tf | 2 +- .../resource_auth0_attack_protection_test.go | 3 ++- ...ckProtectionBreachedPasswordDetection.yaml | 26 +++++++++---------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/docs/resources/attack_protection.md b/docs/resources/attack_protection.md index c76899113..efc27dc29 100644 --- a/docs/resources/attack_protection.md +++ b/docs/resources/attack_protection.md @@ -42,7 +42,7 @@ resource "auth0_attack_protection" "my_protection" { method = "standard" shields = ["admin_notification", "block"] - pre_user_registration = { + pre_user_registration { shields = ["block"] } } diff --git a/examples/resources/auth0_attack_protection/resource.tf b/examples/resources/auth0_attack_protection/resource.tf index 32e1b1df1..9d0fb5e21 100644 --- a/examples/resources/auth0_attack_protection/resource.tf +++ b/examples/resources/auth0_attack_protection/resource.tf @@ -29,7 +29,7 @@ resource "auth0_attack_protection" "my_protection" { method = "standard" shields = ["admin_notification", "block"] - pre_user_registration = { + pre_user_registration { shields = ["block"] } } diff --git a/internal/provider/resource_auth0_attack_protection_test.go b/internal/provider/resource_auth0_attack_protection_test.go index c5f91ea62..3ff473e63 100644 --- a/internal/provider/resource_auth0_attack_protection_test.go +++ b/internal/provider/resource_auth0_attack_protection_test.go @@ -40,7 +40,7 @@ resource "auth0_attack_protection" "my_protection" { method = "standard" pre_user_registration { - shields = ["block", "admin_notification"] + shields = ["admin_notification"] } } } @@ -83,6 +83,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "daily"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "monthly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), + resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.%", "1"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "block"), ), }, diff --git a/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml b/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml index 87a6d48fa..324a5cf42 100644 --- a/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml +++ b/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml @@ -30,7 +30,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -66,7 +66,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -174,7 +174,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -282,7 +282,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -733,7 +733,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}} + {"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}} form: { } headers: Content-Type: @@ -750,7 +750,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -786,7 +786,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -894,7 +894,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -1002,7 +1002,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification", "block"]}}}' + body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -1110,7 +1110,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -1146,7 +1146,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -1254,7 +1254,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 @@ -1362,7 +1362,7 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 From c3c3cc931a186b5f819d686c78d928e8b680e625 Mon Sep 17 00:00:00 2001 From: nialdaly Date: Fri, 27 Jan 2023 16:32:57 +0000 Subject: [PATCH 06/10] test types updated --- internal/provider/resource_auth0_attack_protection_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/provider/resource_auth0_attack_protection_test.go b/internal/provider/resource_auth0_attack_protection_test.go index 3ff473e63..6516f535a 100644 --- a/internal/provider/resource_auth0_attack_protection_test.go +++ b/internal/provider/resource_auth0_attack_protection_test.go @@ -83,8 +83,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "daily"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "monthly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.%", "1"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "block"), + resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "block"), ), }, { @@ -103,8 +102,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "immediately"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "weekly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "block"), - resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "admin_notification"), + resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "admin_notification"), ), }, { From 71ebbec9d2a070751095fdfcfa7ae7a80ea5637b Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Fri, 27 Jan 2023 18:19:41 +0100 Subject: [PATCH 07/10] Update docs --- docs/resources/attack_protection.md | 2 +- internal/provider/resource_auth0_attack_protection.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/resources/attack_protection.md b/docs/resources/attack_protection.md index efc27dc29..28d13b9ad 100644 --- a/docs/resources/attack_protection.md +++ b/docs/resources/attack_protection.md @@ -78,7 +78,7 @@ Optional: Optional: -- `shields` (Set of String) Action to take when a breached password is detected during a signup. +- `shields` (Set of String) Action to take when a breached password is detected during a signup. Possible values: `block`, `admin_notification`. diff --git a/internal/provider/resource_auth0_attack_protection.go b/internal/provider/resource_auth0_attack_protection.go index e99eaa70a..5a11d6ec1 100644 --- a/internal/provider/resource_auth0_attack_protection.go +++ b/internal/provider/resource_auth0_attack_protection.go @@ -102,7 +102,8 @@ func newAttackProtection() *schema.Resource { "admin_notification", }, false), }, - Description: "Action to take when a breached password is detected during a signup.", + Description: "Action to take when a breached password is detected during " + + "a signup. Possible values: `block`, `admin_notification`.", }, }, }, From caadd228058fb8abb971de188d71539b5d3f3d75 Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Fri, 27 Jan 2023 18:19:58 +0100 Subject: [PATCH 08/10] Bring back the flattening of the shields for bpd --- internal/provider/resource_auth0_attack_protection.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/provider/resource_auth0_attack_protection.go b/internal/provider/resource_auth0_attack_protection.go index 5a11d6ec1..6d0ced741 100644 --- a/internal/provider/resource_auth0_attack_protection.go +++ b/internal/provider/resource_auth0_attack_protection.go @@ -396,6 +396,7 @@ func flattenBreachedPasswordProtection(bpd *management.BreachedPasswordDetection "enabled": bpd.GetEnabled(), "method": bpd.GetMethod(), "admin_notification_frequency": bpd.GetAdminNotificationFrequency(), + "shields": bpd.GetShields(), "pre_user_registration": []interface{}{ map[string][]string{ "shields": bpd.GetStage().GetPreUserRegistration().GetShields(), From bc8e409ccdf10e1c0d56189d1d0f394c592908d4 Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Fri, 27 Jan 2023 18:20:10 +0100 Subject: [PATCH 09/10] Expand bpd test --- internal/provider/resource_auth0_attack_protection_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/provider/resource_auth0_attack_protection_test.go b/internal/provider/resource_auth0_attack_protection_test.go index 6516f535a..4d00737cf 100644 --- a/internal/provider/resource_auth0_attack_protection_test.go +++ b/internal/provider/resource_auth0_attack_protection_test.go @@ -40,7 +40,7 @@ resource "auth0_attack_protection" "my_protection" { method = "standard" pre_user_registration { - shields = ["admin_notification"] + shields = ["block", "admin_notification"] } } } @@ -102,6 +102,7 @@ func TestAccAttackProtectionBreachedPasswordDetection(t *testing.T) { resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "immediately"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.admin_notification_frequency.*", "weekly"), resource.TestCheckResourceAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.method", "standard"), + resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "block"), resource.TestCheckTypeSetElemAttr("auth0_attack_protection.my_protection", "breached_password_detection.0.pre_user_registration.0.shields.*", "admin_notification"), ), }, From 9cc88bc4bbbe3a6edce4807225ef6f10dd49fc5b Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Fri, 27 Jan 2023 18:20:36 +0100 Subject: [PATCH 10/10] Update test recording --- ...ckProtectionBreachedPasswordDetection.yaml | 196 +++++++++--------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml b/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml index 324a5cf42..03218fa52 100644 --- a/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml +++ b/test/data/recordings/TestAccAttackProtectionBreachedPasswordDetection.yaml @@ -19,7 +19,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: PATCH response: @@ -30,13 +30,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":[],"admin_notification_frequency":[],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 178.221591ms + duration: 260.142041ms - id: 1 request: proto: HTTP/1.1 @@ -55,7 +55,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -66,13 +66,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":[],"admin_notification_frequency":[],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 119.944902ms + duration: 178.518042ms - id: 2 request: proto: HTTP/1.1 @@ -91,7 +91,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -108,7 +108,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 158.522558ms + duration: 135.266083ms - id: 3 request: proto: HTTP/1.1 @@ -127,7 +127,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -144,7 +144,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 118.041389ms + duration: 112.434459ms - id: 4 request: proto: HTTP/1.1 @@ -163,7 +163,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -174,13 +174,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":[],"admin_notification_frequency":[],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 150.197369ms + duration: 168.22975ms - id: 5 request: proto: HTTP/1.1 @@ -199,7 +199,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -216,7 +216,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 139.589479ms + duration: 104.027125ms - id: 6 request: proto: HTTP/1.1 @@ -235,7 +235,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -252,7 +252,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 121.781715ms + duration: 138.240625ms - id: 7 request: proto: HTTP/1.1 @@ -271,7 +271,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -282,13 +282,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","weekly","monthly","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' + body: '{"enabled":true,"shields":[],"admin_notification_frequency":[],"method":"standard","stage":{"pre-user-registration":{"shields":[]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 227.196648ms + duration: 96.641708ms - id: 8 request: proto: HTTP/1.1 @@ -307,7 +307,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -324,7 +324,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 144.322635ms + duration: 130.971417ms - id: 9 request: proto: HTTP/1.1 @@ -343,7 +343,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -360,13 +360,13 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 110.367533ms + duration: 109.563834ms - id: 10 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 129 + content_length: 185 transfer_encoding: [ ] trailer: { } host: terraform-provider-auth0-dev.eu.auth0.com @@ -379,7 +379,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: PATCH response: @@ -396,7 +396,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 145.962697ms + duration: 102.406709ms - id: 11 request: proto: HTTP/1.1 @@ -415,7 +415,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -426,13 +426,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' + body: '{"enabled":true,"shields":["block","admin_notification"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 109.621751ms + duration: 117.834791ms - id: 12 request: proto: HTTP/1.1 @@ -451,7 +451,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -468,7 +468,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 117.882456ms + duration: 187.019458ms - id: 13 request: proto: HTTP/1.1 @@ -487,7 +487,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -504,7 +504,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 108.563805ms + duration: 97.379167ms - id: 14 request: proto: HTTP/1.1 @@ -523,7 +523,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -534,13 +534,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' + body: '{"enabled":true,"shields":["block","admin_notification"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 123.443193ms + duration: 100.966625ms - id: 15 request: proto: HTTP/1.1 @@ -559,7 +559,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -576,7 +576,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 123.745274ms + duration: 102.779333ms - id: 16 request: proto: HTTP/1.1 @@ -595,7 +595,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -612,7 +612,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 109.234175ms + duration: 102.929542ms - id: 17 request: proto: HTTP/1.1 @@ -631,7 +631,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -642,13 +642,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","block"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' + body: '{"enabled":true,"shields":["block","admin_notification"],"admin_notification_frequency":["monthly","daily"],"method":"standard","stage":{"pre-user-registration":{"shields":["block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 113.778061ms + duration: 117.011958ms - id: 18 request: proto: HTTP/1.1 @@ -667,7 +667,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -684,7 +684,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 105.805158ms + duration: 101.98875ms - id: 19 request: proto: HTTP/1.1 @@ -703,7 +703,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -720,26 +720,26 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 101.11354ms + duration: 172.68275ms - id: 20 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 172 + content_length: 249 transfer_encoding: [ ] trailer: { } host: terraform-provider-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}} + {"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}} form: { } headers: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: PATCH response: @@ -750,13 +750,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":true,"shields":["block","user_notification","admin_notification"],"admin_notification_frequency":["daily","immediately","monthly","weekly"],"method":"standard","stage":{"pre-user-registration":{"shields":["block","admin_notification"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 121.021785ms + duration: 291.22275ms - id: 21 request: proto: HTTP/1.1 @@ -775,7 +775,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -786,13 +786,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 205.632544ms + duration: 109.7085ms - id: 22 request: proto: HTTP/1.1 @@ -811,7 +811,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -828,7 +828,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 112.043344ms + duration: 126.223708ms - id: 23 request: proto: HTTP/1.1 @@ -847,7 +847,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -864,7 +864,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 114.385244ms + duration: 108.228125ms - id: 24 request: proto: HTTP/1.1 @@ -883,7 +883,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -894,13 +894,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 178.123928ms + duration: 104.405625ms - id: 25 request: proto: HTTP/1.1 @@ -919,7 +919,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -936,7 +936,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 117.523509ms + duration: 151.248ms - id: 26 request: proto: HTTP/1.1 @@ -955,7 +955,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -972,7 +972,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 190.866432ms + duration: 125.594709ms - id: 27 request: proto: HTTP/1.1 @@ -991,7 +991,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -1002,13 +1002,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":true,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":true,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 127.481694ms + duration: 118.562541ms - id: 28 request: proto: HTTP/1.1 @@ -1027,7 +1027,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -1044,7 +1044,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 115.751179ms + duration: 97.694417ms - id: 29 request: proto: HTTP/1.1 @@ -1063,7 +1063,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -1080,7 +1080,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 104.736904ms + duration: 98.597916ms - id: 30 request: proto: HTTP/1.1 @@ -1099,7 +1099,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: PATCH response: @@ -1110,13 +1110,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":false,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 119.539137ms + duration: 159.417459ms - id: 31 request: proto: HTTP/1.1 @@ -1135,7 +1135,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -1146,13 +1146,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":false,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 127.77177ms + duration: 100.982667ms - id: 32 request: proto: HTTP/1.1 @@ -1171,7 +1171,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -1188,7 +1188,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 88.60767ms + duration: 110.480709ms - id: 33 request: proto: HTTP/1.1 @@ -1207,7 +1207,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -1224,7 +1224,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 151.647541ms + duration: 97.138458ms - id: 34 request: proto: HTTP/1.1 @@ -1243,7 +1243,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: GET response: @@ -1254,13 +1254,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":false,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 138.628718ms + duration: 106.198625ms - id: 35 request: proto: HTTP/1.1 @@ -1279,7 +1279,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: GET response: @@ -1296,7 +1296,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 112.164323ms + duration: 123.162ms - id: 36 request: proto: HTTP/1.1 @@ -1315,7 +1315,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: GET response: @@ -1332,7 +1332,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 115.036677ms + duration: 95.39625ms - id: 37 request: proto: HTTP/1.1 @@ -1351,7 +1351,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/breached-password-detection method: PATCH response: @@ -1362,13 +1362,13 @@ interactions: trailer: { } content_length: -1 uncompressed: true - body: '{"enabled":false,"shields":["admin_notification","user_notification","block"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification"]}}}' + body: '{"enabled":false,"shields":["admin_notification","block","user_notification"],"admin_notification_frequency":["weekly","monthly","daily","immediately"],"method":"standard","stage":{"pre-user-registration":{"shields":["admin_notification","block"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 124.493203ms + duration: 126.381ms - id: 38 request: proto: HTTP/1.1 @@ -1387,7 +1387,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/brute-force-protection method: PATCH response: @@ -1404,7 +1404,7 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 271.546747ms + duration: 121.316125ms - id: 39 request: proto: HTTP/1.1 @@ -1423,7 +1423,7 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.12.0 + - Go-Auth0-SDK/0.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/attack-protection/suspicious-ip-throttling method: PATCH response: @@ -1440,4 +1440,4 @@ interactions: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 178.967022ms + duration: 99.91475ms