From df2f0f8c4540d7255d9b7118d3d20459b83002fc Mon Sep 17 00:00:00 2001 From: kushalshit27 <43465488+kushalshit27@users.noreply.github.com> Date: Tue, 11 Feb 2025 11:48:36 +0530 Subject: [PATCH 1/5] Google Credential Manager support --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/auth0/client/expand.go | 1 + internal/auth0/client/flatten.go | 5 +++++ internal/auth0/client/resource.go | 14 ++++++++++++++ 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 91e8a99d..96f1732d 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.5 require ( github.com/PuerkitoBio/rehttp v1.4.0 - github.com/auth0/go-auth0 v1.15.0 + github.com/auth0/go-auth0 v1.16.0 github.com/google/go-cmp v0.6.0 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/go-multierror v1.1.1 @@ -80,7 +80,7 @@ require ( golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.33.0 // indirect - golang.org/x/oauth2 v0.25.0 // indirect + golang.org/x/oauth2 v0.26.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/text v0.21.0 // indirect diff --git a/go.sum b/go.sum index 23694821..c57b27b7 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/auth0/go-auth0 v1.15.0 h1:tfwbcUO2QrQfrbVQ0qfDGcB3gPQQlZDJU4D0C9w0+OY= -github.com/auth0/go-auth0 v1.15.0/go.mod h1:lKOp7ooUxEKPRAZziAfN3km1TH0VYVHkCvTMZsfQCS8= +github.com/auth0/go-auth0 v1.16.0 h1:8n6WycyRE0soCEh0gnL15wknnI9srNVP8hk+4vY/OzY= +github.com/auth0/go-auth0 v1.16.0/go.mod h1:f6wP4Hov4Be5AKK55tVhAHlKNltqXQIIc3QGfBbnvdU= 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= @@ -238,8 +238,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= -golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE= +golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/auth0/client/expand.go b/internal/auth0/client/expand.go index d4c60ba2..9955b8bc 100644 --- a/internal/auth0/client/expand.go +++ b/internal/auth0/client/expand.go @@ -272,6 +272,7 @@ func expandClientNativeSocialLogin(data *schema.ResourceData) *management.Client nativeSocialLoginConfig.ForEachElement(func(_ cty.Value, config cty.Value) (stop bool) { nativeSocialLogin.Apple = expandClientNativeSocialLoginSupportEnabled(config.GetAttr("apple")) nativeSocialLogin.Facebook = expandClientNativeSocialLoginSupportEnabled(config.GetAttr("facebook")) + nativeSocialLogin.Google = expandClientNativeSocialLoginSupportEnabled(config.GetAttr("google")) return stop }) diff --git a/internal/auth0/client/flatten.go b/internal/auth0/client/flatten.go index 0fa024d0..f26490a4 100644 --- a/internal/auth0/client/flatten.go +++ b/internal/auth0/client/flatten.go @@ -25,6 +25,11 @@ func flattenCustomSocialConfiguration(customSocial *management.ClientNativeSocia "enabled": customSocial.GetFacebook().GetEnabled(), }, }, + "google": []interface{}{ + map[string]interface{}{ + "enabled": customSocial.GetFacebook().GetEnabled(), + }, + }, } return []interface{}{m} diff --git a/internal/auth0/client/resource.go b/internal/auth0/client/resource.go index 9e29fad2..f21e4bad 100644 --- a/internal/auth0/client/resource.go +++ b/internal/auth0/client/resource.go @@ -378,6 +378,20 @@ func NewResource() *schema.Resource { }, }, }, + "google": { + Type: schema.TypeList, + Optional: true, + Computed: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Optional: true, + }, + }, + }, + }, }, }, }, From fb115c36ddfa0ec68f4c841febc07bcccfb53436 Mon Sep 17 00:00:00 2001 From: kushalshit27 <43465488+kushalshit27@users.noreply.github.com> Date: Tue, 11 Feb 2025 12:04:14 +0530 Subject: [PATCH 2/5] Google Credential Manager support doc updated --- docs/data-sources/client.md | 9 +++++++++ docs/resources/client.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/data-sources/client.md b/docs/data-sources/client.md index 99794ff5..a15be40f 100644 --- a/docs/data-sources/client.md +++ b/docs/data-sources/client.md @@ -538,6 +538,7 @@ Read-Only: - `apple` (List of Object) (see [below for nested schema](#nestedobjatt--native_social_login--apple)) - `facebook` (List of Object) (see [below for nested schema](#nestedobjatt--native_social_login--facebook)) +- `google` (List of Object) (see [below for nested schema](#nestedobjatt--native_social_login--google)) ### Nested Schema for `native_social_login.apple` @@ -555,6 +556,14 @@ Read-Only: - `enabled` (Boolean) + +### Nested Schema for `native_social_login.google` + +Read-Only: + +- `enabled` (Boolean) + + ### Nested Schema for `oidc_logout` diff --git a/docs/resources/client.md b/docs/resources/client.md index 2f25acad..af517f09 100644 --- a/docs/resources/client.md +++ b/docs/resources/client.md @@ -511,6 +511,7 @@ Optional: - `apple` (Block List, Max: 1) (see [below for nested schema](#nestedblock--native_social_login--apple)) - `facebook` (Block List, Max: 1) (see [below for nested schema](#nestedblock--native_social_login--facebook)) +- `google` (Block List, Max: 1) (see [below for nested schema](#nestedblock--native_social_login--google)) ### Nested Schema for `native_social_login.apple` @@ -528,6 +529,14 @@ Optional: - `enabled` (Boolean) + +### Nested Schema for `native_social_login.google` + +Optional: + +- `enabled` (Boolean) + + ### Nested Schema for `oidc_logout` From 9fd1d9a69336a1a7a905aa668dd9f41f13f06f90 Mon Sep 17 00:00:00 2001 From: kushalshit27 <43465488+kushalshit27@users.noreply.github.com> Date: Tue, 11 Feb 2025 16:26:14 +0530 Subject: [PATCH 3/5] Google Credential Manager support updated --- internal/auth0/client/flatten.go | 2 +- internal/auth0/client/resource.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/auth0/client/flatten.go b/internal/auth0/client/flatten.go index f26490a4..05458374 100644 --- a/internal/auth0/client/flatten.go +++ b/internal/auth0/client/flatten.go @@ -27,7 +27,7 @@ func flattenCustomSocialConfiguration(customSocial *management.ClientNativeSocia }, "google": []interface{}{ map[string]interface{}{ - "enabled": customSocial.GetFacebook().GetEnabled(), + "enabled": customSocial.GetGoogle().GetEnabled(), }, }, } diff --git a/internal/auth0/client/resource.go b/internal/auth0/client/resource.go index f21e4bad..ea5a3b96 100644 --- a/internal/auth0/client/resource.go +++ b/internal/auth0/client/resource.go @@ -381,7 +381,6 @@ func NewResource() *schema.Resource { "google": { Type: schema.TypeList, Optional: true, - Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ From 3b70ec889ffe380513f7474f47072732cce07fa7 Mon Sep 17 00:00:00 2001 From: kushalshit27 <43465488+kushalshit27@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:46:59 +0530 Subject: [PATCH 4/5] Google Credential Manager support updated --- internal/auth0/client/resource.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/auth0/client/resource.go b/internal/auth0/client/resource.go index ea5a3b96..f21e4bad 100644 --- a/internal/auth0/client/resource.go +++ b/internal/auth0/client/resource.go @@ -381,6 +381,7 @@ func NewResource() *schema.Resource { "google": { Type: schema.TypeList, Optional: true, + Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ From 66533bb53c33933c1da271170144995542ca9221 Mon Sep 17 00:00:00 2001 From: kushalshit27 <43465488+kushalshit27@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:54:12 +0530 Subject: [PATCH 5/5] Google Credential Manager support unit test updated --- internal/auth0/client/resource_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/internal/auth0/client/resource_test.go b/internal/auth0/client/resource_test.go index b724a3dd..9dd653d3 100644 --- a/internal/auth0/client/resource_test.go +++ b/internal/auth0/client/resource_test.go @@ -83,6 +83,10 @@ resource "auth0_client" "my_client" { facebook { enabled = false } + + google { + enabled = false + } } } ` @@ -117,6 +121,10 @@ resource "auth0_client" "my_client" { facebook { enabled = true } + + google { + enabled = true + } } } ` @@ -189,6 +197,8 @@ func TestAccClientMobile(t *testing.T) { resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.apple.0.enabled", "true"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.#", "1"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.0.enabled", "false"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.#", "1"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.0.enabled", "false"), ), }, { @@ -212,6 +222,8 @@ func TestAccClientMobile(t *testing.T) { resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.apple.0.enabled", "false"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.#", "1"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.0.enabled", "true"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.#", "1"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.0.enabled", "true"), ), }, { @@ -235,6 +247,8 @@ func TestAccClientMobile(t *testing.T) { resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.apple.0.enabled", "false"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.#", "1"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.0.enabled", "false"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.#", "1"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.0.enabled", "false"), ), }, { @@ -261,6 +275,8 @@ func TestAccClientMobile(t *testing.T) { resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.apple.0.enabled", "false"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.#", "1"), resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.facebook.0.enabled", "false"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.#", "1"), + resource.TestCheckResourceAttr("auth0_client.my_client", "native_social_login.0.google.0.enabled", "false"), ), }, },