Skip to content

Commit

Permalink
DXCDT-450: Remove deprecated tenant universal login fields (#712)
Browse files Browse the repository at this point in the history
Removing references to deprecated universal login fields in auth0_tenant resource

Co-authored-by: Will Vedder <[email protected]>
Co-authored-by: Sergiu Ghitea <[email protected]>
  • Loading branch information
3 people authored Jul 13, 2023
1 parent d67669a commit fa1dc13
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 170 deletions.
18 changes: 0 additions & 18 deletions docs/data-sources/tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ data "auth0_tenant" "my_tenant" {}
- `session_lifetime` (Number) Number of hours during which a session will stay valid.
- `support_email` (String) Support email address for authenticating users.
- `support_url` (String) Support URL for authenticating users.
- `universal_login` (List of Object) Configuration settings for Universal Login. These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info. (see [below for nested schema](#nestedatt--universal_login))

<a id="nestedatt--flags"></a>
### Nested Schema for `flags`
Expand Down Expand Up @@ -64,7 +63,6 @@ Read-Only:
- `mfa_show_factor_list_on_enrollment` (Boolean)
- `no_disclose_enterprise_connections` (Boolean)
- `revoke_refresh_token_grant` (Boolean)
- `universal_login` (Boolean)
- `use_scope_descriptions_for_consent` (Boolean)


Expand All @@ -76,19 +74,3 @@ Read-Only:
- `mode` (String)


<a id="nestedatt--universal_login"></a>
### Nested Schema for `universal_login`

Read-Only:

- `colors` (List of Object) (see [below for nested schema](#nestedobjatt--universal_login--colors))

<a id="nestedobjatt--universal_login--colors"></a>
### Nested Schema for `universal_login.colors`

Read-Only:

- `page_background` (String)
- `primary` (String)


26 changes: 0 additions & 26 deletions docs/resources/tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,7 @@ resource "auth0_tenant" "my_tenant" {
mode = "non-persistent"
}
universal_login {
colors {
primary = "#0059d6"
page_background = "#000000"
}
}
flags {
universal_login = true
disable_clickjack_protection_headers = true
enable_public_signup_user_exists_error = true
use_scope_descriptions_for_consent = true
Expand Down Expand Up @@ -66,7 +58,6 @@ resource "auth0_tenant" "my_tenant" {
- `session_lifetime` (Number) Number of hours during which a session will stay valid.
- `support_email` (String) Support email address for authenticating users.
- `support_url` (String) Support URL for authenticating users.
- `universal_login` (Block List, Max: 1, Deprecated) Configuration settings for Universal Login. These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info. (see [below for nested schema](#nestedblock--universal_login))

### Read-Only

Expand Down Expand Up @@ -98,7 +89,6 @@ Optional:
- `mfa_show_factor_list_on_enrollment` (Boolean) Used to allow users to pick which factor to enroll with from the list of available MFA factors.
- `no_disclose_enterprise_connections` (Boolean) Do not Publish Enterprise Connections Information with IdP domains on the lock configuration file.
- `revoke_refresh_token_grant` (Boolean) Delete underlying grant when a refresh token is revoked via the Authentication API.
- `universal_login` (Boolean, Deprecated) Indicates whether the New Universal Login Experience is enabled.
- `use_scope_descriptions_for_consent` (Boolean) Indicates whether to use scope descriptions for consent.


Expand All @@ -109,22 +99,6 @@ Optional:

- `mode` (String) Behavior of tenant session cookie. Accepts either "persistent" or "non-persistent".


<a id="nestedblock--universal_login"></a>
### Nested Schema for `universal_login`

Optional:

- `colors` (Block List, Max: 1) Configuration settings for Universal Login colors. (see [below for nested schema](#nestedblock--universal_login--colors))

<a id="nestedblock--universal_login--colors"></a>
### Nested Schema for `universal_login.colors`

Optional:

- `page_background` (String) Background color of login pages in hexadecimal.
- `primary` (String) Primary button background color in hexadecimal.

## Import

Import is supported using the following syntax:
Expand Down
8 changes: 0 additions & 8 deletions examples/resources/auth0_tenant/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ resource "auth0_tenant" "my_tenant" {
mode = "non-persistent"
}

universal_login {
colors {
primary = "#0059d6"
page_background = "#000000"
}
}

flags {
universal_login = true
disable_clickjack_protection_headers = true
enable_public_signup_user_exists_error = true
use_scope_descriptions_for_consent = true
Expand Down
11 changes: 0 additions & 11 deletions internal/auth0/tenant/data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ resource "auth0_tenant" "my_tenant" {
enabled_locales = ["en", "de", "fr"]
flags {
universal_login = true
disable_clickjack_protection_headers = true
enable_public_signup_user_exists_error = true
use_scope_descriptions_for_consent = true
Expand All @@ -35,13 +34,6 @@ resource "auth0_tenant" "my_tenant" {
disable_fields_map_fix = false
}
universal_login {
colors {
primary = "#0059d6"
page_background = "#000000"
}
}
session_cookie {
mode = "non-persistent"
}
Expand Down Expand Up @@ -73,12 +65,9 @@ func TestAccDataSourceTenant(t *testing.T) {
resource.TestCheckResourceAttr("data.auth0_tenant.current", "enabled_locales.0", "en"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "enabled_locales.1", "de"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "enabled_locales.2", "fr"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.universal_login", "true"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.disable_clickjack_protection_headers", "true"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.enable_public_signup_user_exists_error", "true"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "flags.0.use_scope_descriptions_for_consent", "true"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "universal_login.0.colors.0.primary", "#0059d6"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "universal_login.0.colors.0.page_background", "#000000"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "default_redirection_uri", "https://example.com/login"),
resource.TestCheckResourceAttr("data.auth0_tenant.current", "session_cookie.0.mode", "non-persistent"),
),
Expand Down
25 changes: 0 additions & 25 deletions internal/auth0/tenant/expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func expandTenant(d *schema.ResourceData) *management.Tenant {
SandboxVersion: value.String(config.GetAttr("sandbox_version")),
EnabledLocales: value.Strings(config.GetAttr("enabled_locales")),
Flags: expandTenantFlags(config.GetAttr("flags")),
UniversalLogin: expandTenantUniversalLogin(config.GetAttr("universal_login")),
SessionCookie: expandTenantSessionCookie(config.GetAttr("session_cookie")),
}

Expand All @@ -48,7 +47,6 @@ func expandTenantFlags(config cty.Value) *management.TenantFlags {
EnablePipeline2: value.Bool(flags.GetAttr("enable_pipeline2")),
EnableDynamicClientRegistration: value.Bool(flags.GetAttr("enable_dynamic_client_registration")),
EnableCustomDomainInEmails: value.Bool(flags.GetAttr("enable_custom_domain_in_emails")),
UniversalLogin: value.Bool(flags.GetAttr("universal_login")),
EnableLegacyLogsSearchV2: value.Bool(flags.GetAttr("enable_legacy_logs_search_v2")),
DisableClickjackProtectionHeaders: value.Bool(flags.GetAttr("disable_clickjack_protection_headers")),
EnablePublicSignupUserExistsError: value.Bool(flags.GetAttr("enable_public_signup_user_exists_error")),
Expand All @@ -74,29 +72,6 @@ func expandTenantFlags(config cty.Value) *management.TenantFlags {
return tenantFlags
}

func expandTenantUniversalLogin(config cty.Value) *management.TenantUniversalLogin {
var universalLogin management.TenantUniversalLogin

config.ForEachElement(func(_ cty.Value, d cty.Value) (stop bool) {
colors := d.GetAttr("colors")

colors.ForEachElement(func(_ cty.Value, color cty.Value) (stop bool) {
universalLogin.Colors = &management.TenantUniversalLoginColors{
Primary: value.String(color.GetAttr("primary")),
PageBackground: value.String(color.GetAttr("page_background")),
}
return stop
})
return stop
})

if universalLogin == (management.TenantUniversalLogin{}) {
return nil
}

return &universalLogin
}

func expandTenantSessionCookie(config cty.Value) *management.TenantSessionCookie {
var sessionCookie management.TenantSessionCookie

Expand Down
20 changes: 0 additions & 20 deletions internal/auth0/tenant/flatten.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func flattenTenantFlags(flags *management.TenantFlags) []interface{} {
m["enable_pipeline2"] = flags.EnablePipeline2
m["enable_dynamic_client_registration"] = flags.EnableDynamicClientRegistration
m["enable_custom_domain_in_emails"] = flags.EnableCustomDomainInEmails
m["universal_login"] = flags.UniversalLogin
m["enable_legacy_logs_search_v2"] = flags.EnableLegacyLogsSearchV2
m["disable_clickjack_protection_headers"] = flags.DisableClickjackProtectionHeaders
m["enable_public_signup_user_exists_error"] = flags.EnablePublicSignupUserExistsError
Expand All @@ -37,25 +36,6 @@ func flattenTenantFlags(flags *management.TenantFlags) []interface{} {
return []interface{}{m}
}

func flattenTenantUniversalLogin(universalLogin *management.TenantUniversalLogin) []interface{} {
if universalLogin == nil {
return nil
}
if universalLogin.Colors == nil {
return nil
}

m := make(map[string]interface{})
m["colors"] = []interface{}{
map[string]interface{}{
"primary": universalLogin.Colors.Primary,
"page_background": universalLogin.Colors.PageBackground,
},
}

return []interface{}{m}
}

func flattenTenantSessionCookie(sessionCookie *management.TenantSessionCookie) []interface{} {
m := make(map[string]interface{})
m["mode"] = sessionCookie.GetMode()
Expand Down
43 changes: 0 additions & 43 deletions internal/auth0/tenant/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ func NewResource() *schema.Resource {
Computed: true,
Description: "Indicates whether the tenant allows custom domains in emails.",
},
"universal_login": {
Type: schema.TypeBool,
Optional: true,
Computed: true,
Deprecated: "This attribute is deprecated. Use the `universal_login_experience` attribute" +
" on the `auth0_prompt` resource to toggle the new or classic experience instead.",
Description: "Indicates whether the New Universal Login Experience is enabled.",
},
"enable_legacy_logs_search_v2": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -255,40 +247,6 @@ func NewResource() *schema.Resource {
},
},
},
"universal_login": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "Configuration settings for Universal Login. These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info.",
Deprecated: "These configuration settings have been deprecated. Migrate to managing these settings through the `auth0_branding` resource. Check the [MIGRATION_GUIDE](https://github.com/auth0/terraform-provider-auth0/blob/main/MIGRATION_GUIDE.md#tenant-universal-login) for more info.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"colors": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: "Configuration settings for Universal Login colors.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"primary": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "Primary button background color in hexadecimal.",
},
"page_background": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Description: "Background color of login pages in hexadecimal.",
},
},
},
},
},
},
},
"default_redirection_uri": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -352,7 +310,6 @@ func readTenant(ctx context.Context, d *schema.ResourceData, m interface{}) diag
d.Set("sandbox_version", tenant.GetSandboxVersion()),
d.Set("enabled_locales", tenant.GetEnabledLocales()),
d.Set("flags", flattenTenantFlags(tenant.GetFlags())),
d.Set("universal_login", flattenTenantUniversalLogin(tenant.GetUniversalLogin())),
d.Set("session_cookie", flattenTenantSessionCookie(tenant.GetSessionCookie())),
)

Expand Down
19 changes: 0 additions & 19 deletions internal/auth0/tenant/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ func TestAccTenant(t *testing.T) {
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.1", "de"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.2", "fr"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.#", "1"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.universal_login", "true"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.disable_clickjack_protection_headers", "true"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.enable_public_signup_user_exists_error", "true"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.use_scope_descriptions_for_consent", "true"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.mfa_show_factor_list_on_enrollment", "false"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "universal_login.0.colors.0.primary", "#0059d6"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "universal_login.0.colors.0.page_background", "#000000"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "default_redirection_uri", "https://example.com/login"),
resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "session_cookie.0.mode", "non-persistent"),
),
Expand Down Expand Up @@ -96,7 +93,6 @@ resource "auth0_tenant" "my_tenant" {
enabled_locales = ["en", "de", "fr"]
flags {
universal_login = true
disable_clickjack_protection_headers = true
enable_public_signup_user_exists_error = true
use_scope_descriptions_for_consent = true
Expand All @@ -106,13 +102,6 @@ resource "auth0_tenant" "my_tenant" {
mfa_show_factor_list_on_enrollment = false
}
universal_login {
colors {
primary = "#0059d6"
page_background = "#000000"
}
}
session_cookie {
mode = "non-persistent"
}
Expand All @@ -134,7 +123,6 @@ resource "auth0_tenant" "my_tenant" {
enabled_locales = ["de", "fr"]
flags {
universal_login = true
enable_public_signup_user_exists_error = true
disable_clickjack_protection_headers = false # <---- disable and test
use_scope_descriptions_for_consent = false
Expand All @@ -144,13 +132,6 @@ resource "auth0_tenant" "my_tenant" {
mfa_show_factor_list_on_enrollment = true
}
universal_login {
colors {
primary = "#0059d6"
page_background = "#000000"
}
}
session_cookie {
mode = "persistent"
}
Expand Down

0 comments on commit fa1dc13

Please sign in to comment.