diff --git a/auth0/resource_auth0_tenant.go b/auth0/resource_auth0_tenant.go index e35951ed5..2ce5e8c22 100644 --- a/auth0/resource_auth0_tenant.go +++ b/auth0/resource_auth0_tenant.go @@ -299,6 +299,25 @@ func newTenant() *schema.Resource { validation.IsURLWithScheme([]string{"https"}), ), }, + "session_cookie": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "mode": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "persistent", + "non-persistent", + }, false), + Description: "Behavior of tenant session cookie. Accepts either \"persistent\" or \"non-persistent\"", + }, + }, + }, + }, }, } } @@ -339,6 +358,7 @@ func readTenant(ctx context.Context, d *schema.ResourceData, m interface{}) diag d.Set("error_page", flattenTenantErrorPage(tenant.ErrorPage)), d.Set("flags", flattenTenantFlags(tenant.Flags)), d.Set("universal_login", flattenTenantUniversalLogin(tenant.UniversalLogin)), + d.Set("session_cookie", flattenTenantSessionCookie(tenant.SessionCookie)), ) return diag.FromErr(result.ErrorOrNil()) @@ -378,6 +398,7 @@ func expandTenant(d *schema.ResourceData) *management.Tenant { ErrorPage: expandTenantErrorPage(d), Flags: expandTenantFlags(d.GetRawConfig().GetAttr("flags")), UniversalLogin: expandTenantUniversalLogin(d), + SessionCookie: expandTenantSessionCookie(d), } return tenant diff --git a/auth0/resource_auth0_tenant_test.go b/auth0/resource_auth0_tenant_test.go index b04ee9a64..2c19b0518 100644 --- a/auth0/resource_auth0_tenant_test.go +++ b/auth0/resource_auth0_tenant_test.go @@ -43,6 +43,7 @@ func TestAccTenant(t *testing.T) { 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"), ), }, { @@ -53,6 +54,13 @@ func TestAccTenant(t *testing.T) { resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.disable_clickjack_protection_headers", "false"), 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", "false"), + resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "session_cookie.0.mode", "persistent"), + ), + }, + { + Config: `resource "auth0_tenant" "my_tenant" {}`, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "session_cookie.0.mode", "persistent"), ), }, }, @@ -103,6 +111,9 @@ resource "auth0_tenant" "my_tenant" { } } default_redirection_uri = "https://example.com/login" + session_cookie { + mode = "non-persistent" + } } ` @@ -150,6 +161,9 @@ resource "auth0_tenant" "my_tenant" { } } default_redirection_uri = "https://example.com/login" + session_cookie { + mode = "persistent" + } } ` diff --git a/auth0/structure_auth0_tenant.go b/auth0/structure_auth0_tenant.go index 818496bc7..f29058cd3 100644 --- a/auth0/structure_auth0_tenant.go +++ b/auth0/structure_auth0_tenant.go @@ -93,6 +93,13 @@ func flattenTenantUniversalLogin(universalLogin *management.TenantUniversalLogin return []interface{}{m} } +func flattenTenantSessionCookie(sessionCookie *management.TenantSessionCookie) []interface{} { + m := make(map[string]interface{}) + m["mode"] = sessionCookie.GetMode() + + return []interface{}{m} +} + func expandTenantChangePassword(d ResourceData) *management.TenantChangePassword { var changePassword management.TenantChangePassword @@ -176,3 +183,13 @@ func expandTenantUniversalLogin(d ResourceData) *management.TenantUniversalLogin return &universalLogin } + +func expandTenantSessionCookie(d ResourceData) *management.TenantSessionCookie { + var sessionCookie management.TenantSessionCookie + + List(d, "session_cookie").Elem(func(d ResourceData) { + sessionCookie.Mode = String(d, "mode") + }) + + return &sessionCookie +} diff --git a/auth0/testdata/recordings/TestAccTenant.yaml b/auth0/testdata/recordings/TestAccTenant.yaml index 007581b6e..f6609551c 100644 --- a/auth0/testdata/recordings/TestAccTenant.yaml +++ b/auth0/testdata/recordings/TestAccTenant.yaml @@ -3,20 +3,20 @@ version: 1 interactions: - request: body: | - {"change_password":{"enabled":true,"html":"\u003chtml\u003eChange Password\u003c/html\u003e"},"guardian_mfa_page":{"enabled":true,"html":"\u003chtml\u003eMFA\u003c/html\u003e"},"error_page":{"html":"\u003chtml\u003eError Page\u003c/html\u003e","show_log_link":false,"url":"https://mycompany.org/error"},"flags":{"universal_login":true,"disable_clickjack_protection_headers":true,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":false,"disable_fields_map_fix":false,"enable_public_signup_user_exists_error":true,"use_scope_descriptions_for_consent":true},"friendly_name":"My Test Tenant","picture_url":"https://mycompany.org/logo.png","support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"session_lifetime":720,"idle_session_lifetime":72,"sandbox_version":"12","default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"]} + {"change_password":{"enabled":true,"html":"\u003chtml\u003eChange Password\u003c/html\u003e"},"guardian_mfa_page":{"enabled":true,"html":"\u003chtml\u003eMFA\u003c/html\u003e"},"error_page":{"html":"\u003chtml\u003eError Page\u003c/html\u003e","show_log_link":false,"url":"https://mycompany.org/error"},"flags":{"universal_login":true,"disable_clickjack_protection_headers":true,"enable_public_signup_user_exists_error":true,"use_scope_descriptions_for_consent":true,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":false,"disable_fields_map_fix":false},"friendly_name":"My Test Tenant","picture_url":"https://mycompany.org/logo.png","support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"session_lifetime":720,"idle_session_lifetime":72,"sandbox_version":"12","default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"session_cookie":{"mode":"non-persistent"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.6.3 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings method: PATCH response: body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change - Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"html":"Error - Page","url":"https://mycompany.org/error","show_log_link":false},"flags":{"allow_changing_enable_sso":false,"cannot_change_enforce_client_authentication_on_passwordless_start":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"enable_apis_section":false,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":false,"enable_legacy_logs_search_v2":false,"enable_public_signup_user_exists_error":true,"enable_sso":true,"enforce_client_authentication_on_passwordless_start":true,"new_universal_login_experience_enabled":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"revoke_refresh_token_grant":false,"disable_clickjack_protection_headers":true,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":false,"disable_fields_map_fix":false,"enable_pipeline2":false},"friendly_name":"My - Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}}}' + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"cannot_change_enforce_client_authentication_on_passwordless_start":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":false,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"enforce_client_authentication_on_passwordless_start":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":false,"disable_clickjack_protection_headers":true,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"non-persistent"}}' headers: Content-Type: - application/json; charset=utf-8 @@ -31,14 +31,14 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.6.3 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings method: GET response: body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change - Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"html":"Error - Page","url":"https://mycompany.org/error","show_log_link":false},"flags":{"allow_changing_enable_sso":false,"change_pwd_flow_v1":false,"disable_impersonation":true,"enable_apis_section":false,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":false,"enable_legacy_logs_search_v2":false,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"revoke_refresh_token_grant":false,"disable_clickjack_protection_headers":true,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":false,"disable_fields_map_fix":false,"enable_pipeline2":false},"friendly_name":"My - Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"sandbox_versions_available":["12"]}' + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":false,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":false,"disable_clickjack_protection_headers":true,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"non-persistent"},"sandbox_versions_available":["12"]}' headers: Content-Type: - application/json; charset=utf-8 @@ -53,14 +53,14 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.6.3 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings method: GET response: body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change - Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"html":"Error - Page","url":"https://mycompany.org/error","show_log_link":false},"flags":{"allow_changing_enable_sso":false,"change_pwd_flow_v1":false,"disable_impersonation":true,"enable_apis_section":false,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":false,"enable_legacy_logs_search_v2":false,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"revoke_refresh_token_grant":false,"disable_clickjack_protection_headers":true,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":false,"disable_fields_map_fix":false,"enable_pipeline2":false},"friendly_name":"My - Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"sandbox_versions_available":["12"]}' + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":false,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":false,"disable_clickjack_protection_headers":true,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"non-persistent"},"sandbox_versions_available":["12"]}' headers: Content-Type: - application/json; charset=utf-8 @@ -75,14 +75,14 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.6.3 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings method: GET response: body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change - Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"html":"Error - Page","url":"https://mycompany.org/error","show_log_link":false},"flags":{"allow_changing_enable_sso":false,"change_pwd_flow_v1":false,"disable_impersonation":true,"enable_apis_section":false,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":false,"enable_legacy_logs_search_v2":false,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"revoke_refresh_token_grant":false,"disable_clickjack_protection_headers":true,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":false,"disable_fields_map_fix":false,"enable_pipeline2":false},"friendly_name":"My - Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"sandbox_versions_available":["12"]}' + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["en","de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":false,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":true,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":false,"disable_clickjack_protection_headers":true,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"non-persistent"},"sandbox_versions_available":["12"]}' headers: Content-Type: - application/json; charset=utf-8 @@ -91,20 +91,20 @@ interactions: duration: 1ms - request: body: | - {"change_password":{"enabled":true,"html":"\u003chtml\u003eChange Password\u003c/html\u003e"},"guardian_mfa_page":{"enabled":true,"html":"\u003chtml\u003eMFA\u003c/html\u003e"},"error_page":{"html":"\u003chtml\u003eError Page\u003c/html\u003e","show_log_link":false,"url":"https://mycompany.org/error"},"flags":{"universal_login":true,"disable_clickjack_protection_headers":false,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":true,"disable_fields_map_fix":true,"enable_public_signup_user_exists_error":true,"use_scope_descriptions_for_consent":false},"friendly_name":"My Test Tenant","picture_url":"https://mycompany.org/logo.png","support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"session_lifetime":720,"sandbox_version":"12","default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"]} + {"change_password":{"enabled":true,"html":"\u003chtml\u003eChange Password\u003c/html\u003e"},"guardian_mfa_page":{"enabled":true,"html":"\u003chtml\u003eMFA\u003c/html\u003e"},"error_page":{"html":"\u003chtml\u003eError Page\u003c/html\u003e","show_log_link":false,"url":"https://mycompany.org/error"},"flags":{"universal_login":true,"disable_clickjack_protection_headers":false,"enable_public_signup_user_exists_error":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":true,"disable_fields_map_fix":true},"friendly_name":"My Test Tenant","picture_url":"https://mycompany.org/logo.png","support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"session_lifetime":720,"sandbox_version":"12","default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"session_cookie":{"mode":"persistent"}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.6.3 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings method: PATCH response: body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change - Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"html":"Error - Page","url":"https://mycompany.org/error","show_log_link":false},"flags":{"allow_changing_enable_sso":false,"cannot_change_enforce_client_authentication_on_passwordless_start":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"enable_apis_section":false,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":false,"enable_legacy_logs_search_v2":false,"enable_public_signup_user_exists_error":true,"enable_sso":true,"enforce_client_authentication_on_passwordless_start":true,"new_universal_login_experience_enabled":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"revoke_refresh_token_grant":false,"disable_clickjack_protection_headers":false,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":true,"disable_fields_map_fix":true,"enable_pipeline2":false},"friendly_name":"My - Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}}}' + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"cannot_change_enforce_client_authentication_on_passwordless_start":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":true,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"enforce_client_authentication_on_passwordless_start":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":true,"disable_clickjack_protection_headers":false,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"persistent"}}' headers: Content-Type: - application/json; charset=utf-8 @@ -119,14 +119,14 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.6.3 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings method: GET response: body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change - Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"html":"Error - Page","url":"https://mycompany.org/error","show_log_link":false},"flags":{"allow_changing_enable_sso":false,"change_pwd_flow_v1":false,"disable_impersonation":true,"enable_apis_section":false,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":false,"enable_legacy_logs_search_v2":false,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"revoke_refresh_token_grant":false,"disable_clickjack_protection_headers":false,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":true,"disable_fields_map_fix":true,"enable_pipeline2":false},"friendly_name":"My - Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"sandbox_versions_available":["12"]}' + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":true,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":true,"disable_clickjack_protection_headers":false,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"persistent"},"sandbox_versions_available":["12"]}' headers: Content-Type: - application/json; charset=utf-8 @@ -141,14 +141,102 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0-SDK/0.6.3 + - Go-Auth0-SDK/latest url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings method: GET response: body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change - Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"html":"Error - Page","url":"https://mycompany.org/error","show_log_link":false},"flags":{"allow_changing_enable_sso":false,"change_pwd_flow_v1":false,"disable_impersonation":true,"enable_apis_section":false,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":false,"enable_legacy_logs_search_v2":false,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"revoke_refresh_token_grant":false,"disable_clickjack_protection_headers":false,"no_disclose_enterprise_connections":false,"disable_management_api_sms_obfuscation":true,"disable_fields_map_fix":true,"enable_pipeline2":false},"friendly_name":"My - Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"sandbox_versions_available":["12"]}' + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":true,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":true,"disable_clickjack_protection_headers":false,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"persistent"},"sandbox_versions_available":["12"]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 1ms +- request: + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings + method: GET + response: + body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":true,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":true,"disable_clickjack_protection_headers":false,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":720,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"persistent"},"sandbox_versions_available":["12"]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 1ms +- request: + body: | + {"change_password":{"enabled":true,"html":"\u003chtml\u003eChange Password\u003c/html\u003e"},"guardian_mfa_page":{"enabled":true,"html":"\u003chtml\u003eMFA\u003c/html\u003e"},"error_page":{"html":"\u003chtml\u003eError Page\u003c/html\u003e","show_log_link":false,"url":"https://mycompany.org/error"},"friendly_name":"My Test Tenant","picture_url":"https://mycompany.org/logo.png","support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"session_lifetime":168,"sandbox_version":"12","default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"session_cookie":{"mode":"persistent"}} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings + method: PATCH + response: + body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"cannot_change_enforce_client_authentication_on_passwordless_start":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":true,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"enforce_client_authentication_on_passwordless_start":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":true,"disable_clickjack_protection_headers":false,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":168,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"persistent"}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 1ms +- request: + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings + method: GET + response: + body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":true,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":true,"disable_clickjack_protection_headers":false,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":168,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"persistent"},"sandbox_versions_available":["12"]}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 1ms +- request: + body: | + null + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0-SDK/latest + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/tenants/settings + method: GET + response: + body: '{"allowed_logout_urls":["https://mycompany.org/logoutCallback"],"change_password":{"enabled":true,"html":"Change + Password"},"default_redirection_uri":"https://example.com/login","enabled_locales":["de","fr"],"error_page":{"show_log_link":false,"html":"Error + Page","url":"https://mycompany.org/error"},"flags":{"allow_changing_enable_sso":false,"allow_legacy_delegation_grant_types":true,"allow_legacy_ro_grant_types":true,"allow_legacy_tokeninfo_endpoint":true,"change_pwd_flow_v1":false,"disable_impersonation":true,"disable_management_api_sms_obfuscation":true,"enable_adfs_waad_email_verification":true,"enable_apis_section":true,"enable_client_connections":true,"enable_custom_domain_in_emails":false,"enable_dynamic_client_registration":true,"enable_idtoken_api2":true,"enable_legacy_logs_search_v2":true,"enable_legacy_profile":true,"enable_public_signup_user_exists_error":true,"enable_sso":true,"new_universal_login_experience_enabled":true,"non_oidc_conformant_updated_at":true,"universal_login":true,"use_scope_descriptions_for_consent":false,"no_disclose_enterprise_connections":false,"revoke_refresh_token_grant":true,"dashboard_log_streams_next":true,"disable_fields_map_fix":true,"disable_clickjack_protection_headers":false,"enable_pipeline2":true},"friendly_name":"My + Test Tenant","guardian_mfa_page":{"enabled":true,"html":"MFA"},"idle_session_lifetime":72,"picture_url":"https://mycompany.org/logo.png","sandbox_version":"12","session_lifetime":168,"support_email":"support@mycompany.org","support_url":"https://mycompany.org/support","universal_login":{"colors":{"primary":"#0059d6","page_background":"#000000"}},"session_cookie":{"mode":"persistent"},"sandbox_versions_available":["12"]}' headers: Content-Type: - application/json; charset=utf-8 diff --git a/docs/resources/tenant.md b/docs/resources/tenant.md index b6416f7a2..b1e911cc7 100644 --- a/docs/resources/tenant.md +++ b/docs/resources/tenant.md @@ -49,6 +49,9 @@ resource "auth0_tenant" "tenant" { ] session_lifetime = 46000 sandbox_version = "8" + session_cookie { + mode = "non-persistent" + } } ``` @@ -73,6 +76,7 @@ Arguments accepted by this resource include: * `flags` - (Optional) List(Resource). Configuration settings for tenant flags. For details, see [Flags](#flags). * `universal_login` - (Optional) List(Resource). Configuration settings for Universal Login. For details, see [Universal Login](#universal-login). * `default_redirection_uri` - (Optional) String. The default absolute redirection uri, must be https and cannot contain a fragment. +* `session_cookie` - (Optional) List(Resource). Alters behavior of tenant's session cookie. Contains a single `mode` property that accepts two values: `"persistent"` or `"non-persistent"`. ### Change Password Page diff --git a/example/tenant/main.tf b/example/tenant/main.tf index 7d1b19f23..b8debd1c4 100644 --- a/example/tenant/main.tf +++ b/example/tenant/main.tf @@ -38,4 +38,8 @@ resource "auth0_tenant" "tenant" { show_log_link = true url = "http://example.com/errors" } + + session_cookie { + mode = "non-persistent" + } } diff --git a/go.mod b/go.mod index 2a85cb397..4eaf2367b 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/auth0/terraform-provider-auth0 go 1.18 require ( - github.com/auth0/go-auth0 v0.8.0 + github.com/auth0/go-auth0 v0.9.0 github.com/dnaeon/go-vcr/v2 v2.0.1 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/go-multierror v1.1.1 diff --git a/go.sum b/go.sum index f5d6de8f6..68616e150 100644 --- a/go.sum +++ b/go.sum @@ -52,8 +52,8 @@ github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJE github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/auth0/go-auth0 v0.8.0 h1:x5Z6q++NUtdaSyzoHMaMRjH/SpiWS5rLTQ8ZX0AsRRE= -github.com/auth0/go-auth0 v0.8.0/go.mod h1:kxxGNgF592VPvWSNPVWNbmWHs+R9c0MZCTuW+T3NgZw= +github.com/auth0/go-auth0 v0.9.0 h1:+jiMnvXSsu9v6eZUy6MrgqBN0nw4wK8mBivtoLeD3Pk= +github.com/auth0/go-auth0 v0.9.0/go.mod h1:kxxGNgF592VPvWSNPVWNbmWHs+R9c0MZCTuW+T3NgZw= github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48= github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0/go.mod h1:6L7zgvqo0idzI7IO8de6ZC051AfXb5ipkIJ7bIA2tGA= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=