From d5cfe993b2d0e422c47bc0041989229721bd9eb9 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 10 Jan 2025 11:22:38 +0530 Subject: [PATCH 01/15] v1 --- go.mod | 12 +-- go.sum | 12 +++ .../auth0/tokenexchangeprofile/data_source.go | 43 +++++++++ .../tokenexchangeprofile/data_source_test.go | 1 + internal/auth0/tokenexchangeprofile/expand.go | 19 ++++ .../auth0/tokenexchangeprofile/flatten.go | 19 ++++ .../auth0/tokenexchangeprofile/resource.go | 93 +++++++++++++++++++ .../tokenexchangeprofile/resource_test.go | 73 +++++++++++++++ internal/provider/provider.go | 3 + 9 files changed, 269 insertions(+), 6 deletions(-) create mode 100644 internal/auth0/tokenexchangeprofile/data_source.go create mode 100644 internal/auth0/tokenexchangeprofile/data_source_test.go create mode 100644 internal/auth0/tokenexchangeprofile/expand.go create mode 100644 internal/auth0/tokenexchangeprofile/flatten.go create mode 100644 internal/auth0/tokenexchangeprofile/resource.go create mode 100644 internal/auth0/tokenexchangeprofile/resource_test.go diff --git a/go.mod b/go.mod index 589a578c..352f0eb6 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.13.0 + github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287 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 @@ -76,14 +76,14 @@ require ( github.com/yuin/goldmark-meta v1.1.0 // indirect github.com/zclconf/go-cty v1.15.0 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect - golang.org/x/crypto v0.29.0 // indirect + golang.org/x/crypto v0.31.0 // indirect golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.24.0 // indirect - golang.org/x/sync v0.9.0 // indirect - golang.org/x/sys v0.27.0 // indirect - golang.org/x/text v0.20.0 // indirect + golang.org/x/oauth2 v0.25.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 golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect diff --git a/go.sum b/go.sum index 510c8bc9..16a0a518 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ 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.13.0 h1:GA7WyGAzlKBQ2ctHcCZwVf0aiOvPd2PB3QagC5heQJg= github.com/auth0/go-auth0 v1.13.0/go.mod h1:G3oPT7sWjmM4mHbn6qkMYEsxnwm/5PnSbo0kpPLSS0E= +github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287 h1:/zugS0NrQ0JJD0JSf6iY3DT9nB8i1i27cGYcpzL/yAU= +github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= 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= @@ -225,6 +227,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d h1:N0hmiNbwsSNwHBAvR3QB5w25pUwH4tK0Y/RltD1j1h4= golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -240,11 +244,15 @@ golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +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/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= golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -261,6 +269,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -273,6 +283,8 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff --git a/internal/auth0/tokenexchangeprofile/data_source.go b/internal/auth0/tokenexchangeprofile/data_source.go new file mode 100644 index 00000000..7b40b935 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/data_source.go @@ -0,0 +1,43 @@ +package tokenexchangeprofile + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/auth0/terraform-provider-auth0/internal/config" + internalSchema "github.com/auth0/terraform-provider-auth0/internal/schema" +) + +// NewDataSource will return a new auth0_token_exchange_profile data source. +func NewDataSource() *schema.Resource { + return &schema.Resource{ + ReadContext: readTokenExchangeProfileForDataSource, + Description: "Data source to retrieve a specific Auth0 Token Exchange Profile by `id`", + Schema: dataSourceSchema(), + } +} + +func dataSourceSchema() map[string]*schema.Schema { + dataSourceSchema := internalSchema.TransformResourceToDataSource(NewResource().Schema) + dataSourceSchema["id"] = &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The ID of the Self Service Profile.", + } + dataSourceSchema["id"].Description = "The id of the Token Exchange Profile " + return dataSourceSchema +} + +func readTokenExchangeProfileForDataSource(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + id := data.Get("id").(string) + data.SetId(id) + ssp, err := api.TokenExchangeProfile.Read(ctx, data.Id()) + if err != nil { + return diag.FromErr(err) + } + err = flattenTokenExchangeProfile(data, ssp) + return diag.FromErr(err) +} diff --git a/internal/auth0/tokenexchangeprofile/data_source_test.go b/internal/auth0/tokenexchangeprofile/data_source_test.go new file mode 100644 index 00000000..d12e0750 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/data_source_test.go @@ -0,0 +1 @@ +package tokenexchangeprofile diff --git a/internal/auth0/tokenexchangeprofile/expand.go b/internal/auth0/tokenexchangeprofile/expand.go new file mode 100644 index 00000000..cfb9ace1 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/expand.go @@ -0,0 +1,19 @@ +package tokenexchangeprofile + +import ( + "github.com/auth0/go-auth0/management" + "github.com/auth0/terraform-provider-auth0/internal/value" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func expandTokenExchangeProfiles(data *schema.ResourceData) *management.TokenExchangeProfile { + cfg := data.GetRawConfig() + + return &management.TokenExchangeProfile{ + + Name: value.String(cfg.GetAttr("name")), + SubjectTokenType: value.String(cfg.GetAttr("subject_token_type")), + ActionID: value.String(cfg.GetAttr("action_id")), + Type: value.String(cfg.GetAttr("type")), + } +} diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go new file mode 100644 index 00000000..c7a27c8d --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -0,0 +1,19 @@ +package tokenexchangeprofile + +import ( + "github.com/auth0/go-auth0/management" + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile *management.TokenExchangeProfile) error { + result := multierror.Append( + data.Set("name", tokenExchangeProfile.Name), + data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), + data.Set("action_id", tokenExchangeProfile.GetActionID()), + data.Set("type", tokenExchangeProfile.GetType()), + //data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()), + ) + return result.ErrorOrNil() +} diff --git a/internal/auth0/tokenexchangeprofile/resource.go b/internal/auth0/tokenexchangeprofile/resource.go new file mode 100644 index 00000000..b3357188 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/resource.go @@ -0,0 +1,93 @@ +package tokenexchangeprofile + +import ( + "context" + "github.com/auth0/terraform-provider-auth0/internal/config" + internalError "github.com/auth0/terraform-provider-auth0/internal/error" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +// NewResource will return a new auth0_token_exchange_profile resource. +func NewResource() *schema.Resource { + return &schema.Resource{ + CreateContext: createTokenExchangeProfile, + ReadContext: readTokenExchangeProfile, + UpdateContext: updateTokenExchangeProfile, + DeleteContext: deleteTokenExchangeProfile, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Description: "With this resource, you can manage Auth0 Custom Token Exchange Profiles", + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Name of the token exchange profile.", + }, + "subject_token_type": { + Type: schema.TypeString, + Optional: true, + Description: "Type of the subject token", + }, + "action_id": { + Type: schema.TypeString, + Optional: true, + Description: "Unique identifier of the Action", + }, + "type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Type of the token exchange profile", + }, + }, + } +} + +func createTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + tep := expandTokenExchangeProfiles(data) + + if err := api.TokenExchangeProfile.Create(ctx, tep); err != nil { + return diag.FromErr(err) + } + + data.SetId(tep.GetID()) + + return readTokenExchangeProfile(ctx, data, meta) +} + +func readTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + ssp, err := api.TokenExchangeProfile.Read(ctx, data.Id()) + if err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return diag.FromErr(flattenTokenExchangeProfile(data, ssp)) +} + +func updateTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + tep := expandTokenExchangeProfiles(data) + + if err := api.TokenExchangeProfile.Update(ctx, data.Id(), tep); err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return readTokenExchangeProfile(ctx, data, meta) +} + +func deleteTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + if err := api.TokenExchangeProfile.Delete(ctx, data.Id()); err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return nil +} diff --git a/internal/auth0/tokenexchangeprofile/resource_test.go b/internal/auth0/tokenexchangeprofile/resource_test.go new file mode 100644 index 00000000..cf5f13d1 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/resource_test.go @@ -0,0 +1,73 @@ +package tokenexchangeprofile_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/auth0/terraform-provider-auth0/internal/acctest" +) + +const testTokenExchangeProfileCreate = ` +resource "auth0_action" "my_action" { + name = "Test Action {{.testName}}2" + code = "exports.onExecutePostLogin = async (event, api) => {};" + deploy = true + supported_triggers { + id = "custom-token-exchange" + version = "v1" + } +} + +resource "auth0_token_exchange_profile" "my_token_exchange_profile" { + name = "my-token-exc-profile-{{.testName}}" + subject_token_type = "https://acme.com/cis-token" + action_id = auth0_action.my_action.id + type = "custom_authentication" +} +` + +const testTokenExchangeProfileUpdate = ` +resource "auth0_action" "my_action" { + name = "Test Action {{.testName}}2" + code = "exports.onExecutePostLogin = async (event, api) => {};" + deploy = true + supported_triggers { + id = "custom-token-exchange" + version = "v1" + } +} + +resource "auth0_token_exchange_profile" "my_token_exchange_profile" { + name = "my-token-exc-profile-updated-{{.testName}}" + subject_token_type = "https://acme.com/cis-token-updated" + action_id = auth0_action.my_action.id + type = "custom_authentication_updated" +} +` + +func TestTokenExchangeProfile(t *testing.T) { + acctest.Test(t, resource.TestCase{ + Steps: []resource.TestStep{ + { + Config: acctest.ParseTestName(testTokenExchangeProfileCreate, t.Name()), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token"), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication"), + resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), + ), + }, + { + Config: acctest.ParseTestName(testTokenExchangeProfileUpdate, t.Name()), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-updated-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token-updated"), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication_updated"), + resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), + ), + }, + }, + }) +} diff --git a/internal/provider/provider.go b/internal/provider/provider.go index bdf77e03..36008276 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -1,6 +1,7 @@ package provider import ( + "github.com/auth0/terraform-provider-auth0/internal/auth0/tokenexchangeprofile" "os" "github.com/auth0/terraform-provider-auth0/internal/auth0/flow" @@ -145,6 +146,7 @@ func New() *schema.Provider { "auth0_self_service_profile": selfserviceprofile.NewResource(), "auth0_self_service_profile_custom_text": selfserviceprofile.NewCustomTextResource(), "auth0_tenant": tenant.NewResource(), + "auth0_token_exchange_profile": tokenexchangeprofile.NewResource(), "auth0_user": user.NewResource(), "auth0_user_permission": user.NewPermissionResource(), "auth0_user_permissions": user.NewPermissionsResource(), @@ -172,6 +174,7 @@ func New() *schema.Provider { "auth0_self_service_profile": selfserviceprofile.NewDataSource(), "auth0_signing_keys": signingkey.NewDataSource(), "auth0_tenant": tenant.NewDataSource(), + "auth0_token_exchange_profile": tokenexchangeprofile.NewDataSource(), "auth0_user": user.NewDataSource(), }, } From 383bb1a5a0ae13d76ac30e279ecf334559780d76 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Tue, 14 Jan 2025 10:59:48 +0530 Subject: [PATCH 02/15] Added docs and tests --- docs/data-sources/token_exchange_profile.md | 27 + docs/resources/prompt_custom_text.md | 2 +- docs/resources/token_exchange_profile.md | 30 + go.mod | 2 +- go.sum | 2 + internal/auth0/tokenexchangeprofile/expand.go | 4 +- .../auth0/tokenexchangeprofile/flatten.go | 4 +- .../auth0/tokenexchangeprofile/resource.go | 6 +- .../tokenexchangeprofile/resource_test.go | 40 +- internal/provider/provider.go | 3 +- .../recordings/TestTokenExchangeProfile.yaml | 669 ++++++++++++++++++ 11 files changed, 759 insertions(+), 30 deletions(-) create mode 100644 docs/data-sources/token_exchange_profile.md create mode 100644 docs/resources/token_exchange_profile.md create mode 100644 test/data/recordings/TestTokenExchangeProfile.yaml diff --git a/docs/data-sources/token_exchange_profile.md b/docs/data-sources/token_exchange_profile.md new file mode 100644 index 00000000..faa22ece --- /dev/null +++ b/docs/data-sources/token_exchange_profile.md @@ -0,0 +1,27 @@ +--- +page_title: "Data Source: auth0_token_exchange_profile" +description: |- + Data source to retrieve a specific Auth0 Token Exchange Profile by id +--- + +# Data Source: auth0_token_exchange_profile + +Data source to retrieve a specific Auth0 Token Exchange Profile by `id` + + + + +## Schema + +### Required + +- `id` (String) The id of the Token Exchange Profile + +### Read-Only + +- `action_id` (String) Unique identifier of the Action +- `name` (String) Name of the token exchange profile. +- `subject_token_type` (String) Type of the subject token +- `type` (String) Type of the token exchange profile + + diff --git a/docs/resources/prompt_custom_text.md b/docs/resources/prompt_custom_text.md index f444c923..a272409e 100644 --- a/docs/resources/prompt_custom_text.md +++ b/docs/resources/prompt_custom_text.md @@ -48,7 +48,7 @@ resource "auth0_prompt_custom_text" "example" { ### Required - `body` (String) JSON containing the custom texts. You can check the options for each prompt [here](https://auth0.com/docs/customize/universal-login-pages/customize-login-text-prompts#prompt-values). -- `language` (String) Language of the custom text. Options include: `ar`, `ar-EG`, `ar-SA`, `az`, `bg`, `bs`, `ca-ES`, `cs`, `cy`, `da`, `de`, `el`, `en`, `es`, `es-AR`, `es-MX`, `et`, `eu-ES`, `fa`, `fi`, `fr`, `fr-CA`, `fr-FR`, `gl-ES`, `he`, `hi`, `hr`, `hu`, `hy`, `id`, `is`, `it`, `ja`, `ko`, `lt`, `lv`, `ms`, `nb`, `nl`, `nn`, `no`, `pl`, `pt`, `pt-BR`, `pt-PT`, `ro`, `ru`, `sk`, `sl`, `sq`, `sr`, `sv`, `th`, `tl`, `tr`, `uk`, `ur`, `vi`, `zh-CN`, `zh-HK`, `zh-TW`. +- `language` (String) Language of the custom text. Options include: `am`, `ar`, `ar-EG`, `ar-SA`, `az`, `bg`, `bn`, `bs`, `ca-ES`, `cnr`, `cs`, `cy`, `da`, `de`, `el`, `en`, `en-CA`, `es`, `es-419`, `es-AR`, `es-MX`, `et`, `eu-ES`, `fa`, `fi`, `fr`, `fr-CA`, `fr-FR`, `gl-ES`, `gu`, `he`, `hi`, `hr`, `hu`, `hy`, `id`, `is`, `it`, `ja`, `ka`, `kk`, `kn`, `ko`, `lt`, `lv`, `mk`, `ml`, `mn`, `mr`, `ms`, `my`, `nb`, `nl`, `nn`, `no`, `pa`, `pl`, `pt`, `pt-BR`, `pt-PT`, `ro`, `ru`, `sk`, `sl`, `so`, `sq`, `sr`, `sv`, `sw`, `ta`, `te`, `th`, `tl`, `tr`, `uk`, `ur`, `vi`, `zgh`, `zh-CN`, `zh-HK`, `zh-TW`. - `prompt` (String) The term `prompt` is used to refer to a specific step in the login flow. Options include: `captcha`, `common`, `consent`, `custom-form`, `customized-consent`, `device-flow`, `email-otp-challenge`, `email-verification`, `invitation`, `login`, `login-email-verification`, `login-id`, `login-password`, `login-passwordless`, `logout`, `mfa`, `mfa-email`, `mfa-otp`, `mfa-phone`, `mfa-push`, `mfa-recovery-code`, `mfa-sms`, `mfa-voice`, `mfa-webauthn`, `organizations`, `passkeys`, `phone-identifier-challenge`, `phone-identifier-enrollment`, `reset-password`, `signup`, `signup-id`, `signup-password`, `status`. ### Read-Only diff --git a/docs/resources/token_exchange_profile.md b/docs/resources/token_exchange_profile.md new file mode 100644 index 00000000..c0c0ebc5 --- /dev/null +++ b/docs/resources/token_exchange_profile.md @@ -0,0 +1,30 @@ +--- +page_title: "Resource: auth0_token_exchange_profile" +description: |- + With this resource, you can manage Auth0 Custom Token Exchange Profiles +--- + +# Resource: auth0_token_exchange_profile + +With this resource, you can manage Auth0 Custom Token Exchange Profiles + + + + +## Schema + +### Required + +- `name` (String) Name of the token exchange profile. + +### Optional + +- `action_id` (String) Unique identifier of the Action +- `subject_token_type` (String) Type of the subject token +- `type` (String) Type of the token exchange profile + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/go.mod b/go.mod index 352f0eb6..76cb23a4 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.14.1-0.20250108170142-4f2eac533287 + github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae 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 diff --git a/go.sum b/go.sum index 16a0a518..d9c57e1f 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,8 @@ github.com/auth0/go-auth0 v1.13.0 h1:GA7WyGAzlKBQ2ctHcCZwVf0aiOvPd2PB3QagC5heQJg github.com/auth0/go-auth0 v1.13.0/go.mod h1:G3oPT7sWjmM4mHbn6qkMYEsxnwm/5PnSbo0kpPLSS0E= github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287 h1:/zugS0NrQ0JJD0JSf6iY3DT9nB8i1i27cGYcpzL/yAU= github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= +github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae h1:fwojeLnkOGp2ty90zp7EAWLpraUjoyUNHMyvUeqYVvU= +github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= 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= diff --git a/internal/auth0/tokenexchangeprofile/expand.go b/internal/auth0/tokenexchangeprofile/expand.go index cfb9ace1..ea9be6f5 100644 --- a/internal/auth0/tokenexchangeprofile/expand.go +++ b/internal/auth0/tokenexchangeprofile/expand.go @@ -2,15 +2,15 @@ package tokenexchangeprofile import ( "github.com/auth0/go-auth0/management" - "github.com/auth0/terraform-provider-auth0/internal/value" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/auth0/terraform-provider-auth0/internal/value" ) func expandTokenExchangeProfiles(data *schema.ResourceData) *management.TokenExchangeProfile { cfg := data.GetRawConfig() return &management.TokenExchangeProfile{ - Name: value.String(cfg.GetAttr("name")), SubjectTokenType: value.String(cfg.GetAttr("subject_token_type")), ActionID: value.String(cfg.GetAttr("action_id")), diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go index c7a27c8d..f6934a24 100644 --- a/internal/auth0/tokenexchangeprofile/flatten.go +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -12,8 +12,8 @@ func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), data.Set("action_id", tokenExchangeProfile.GetActionID()), data.Set("type", tokenExchangeProfile.GetType()), - //data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), - //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()), + //Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()),. ) return result.ErrorOrNil() } diff --git a/internal/auth0/tokenexchangeprofile/resource.go b/internal/auth0/tokenexchangeprofile/resource.go index b3357188..91d38159 100644 --- a/internal/auth0/tokenexchangeprofile/resource.go +++ b/internal/auth0/tokenexchangeprofile/resource.go @@ -2,10 +2,12 @@ package tokenexchangeprofile import ( "context" - "github.com/auth0/terraform-provider-auth0/internal/config" - internalError "github.com/auth0/terraform-provider-auth0/internal/error" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/auth0/terraform-provider-auth0/internal/config" + internalError "github.com/auth0/terraform-provider-auth0/internal/error" ) // NewResource will return a new auth0_token_exchange_profile resource. diff --git a/internal/auth0/tokenexchangeprofile/resource_test.go b/internal/auth0/tokenexchangeprofile/resource_test.go index cf5f13d1..23c123e3 100644 --- a/internal/auth0/tokenexchangeprofile/resource_test.go +++ b/internal/auth0/tokenexchangeprofile/resource_test.go @@ -9,41 +9,37 @@ import ( "github.com/auth0/terraform-provider-auth0/internal/acctest" ) -const testTokenExchangeProfileCreate = ` +const givenACustomTokenAction = ` resource "auth0_action" "my_action" { - name = "Test Action {{.testName}}2" - code = "exports.onExecutePostLogin = async (event, api) => {};" + name = "{{.testName}}-Action" + code = <<-EOT + exports.onContinuePostLogin = async (event, api) => { + console.log("foo") + };" + EOT deploy = true supported_triggers { id = "custom-token-exchange" version = "v1" } } +` +const testTokenExchangeProfileCreate = givenACustomTokenAction + ` resource "auth0_token_exchange_profile" "my_token_exchange_profile" { - name = "my-token-exc-profile-{{.testName}}" + name = "token-prof-{{.testName}}" subject_token_type = "https://acme.com/cis-token" action_id = auth0_action.my_action.id type = "custom_authentication" } ` -const testTokenExchangeProfileUpdate = ` -resource "auth0_action" "my_action" { - name = "Test Action {{.testName}}2" - code = "exports.onExecutePostLogin = async (event, api) => {};" - deploy = true - supported_triggers { - id = "custom-token-exchange" - version = "v1" - } -} - +const testTokenExchangeProfileUpdate = givenACustomTokenAction + ` resource "auth0_token_exchange_profile" "my_token_exchange_profile" { - name = "my-token-exc-profile-updated-{{.testName}}" + name = "token-prof-updated-{{.testName}}" subject_token_type = "https://acme.com/cis-token-updated" action_id = auth0_action.my_action.id - type = "custom_authentication_updated" + type = "custom_authentication" } ` @@ -53,7 +49,7 @@ func TestTokenExchangeProfile(t *testing.T) { { Config: acctest.ParseTestName(testTokenExchangeProfileCreate, t.Name()), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("token-prof-%s", t.Name())), resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token"), resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication"), resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), @@ -62,12 +58,14 @@ func TestTokenExchangeProfile(t *testing.T) { { Config: acctest.ParseTestName(testTokenExchangeProfileUpdate, t.Name()), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-updated-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("token-prof-updated-%s", t.Name())), resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token-updated"), - resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication_updated"), - resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), ), }, + { + Config: acctest.ParseTestName(givenACustomTokenAction, t.Name()), + Check: resource.ComposeTestCheckFunc(), + }, }, }) } diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 36008276..c2c2ad41 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -1,9 +1,10 @@ package provider import ( - "github.com/auth0/terraform-provider-auth0/internal/auth0/tokenexchangeprofile" "os" + "github.com/auth0/terraform-provider-auth0/internal/auth0/tokenexchangeprofile" + "github.com/auth0/terraform-provider-auth0/internal/auth0/flow" "github.com/auth0/terraform-provider-auth0/internal/auth0/form" diff --git a/test/data/recordings/TestTokenExchangeProfile.yaml b/test/data/recordings/TestTokenExchangeProfile.yaml new file mode 100644 index 00000000..8e1d5531 --- /dev/null +++ b/test/data/recordings/TestTokenExchangeProfile.yaml @@ -0,0 +1,669 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 212 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"code":"exports.onContinuePostLogin = async (event, api) =\u003e {\n\tconsole.log(\"foo\")\n};\"\n"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 440 + uncompressed: false + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"pending","secrets":[],"all_changes_deployed":false}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 561.103041ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"all_changes_deployed":false}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 453.606917ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9/deploy + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":false,"number":1,"secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.209994271Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"action":{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.306206699Z","all_changes_deployed":false}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 432.771667ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 534.94125ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 179 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"token-prof-TestTokenExchangeProfile","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","type":"custom_authentication"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 286 + uncompressed: false + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 520.827417ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 898.574334ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 4.57392525s + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 8.232612209s + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 11.129542792s + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 9.708631458s + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 113 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"token-prof-updated-TestTokenExchangeProfile","subject_token_type":"https://acme.com/cis-token-updated"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 14.223590709s + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 3.980879709s + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 392.2905ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 372.625ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 490.825ms + - id: 15 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 805.614375ms + - id: 16 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: {} + status: 204 No Content + code: 204 + duration: 613.353916ms + - id: 17 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 531.859917ms + - id: 18 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 431.613375ms From c168164144dacee18e5f306390a2c975b63b3a63 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Tue, 14 Jan 2025 11:13:37 +0530 Subject: [PATCH 03/15] Added lint --- internal/auth0/tokenexchangeprofile/flatten.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go index f6934a24..69d918fb 100644 --- a/internal/auth0/tokenexchangeprofile/flatten.go +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -12,7 +12,7 @@ func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), data.Set("action_id", tokenExchangeProfile.GetActionID()), data.Set("type", tokenExchangeProfile.GetType()), - //Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + // Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()),. ) return result.ErrorOrNil() From e67f1a2588876c64b2c2a45cbf5693c1e1ab3085 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Tue, 14 Jan 2025 11:26:55 +0530 Subject: [PATCH 04/15] fixed linitng --- internal/auth0/tokenexchangeprofile/flatten.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go index 69d918fb..fa293c7f 100644 --- a/internal/auth0/tokenexchangeprofile/flatten.go +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -12,8 +12,8 @@ func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), data.Set("action_id", tokenExchangeProfile.GetActionID()), data.Set("type", tokenExchangeProfile.GetType()), - // Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), - //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()),. + data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()), ) return result.ErrorOrNil() } From aec7eae162630d441cf0a7e597f1cfe17bdf6214 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 10 Jan 2025 11:22:38 +0530 Subject: [PATCH 05/15] v1 --- go.mod | 2 +- go.sum | 4 +- .../auth0/tokenexchangeprofile/data_source.go | 43 +++++++++ .../tokenexchangeprofile/data_source_test.go | 1 + internal/auth0/tokenexchangeprofile/expand.go | 19 ++++ .../auth0/tokenexchangeprofile/flatten.go | 19 ++++ .../auth0/tokenexchangeprofile/resource.go | 93 +++++++++++++++++++ .../tokenexchangeprofile/resource_test.go | 73 +++++++++++++++ internal/provider/provider.go | 3 + 9 files changed, 254 insertions(+), 3 deletions(-) create mode 100644 internal/auth0/tokenexchangeprofile/data_source.go create mode 100644 internal/auth0/tokenexchangeprofile/data_source_test.go create mode 100644 internal/auth0/tokenexchangeprofile/expand.go create mode 100644 internal/auth0/tokenexchangeprofile/flatten.go create mode 100644 internal/auth0/tokenexchangeprofile/resource.go create mode 100644 internal/auth0/tokenexchangeprofile/resource_test.go diff --git a/go.mod b/go.mod index 6d25d3c9..352f0eb6 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.14.0 + github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287 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 diff --git a/go.sum b/go.sum index aa13d892..82a6a010 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.14.0 h1:T/wQGIwXylf1DnrDtDEuo/92YBnRizRcw15zXb+e3k4= -github.com/auth0/go-auth0 v1.14.0/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= +github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287 h1:/zugS0NrQ0JJD0JSf6iY3DT9nB8i1i27cGYcpzL/yAU= +github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= 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= diff --git a/internal/auth0/tokenexchangeprofile/data_source.go b/internal/auth0/tokenexchangeprofile/data_source.go new file mode 100644 index 00000000..7b40b935 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/data_source.go @@ -0,0 +1,43 @@ +package tokenexchangeprofile + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/auth0/terraform-provider-auth0/internal/config" + internalSchema "github.com/auth0/terraform-provider-auth0/internal/schema" +) + +// NewDataSource will return a new auth0_token_exchange_profile data source. +func NewDataSource() *schema.Resource { + return &schema.Resource{ + ReadContext: readTokenExchangeProfileForDataSource, + Description: "Data source to retrieve a specific Auth0 Token Exchange Profile by `id`", + Schema: dataSourceSchema(), + } +} + +func dataSourceSchema() map[string]*schema.Schema { + dataSourceSchema := internalSchema.TransformResourceToDataSource(NewResource().Schema) + dataSourceSchema["id"] = &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The ID of the Self Service Profile.", + } + dataSourceSchema["id"].Description = "The id of the Token Exchange Profile " + return dataSourceSchema +} + +func readTokenExchangeProfileForDataSource(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + id := data.Get("id").(string) + data.SetId(id) + ssp, err := api.TokenExchangeProfile.Read(ctx, data.Id()) + if err != nil { + return diag.FromErr(err) + } + err = flattenTokenExchangeProfile(data, ssp) + return diag.FromErr(err) +} diff --git a/internal/auth0/tokenexchangeprofile/data_source_test.go b/internal/auth0/tokenexchangeprofile/data_source_test.go new file mode 100644 index 00000000..d12e0750 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/data_source_test.go @@ -0,0 +1 @@ +package tokenexchangeprofile diff --git a/internal/auth0/tokenexchangeprofile/expand.go b/internal/auth0/tokenexchangeprofile/expand.go new file mode 100644 index 00000000..cfb9ace1 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/expand.go @@ -0,0 +1,19 @@ +package tokenexchangeprofile + +import ( + "github.com/auth0/go-auth0/management" + "github.com/auth0/terraform-provider-auth0/internal/value" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func expandTokenExchangeProfiles(data *schema.ResourceData) *management.TokenExchangeProfile { + cfg := data.GetRawConfig() + + return &management.TokenExchangeProfile{ + + Name: value.String(cfg.GetAttr("name")), + SubjectTokenType: value.String(cfg.GetAttr("subject_token_type")), + ActionID: value.String(cfg.GetAttr("action_id")), + Type: value.String(cfg.GetAttr("type")), + } +} diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go new file mode 100644 index 00000000..c7a27c8d --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -0,0 +1,19 @@ +package tokenexchangeprofile + +import ( + "github.com/auth0/go-auth0/management" + "github.com/hashicorp/go-multierror" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile *management.TokenExchangeProfile) error { + result := multierror.Append( + data.Set("name", tokenExchangeProfile.Name), + data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), + data.Set("action_id", tokenExchangeProfile.GetActionID()), + data.Set("type", tokenExchangeProfile.GetType()), + //data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()), + ) + return result.ErrorOrNil() +} diff --git a/internal/auth0/tokenexchangeprofile/resource.go b/internal/auth0/tokenexchangeprofile/resource.go new file mode 100644 index 00000000..b3357188 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/resource.go @@ -0,0 +1,93 @@ +package tokenexchangeprofile + +import ( + "context" + "github.com/auth0/terraform-provider-auth0/internal/config" + internalError "github.com/auth0/terraform-provider-auth0/internal/error" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +// NewResource will return a new auth0_token_exchange_profile resource. +func NewResource() *schema.Resource { + return &schema.Resource{ + CreateContext: createTokenExchangeProfile, + ReadContext: readTokenExchangeProfile, + UpdateContext: updateTokenExchangeProfile, + DeleteContext: deleteTokenExchangeProfile, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, + Description: "With this resource, you can manage Auth0 Custom Token Exchange Profiles", + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + Description: "Name of the token exchange profile.", + }, + "subject_token_type": { + Type: schema.TypeString, + Optional: true, + Description: "Type of the subject token", + }, + "action_id": { + Type: schema.TypeString, + Optional: true, + Description: "Unique identifier of the Action", + }, + "type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Type of the token exchange profile", + }, + }, + } +} + +func createTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + tep := expandTokenExchangeProfiles(data) + + if err := api.TokenExchangeProfile.Create(ctx, tep); err != nil { + return diag.FromErr(err) + } + + data.SetId(tep.GetID()) + + return readTokenExchangeProfile(ctx, data, meta) +} + +func readTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + ssp, err := api.TokenExchangeProfile.Read(ctx, data.Id()) + if err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return diag.FromErr(flattenTokenExchangeProfile(data, ssp)) +} + +func updateTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + tep := expandTokenExchangeProfiles(data) + + if err := api.TokenExchangeProfile.Update(ctx, data.Id(), tep); err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return readTokenExchangeProfile(ctx, data, meta) +} + +func deleteTokenExchangeProfile(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { + api := meta.(*config.Config).GetAPI() + + if err := api.TokenExchangeProfile.Delete(ctx, data.Id()); err != nil { + return diag.FromErr(internalError.HandleAPIError(data, err)) + } + + return nil +} diff --git a/internal/auth0/tokenexchangeprofile/resource_test.go b/internal/auth0/tokenexchangeprofile/resource_test.go new file mode 100644 index 00000000..cf5f13d1 --- /dev/null +++ b/internal/auth0/tokenexchangeprofile/resource_test.go @@ -0,0 +1,73 @@ +package tokenexchangeprofile_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/auth0/terraform-provider-auth0/internal/acctest" +) + +const testTokenExchangeProfileCreate = ` +resource "auth0_action" "my_action" { + name = "Test Action {{.testName}}2" + code = "exports.onExecutePostLogin = async (event, api) => {};" + deploy = true + supported_triggers { + id = "custom-token-exchange" + version = "v1" + } +} + +resource "auth0_token_exchange_profile" "my_token_exchange_profile" { + name = "my-token-exc-profile-{{.testName}}" + subject_token_type = "https://acme.com/cis-token" + action_id = auth0_action.my_action.id + type = "custom_authentication" +} +` + +const testTokenExchangeProfileUpdate = ` +resource "auth0_action" "my_action" { + name = "Test Action {{.testName}}2" + code = "exports.onExecutePostLogin = async (event, api) => {};" + deploy = true + supported_triggers { + id = "custom-token-exchange" + version = "v1" + } +} + +resource "auth0_token_exchange_profile" "my_token_exchange_profile" { + name = "my-token-exc-profile-updated-{{.testName}}" + subject_token_type = "https://acme.com/cis-token-updated" + action_id = auth0_action.my_action.id + type = "custom_authentication_updated" +} +` + +func TestTokenExchangeProfile(t *testing.T) { + acctest.Test(t, resource.TestCase{ + Steps: []resource.TestStep{ + { + Config: acctest.ParseTestName(testTokenExchangeProfileCreate, t.Name()), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token"), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication"), + resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), + ), + }, + { + Config: acctest.ParseTestName(testTokenExchangeProfileUpdate, t.Name()), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-updated-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token-updated"), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication_updated"), + resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), + ), + }, + }, + }) +} diff --git a/internal/provider/provider.go b/internal/provider/provider.go index bdf77e03..36008276 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -1,6 +1,7 @@ package provider import ( + "github.com/auth0/terraform-provider-auth0/internal/auth0/tokenexchangeprofile" "os" "github.com/auth0/terraform-provider-auth0/internal/auth0/flow" @@ -145,6 +146,7 @@ func New() *schema.Provider { "auth0_self_service_profile": selfserviceprofile.NewResource(), "auth0_self_service_profile_custom_text": selfserviceprofile.NewCustomTextResource(), "auth0_tenant": tenant.NewResource(), + "auth0_token_exchange_profile": tokenexchangeprofile.NewResource(), "auth0_user": user.NewResource(), "auth0_user_permission": user.NewPermissionResource(), "auth0_user_permissions": user.NewPermissionsResource(), @@ -172,6 +174,7 @@ func New() *schema.Provider { "auth0_self_service_profile": selfserviceprofile.NewDataSource(), "auth0_signing_keys": signingkey.NewDataSource(), "auth0_tenant": tenant.NewDataSource(), + "auth0_token_exchange_profile": tokenexchangeprofile.NewDataSource(), "auth0_user": user.NewDataSource(), }, } From 32e2a63ffb6c07c380c4f5a087ad7c58dc2730a3 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Tue, 14 Jan 2025 10:59:48 +0530 Subject: [PATCH 06/15] Added docs and tests --- docs/data-sources/token_exchange_profile.md | 27 + docs/resources/token_exchange_profile.md | 30 + go.mod | 2 +- go.sum | 2 + internal/auth0/tokenexchangeprofile/expand.go | 4 +- .../auth0/tokenexchangeprofile/flatten.go | 4 +- .../auth0/tokenexchangeprofile/resource.go | 6 +- .../tokenexchangeprofile/resource_test.go | 40 +- internal/provider/provider.go | 3 +- .../recordings/TestTokenExchangeProfile.yaml | 669 ++++++++++++++++++ 10 files changed, 758 insertions(+), 29 deletions(-) create mode 100644 docs/data-sources/token_exchange_profile.md create mode 100644 docs/resources/token_exchange_profile.md create mode 100644 test/data/recordings/TestTokenExchangeProfile.yaml diff --git a/docs/data-sources/token_exchange_profile.md b/docs/data-sources/token_exchange_profile.md new file mode 100644 index 00000000..faa22ece --- /dev/null +++ b/docs/data-sources/token_exchange_profile.md @@ -0,0 +1,27 @@ +--- +page_title: "Data Source: auth0_token_exchange_profile" +description: |- + Data source to retrieve a specific Auth0 Token Exchange Profile by id +--- + +# Data Source: auth0_token_exchange_profile + +Data source to retrieve a specific Auth0 Token Exchange Profile by `id` + + + + +## Schema + +### Required + +- `id` (String) The id of the Token Exchange Profile + +### Read-Only + +- `action_id` (String) Unique identifier of the Action +- `name` (String) Name of the token exchange profile. +- `subject_token_type` (String) Type of the subject token +- `type` (String) Type of the token exchange profile + + diff --git a/docs/resources/token_exchange_profile.md b/docs/resources/token_exchange_profile.md new file mode 100644 index 00000000..c0c0ebc5 --- /dev/null +++ b/docs/resources/token_exchange_profile.md @@ -0,0 +1,30 @@ +--- +page_title: "Resource: auth0_token_exchange_profile" +description: |- + With this resource, you can manage Auth0 Custom Token Exchange Profiles +--- + +# Resource: auth0_token_exchange_profile + +With this resource, you can manage Auth0 Custom Token Exchange Profiles + + + + +## Schema + +### Required + +- `name` (String) Name of the token exchange profile. + +### Optional + +- `action_id` (String) Unique identifier of the Action +- `subject_token_type` (String) Type of the subject token +- `type` (String) Type of the token exchange profile + +### Read-Only + +- `id` (String) The ID of this resource. + + diff --git a/go.mod b/go.mod index 352f0eb6..76cb23a4 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.14.1-0.20250108170142-4f2eac533287 + github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae 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 diff --git a/go.sum b/go.sum index 82a6a010..8f6acd9c 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ 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.14.1-0.20250108170142-4f2eac533287 h1:/zugS0NrQ0JJD0JSf6iY3DT9nB8i1i27cGYcpzL/yAU= github.com/auth0/go-auth0 v1.14.1-0.20250108170142-4f2eac533287/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= +github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae h1:fwojeLnkOGp2ty90zp7EAWLpraUjoyUNHMyvUeqYVvU= +github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= 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= diff --git a/internal/auth0/tokenexchangeprofile/expand.go b/internal/auth0/tokenexchangeprofile/expand.go index cfb9ace1..ea9be6f5 100644 --- a/internal/auth0/tokenexchangeprofile/expand.go +++ b/internal/auth0/tokenexchangeprofile/expand.go @@ -2,15 +2,15 @@ package tokenexchangeprofile import ( "github.com/auth0/go-auth0/management" - "github.com/auth0/terraform-provider-auth0/internal/value" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/auth0/terraform-provider-auth0/internal/value" ) func expandTokenExchangeProfiles(data *schema.ResourceData) *management.TokenExchangeProfile { cfg := data.GetRawConfig() return &management.TokenExchangeProfile{ - Name: value.String(cfg.GetAttr("name")), SubjectTokenType: value.String(cfg.GetAttr("subject_token_type")), ActionID: value.String(cfg.GetAttr("action_id")), diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go index c7a27c8d..f6934a24 100644 --- a/internal/auth0/tokenexchangeprofile/flatten.go +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -12,8 +12,8 @@ func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), data.Set("action_id", tokenExchangeProfile.GetActionID()), data.Set("type", tokenExchangeProfile.GetType()), - //data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), - //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()), + //Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()),. ) return result.ErrorOrNil() } diff --git a/internal/auth0/tokenexchangeprofile/resource.go b/internal/auth0/tokenexchangeprofile/resource.go index b3357188..91d38159 100644 --- a/internal/auth0/tokenexchangeprofile/resource.go +++ b/internal/auth0/tokenexchangeprofile/resource.go @@ -2,10 +2,12 @@ package tokenexchangeprofile import ( "context" - "github.com/auth0/terraform-provider-auth0/internal/config" - internalError "github.com/auth0/terraform-provider-auth0/internal/error" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/auth0/terraform-provider-auth0/internal/config" + internalError "github.com/auth0/terraform-provider-auth0/internal/error" ) // NewResource will return a new auth0_token_exchange_profile resource. diff --git a/internal/auth0/tokenexchangeprofile/resource_test.go b/internal/auth0/tokenexchangeprofile/resource_test.go index cf5f13d1..23c123e3 100644 --- a/internal/auth0/tokenexchangeprofile/resource_test.go +++ b/internal/auth0/tokenexchangeprofile/resource_test.go @@ -9,41 +9,37 @@ import ( "github.com/auth0/terraform-provider-auth0/internal/acctest" ) -const testTokenExchangeProfileCreate = ` +const givenACustomTokenAction = ` resource "auth0_action" "my_action" { - name = "Test Action {{.testName}}2" - code = "exports.onExecutePostLogin = async (event, api) => {};" + name = "{{.testName}}-Action" + code = <<-EOT + exports.onContinuePostLogin = async (event, api) => { + console.log("foo") + };" + EOT deploy = true supported_triggers { id = "custom-token-exchange" version = "v1" } } +` +const testTokenExchangeProfileCreate = givenACustomTokenAction + ` resource "auth0_token_exchange_profile" "my_token_exchange_profile" { - name = "my-token-exc-profile-{{.testName}}" + name = "token-prof-{{.testName}}" subject_token_type = "https://acme.com/cis-token" action_id = auth0_action.my_action.id type = "custom_authentication" } ` -const testTokenExchangeProfileUpdate = ` -resource "auth0_action" "my_action" { - name = "Test Action {{.testName}}2" - code = "exports.onExecutePostLogin = async (event, api) => {};" - deploy = true - supported_triggers { - id = "custom-token-exchange" - version = "v1" - } -} - +const testTokenExchangeProfileUpdate = givenACustomTokenAction + ` resource "auth0_token_exchange_profile" "my_token_exchange_profile" { - name = "my-token-exc-profile-updated-{{.testName}}" + name = "token-prof-updated-{{.testName}}" subject_token_type = "https://acme.com/cis-token-updated" action_id = auth0_action.my_action.id - type = "custom_authentication_updated" + type = "custom_authentication" } ` @@ -53,7 +49,7 @@ func TestTokenExchangeProfile(t *testing.T) { { Config: acctest.ParseTestName(testTokenExchangeProfileCreate, t.Name()), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("token-prof-%s", t.Name())), resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token"), resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication"), resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), @@ -62,12 +58,14 @@ func TestTokenExchangeProfile(t *testing.T) { { Config: acctest.ParseTestName(testTokenExchangeProfileUpdate, t.Name()), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("my-token-exc-profile-updated-%s2", t.Name())), + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "name", fmt.Sprintf("token-prof-updated-%s", t.Name())), resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "subject_token_type", "https://acme.com/cis-token-updated"), - resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "type", "custom_authentication_updated"), - resource.TestCheckResourceAttrSet("auth0_token_exchange_profile.my_token_exchange_profile", "action_id"), ), }, + { + Config: acctest.ParseTestName(givenACustomTokenAction, t.Name()), + Check: resource.ComposeTestCheckFunc(), + }, }, }) } diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 36008276..c2c2ad41 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -1,9 +1,10 @@ package provider import ( - "github.com/auth0/terraform-provider-auth0/internal/auth0/tokenexchangeprofile" "os" + "github.com/auth0/terraform-provider-auth0/internal/auth0/tokenexchangeprofile" + "github.com/auth0/terraform-provider-auth0/internal/auth0/flow" "github.com/auth0/terraform-provider-auth0/internal/auth0/form" diff --git a/test/data/recordings/TestTokenExchangeProfile.yaml b/test/data/recordings/TestTokenExchangeProfile.yaml new file mode 100644 index 00000000..8e1d5531 --- /dev/null +++ b/test/data/recordings/TestTokenExchangeProfile.yaml @@ -0,0 +1,669 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 212 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"code":"exports.onContinuePostLogin = async (event, api) =\u003e {\n\tconsole.log(\"foo\")\n};\"\n"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 440 + uncompressed: false + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"pending","secrets":[],"all_changes_deployed":false}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 561.103041ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"all_changes_deployed":false}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 453.606917ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9/deploy + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":false,"number":1,"secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.209994271Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"action":{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.306206699Z","all_changes_deployed":false}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 432.771667ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 534.94125ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 179 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"token-prof-TestTokenExchangeProfile","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","type":"custom_authentication"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 286 + uncompressed: false + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 520.827417ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 898.574334ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 4.57392525s + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 8.232612209s + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 11.129542792s + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 9.708631458s + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 113 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"token-prof-updated-TestTokenExchangeProfile","subject_token_type":"https://acme.com/cis-token-updated"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: PATCH + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 14.223590709s + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 3.980879709s + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 392.2905ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 372.625ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 490.825ms + - id: 15 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 805.614375ms + - id: 16 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: {} + status: 204 No Content + code: 204 + duration: 613.353916ms + - id: 17 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 531.859917ms + - id: 18 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.14.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 431.613375ms From 7213bf62b90da3fd6de35737b4168330d5af08b9 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Tue, 14 Jan 2025 11:13:37 +0530 Subject: [PATCH 07/15] Added lint --- internal/auth0/tokenexchangeprofile/flatten.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go index f6934a24..69d918fb 100644 --- a/internal/auth0/tokenexchangeprofile/flatten.go +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -12,7 +12,7 @@ func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), data.Set("action_id", tokenExchangeProfile.GetActionID()), data.Set("type", tokenExchangeProfile.GetType()), - //Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + // Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()),. ) return result.ErrorOrNil() From ffd9d057e4fb70604939cc5375d09ec2027e0829 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Tue, 14 Jan 2025 11:26:55 +0530 Subject: [PATCH 08/15] fixed linitng --- internal/auth0/tokenexchangeprofile/flatten.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go index 69d918fb..fa293c7f 100644 --- a/internal/auth0/tokenexchangeprofile/flatten.go +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -12,8 +12,8 @@ func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), data.Set("action_id", tokenExchangeProfile.GetActionID()), data.Set("type", tokenExchangeProfile.GetType()), - // Data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), - //data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()),. + data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), + data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()), ) return result.ErrorOrNil() } From 49571f7c03dfe1b7e8fd3ebf0752ac82d896fed6 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 17 Jan 2025 04:04:55 +0530 Subject: [PATCH 09/15] update go.sum --- go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.sum b/go.sum index aa13d892..59cbe602 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ 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.14.0 h1:T/wQGIwXylf1DnrDtDEuo/92YBnRizRcw15zXb+e3k4= github.com/auth0/go-auth0 v1.14.0/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= +github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae h1:fwojeLnkOGp2ty90zp7EAWLpraUjoyUNHMyvUeqYVvU= +github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= 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= From 935f20f9fff6a6d47f6c4293225b14b836aceef9 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Fri, 17 Jan 2025 11:29:54 +0530 Subject: [PATCH 10/15] updated schema --- docs/data-sources/token_exchange_profile.md | 2 + docs/resources/token_exchange_profile.md | 2 + go.mod | 2 +- go.sum | 4 + .../auth0/tokenexchangeprofile/flatten.go | 8 +- .../auth0/tokenexchangeprofile/resource.go | 10 ++ .../recordings/TestTokenExchangeProfile.yaml | 108 +++++++++--------- 7 files changed, 77 insertions(+), 59 deletions(-) diff --git a/docs/data-sources/token_exchange_profile.md b/docs/data-sources/token_exchange_profile.md index faa22ece..a5a1d5d9 100644 --- a/docs/data-sources/token_exchange_profile.md +++ b/docs/data-sources/token_exchange_profile.md @@ -20,8 +20,10 @@ Data source to retrieve a specific Auth0 Token Exchange Profile by `id` ### Read-Only - `action_id` (String) Unique identifier of the Action +- `created_at` (String) The ISO 8601 formatted date the credential was created. - `name` (String) Name of the token exchange profile. - `subject_token_type` (String) Type of the subject token - `type` (String) Type of the token exchange profile +- `updated_at` (String) The ISO 8601 formatted date the credential was updated. diff --git a/docs/resources/token_exchange_profile.md b/docs/resources/token_exchange_profile.md index c0c0ebc5..b270e831 100644 --- a/docs/resources/token_exchange_profile.md +++ b/docs/resources/token_exchange_profile.md @@ -25,6 +25,8 @@ With this resource, you can manage Auth0 Custom Token Exchange Profiles ### Read-Only +- `created_at` (String) The ISO 8601 formatted date the credential was created. - `id` (String) The ID of this resource. +- `updated_at` (String) The ISO 8601 formatted date the credential was updated. diff --git a/go.mod b/go.mod index 76cb23a4..2193917a 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.14.1-0.20250113064852-20ae1831ccae + github.com/auth0/go-auth0 v1.14.1-0.20250117054610-a1e5b43bb00f 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 diff --git a/go.sum b/go.sum index 59cbe602..f688b08a 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,10 @@ github.com/auth0/go-auth0 v1.14.0 h1:T/wQGIwXylf1DnrDtDEuo/92YBnRizRcw15zXb+e3k4 github.com/auth0/go-auth0 v1.14.0/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae h1:fwojeLnkOGp2ty90zp7EAWLpraUjoyUNHMyvUeqYVvU= github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= +github.com/auth0/go-auth0 v1.14.1-0.20250113124145-16b8925bd444 h1:f7TS75W5/UzJ+8Z1bgqW5Rid8NbHiodPoWXXE8jLdVs= +github.com/auth0/go-auth0 v1.14.1-0.20250113124145-16b8925bd444/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= +github.com/auth0/go-auth0 v1.14.1-0.20250117054610-a1e5b43bb00f h1:b0E/GFcjVsdAStpZaqVlRHJzeWjSINRXVzr8dmTFfl0= +github.com/auth0/go-auth0 v1.14.1-0.20250117054610-a1e5b43bb00f/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= 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= diff --git a/internal/auth0/tokenexchangeprofile/flatten.go b/internal/auth0/tokenexchangeprofile/flatten.go index fa293c7f..b823267d 100644 --- a/internal/auth0/tokenexchangeprofile/flatten.go +++ b/internal/auth0/tokenexchangeprofile/flatten.go @@ -8,12 +8,12 @@ import ( func flattenTokenExchangeProfile(data *schema.ResourceData, tokenExchangeProfile *management.TokenExchangeProfile) error { result := multierror.Append( - data.Set("name", tokenExchangeProfile.Name), - data.Set("subject_token_type", tokenExchangeProfile.SubjectTokenType), + data.Set("name", tokenExchangeProfile.GetName()), + data.Set("subject_token_type", tokenExchangeProfile.GetSubjectTokenType()), data.Set("action_id", tokenExchangeProfile.GetActionID()), data.Set("type", tokenExchangeProfile.GetType()), - data.Set("created_at", tokenExchangeProfile.GetCreatedAt()), - data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt()), + data.Set("created_at", tokenExchangeProfile.GetCreatedAt().String()), + data.Set("updated_at", tokenExchangeProfile.GetUpdatedAt().String()), ) return result.ErrorOrNil() } diff --git a/internal/auth0/tokenexchangeprofile/resource.go b/internal/auth0/tokenexchangeprofile/resource.go index 91d38159..4170f555 100644 --- a/internal/auth0/tokenexchangeprofile/resource.go +++ b/internal/auth0/tokenexchangeprofile/resource.go @@ -43,6 +43,16 @@ func NewResource() *schema.Resource { Computed: true, Description: "Type of the token exchange profile", }, + "created_at": { + Type: schema.TypeString, + Computed: true, + Description: "The ISO 8601 formatted date the credential was created.", + }, + "updated_at": { + Type: schema.TypeString, + Computed: true, + Description: "The ISO 8601 formatted date the credential was updated.", + }, }, } } diff --git a/test/data/recordings/TestTokenExchangeProfile.yaml b/test/data/recordings/TestTokenExchangeProfile.yaml index 8e1d5531..3eb9a220 100644 --- a/test/data/recordings/TestTokenExchangeProfile.yaml +++ b/test/data/recordings/TestTokenExchangeProfile.yaml @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: 440 uncompressed: false - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"pending","secrets":[],"all_changes_deployed":false}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"pending","secrets":[],"all_changes_deployed":false}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 561.103041ms + duration: 422.972542ms - id: 1 request: proto: HTTP/1.1 @@ -55,7 +55,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: GET response: proto: HTTP/2.0 @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"all_changes_deployed":false}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"all_changes_deployed":false}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 453.606917ms + duration: 389.946458ms - id: 2 request: proto: HTTP/1.1 @@ -90,7 +90,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9/deploy + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a/deploy method: POST response: proto: HTTP/2.0 @@ -100,13 +100,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":false,"number":1,"secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.209994271Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"action":{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.306206699Z","all_changes_deployed":false}}' + body: '{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","deployed":false,"number":1,"secrets":[],"status":"built","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.620126381Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"action":{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.834222847Z","all_changes_deployed":false}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 432.771667ms + duration: 367.785375ms - id: 3 request: proto: HTTP/1.1 @@ -125,7 +125,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: GET response: proto: HTTP/2.0 @@ -135,13 +135,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-17T05:58:41.684775435Z","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","deployed":true,"number":1,"built_at":"2025-01-17T05:58:41.684775435Z","secrets":[],"status":"built","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 534.94125ms + duration: 432.299459ms - id: 4 request: proto: HTTP/1.1 @@ -154,7 +154,7 @@ interactions: remote_addr: "" request_uri: "" body: | - {"name":"token-prof-TestTokenExchangeProfile","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","type":"custom_authentication"} + {"name":"token-prof-TestTokenExchangeProfile","subject_token_type":"https://acme.com/cis-token","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","type":"custom_authentication"} form: {} headers: Content-Type: @@ -171,13 +171,13 @@ interactions: trailer: {} content_length: 286 uncompressed: false - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:42.538Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 520.827417ms + duration: 513.814583ms - id: 5 request: proto: HTTP/1.1 @@ -196,7 +196,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: GET response: proto: HTTP/2.0 @@ -206,13 +206,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:42.538Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 898.574334ms + duration: 940.887959ms - id: 6 request: proto: HTTP/1.1 @@ -231,7 +231,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: GET response: proto: HTTP/2.0 @@ -241,13 +241,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-17T05:58:41.684775435Z","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","deployed":true,"number":1,"built_at":"2025-01-17T05:58:41.684775435Z","secrets":[],"status":"built","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 4.57392525s + duration: 366.128875ms - id: 7 request: proto: HTTP/1.1 @@ -266,7 +266,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: GET response: proto: HTTP/2.0 @@ -276,13 +276,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:42.538Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 8.232612209s + duration: 391.121167ms - id: 8 request: proto: HTTP/1.1 @@ -301,7 +301,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: GET response: proto: HTTP/2.0 @@ -311,13 +311,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-17T05:58:41.684775435Z","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","deployed":true,"number":1,"built_at":"2025-01-17T05:58:41.684775435Z","secrets":[],"status":"built","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 11.129542792s + duration: 373.245166ms - id: 9 request: proto: HTTP/1.1 @@ -336,7 +336,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: GET response: proto: HTTP/2.0 @@ -346,13 +346,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:27:07.293Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:42.538Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 9.708631458s + duration: 373.132458ms - id: 10 request: proto: HTTP/1.1 @@ -372,7 +372,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: PATCH response: proto: HTTP/2.0 @@ -382,13 +382,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:47.327Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 14.223590709s + duration: 444.777791ms - id: 11 request: proto: HTTP/1.1 @@ -407,7 +407,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: GET response: proto: HTTP/2.0 @@ -417,13 +417,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:47.327Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 3.980879709s + duration: 402.488958ms - id: 12 request: proto: HTTP/1.1 @@ -442,7 +442,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: GET response: proto: HTTP/2.0 @@ -452,13 +452,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-17T05:58:41.684775435Z","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","deployed":true,"number":1,"built_at":"2025-01-17T05:58:41.684775435Z","secrets":[],"status":"built","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 392.2905ms + duration: 436.75275ms - id: 13 request: proto: HTTP/1.1 @@ -477,7 +477,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: GET response: proto: HTTP/2.0 @@ -487,13 +487,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:47.327Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 372.625ms + duration: 373.985166ms - id: 14 request: proto: HTTP/1.1 @@ -512,7 +512,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: GET response: proto: HTTP/2.0 @@ -522,13 +522,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"tep_R41PJ9ZEBILci7Qg","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"4beccbf5-9249-4adf-9695-ba37189efda9","created_at":"2025-01-14T05:27:07.293Z","updated_at":"2025-01-14T05:28:23.810Z"}' + body: '{"id":"tep_bdN9eWKnMqg1RecL","name":"token-prof-updated-TestTokenExchangeProfile","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token-updated","action_id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","created_at":"2025-01-17T05:58:42.538Z","updated_at":"2025-01-17T05:58:47.327Z"}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 490.825ms + duration: 408.98375ms - id: 15 request: proto: HTTP/1.1 @@ -547,7 +547,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: GET response: proto: HTTP/2.0 @@ -557,13 +557,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-17T05:58:41.684775435Z","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","deployed":true,"number":1,"built_at":"2025-01-17T05:58:41.684775435Z","secrets":[],"status":"built","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 805.614375ms + duration: 466.799333ms - id: 16 request: proto: HTTP/1.1 @@ -582,7 +582,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_R41PJ9ZEBILci7Qg + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_bdN9eWKnMqg1RecL method: DELETE response: proto: HTTP/2.0 @@ -596,7 +596,7 @@ interactions: headers: {} status: 204 No Content code: 204 - duration: 613.353916ms + duration: 508.932083ms - id: 17 request: proto: HTTP/1.1 @@ -615,7 +615,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: GET response: proto: HTTP/2.0 @@ -625,13 +625,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"id":"4beccbf5-9249-4adf-9695-ba37189efda9","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-14T05:27:05.306206699Z","updated_at":"2025-01-14T05:27:05.322694887Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"2c98c774-82c6-43c9-a30b-0300f7545898","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-14T05:27:06.276235315Z","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"2c98c774-82c6-43c9-a30b-0300f7545898","deployed":true,"number":1,"built_at":"2025-01-14T05:27:06.276235315Z","secrets":[],"status":"built","created_at":"2025-01-14T05:27:06.209994271Z","updated_at":"2025-01-14T05:27:06.277310988Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + body: '{"id":"0d3e5e29-1b33-4a06-8229-18b340a9117a","name":"TestTokenExchangeProfile-Action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-17T05:58:40.834222847Z","updated_at":"2025-01-17T05:58:40.852381951Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node18","status":"built","secrets":[],"current_version":{"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node18","status":"BUILT","number":1,"build_time":"2025-01-17T05:58:41.684775435Z","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"b96bb2d9-e67d-4d99-a0dd-d7a93a4c3e77","deployed":true,"number":1,"built_at":"2025-01-17T05:58:41.684775435Z","secrets":[],"status":"built","created_at":"2025-01-17T05:58:41.620126381Z","updated_at":"2025-01-17T05:58:41.686007224Z","runtime":"node18","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 531.859917ms + duration: 385.639333ms - id: 18 request: proto: HTTP/1.1 @@ -650,7 +650,7 @@ interactions: - application/json User-Agent: - Go-Auth0/1.14.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/4beccbf5-9249-4adf-9695-ba37189efda9 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/0d3e5e29-1b33-4a06-8229-18b340a9117a method: DELETE response: proto: HTTP/2.0 @@ -666,4 +666,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 431.613375ms + duration: 452.389208ms From 3035e2647172f03c0207c8e6a8dc108f3cb33b36 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Wed, 29 Jan 2025 11:57:02 +0530 Subject: [PATCH 11/15] Added node22 support + test cases --- go.mod | 2 +- go.sum | 2 + internal/auth0/action/resource.go | 3 +- internal/auth0/client/resource.go | 16 ++ internal/auth0/client/resource_test.go | 5 + test/data/recordings/TestAccClientMobile.yaml | 140 +++++++++--------- 6 files changed, 96 insertions(+), 72 deletions(-) diff --git a/go.mod b/go.mod index 542b1f9f..91e8a99d 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.14.1-0.20250117054610-a1e5b43bb00f + github.com/auth0/go-auth0 v1.15.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 diff --git a/go.sum b/go.sum index a72219bf..b23be802 100644 --- a/go.sum +++ b/go.sum @@ -32,6 +32,8 @@ github.com/auth0/go-auth0 v1.14.1-0.20250113124145-16b8925bd444 h1:f7TS75W5/UzJ+ github.com/auth0/go-auth0 v1.14.1-0.20250113124145-16b8925bd444/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= github.com/auth0/go-auth0 v1.14.1-0.20250117054610-a1e5b43bb00f h1:b0E/GFcjVsdAStpZaqVlRHJzeWjSINRXVzr8dmTFfl0= github.com/auth0/go-auth0 v1.14.1-0.20250117054610-a1e5b43bb00f/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= +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/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= diff --git a/internal/auth0/action/resource.go b/internal/auth0/action/resource.go index 60be2188..69ec412a 100644 --- a/internal/auth0/action/resource.go +++ b/internal/auth0/action/resource.go @@ -89,8 +89,9 @@ func NewResource() *schema.Resource { "node12", "node16", "node18", + "node22", }, false), - Description: "The Node runtime. Defaults to `node18`. Possible values are: `node16` (not recommended), or `node18` (recommended).", + Description: "The Node runtime. Possible values are: `node12`, `node16` (not recommended), `node18`, `node22`", }, "secrets": { Type: schema.TypeSet, diff --git a/internal/auth0/client/resource.go b/internal/auth0/client/resource.go index dceccd71..9e29fad2 100644 --- a/internal/auth0/client/resource.go +++ b/internal/auth0/client/resource.go @@ -1314,6 +1314,22 @@ func NewResource() *schema.Resource { }, }, }, + "token_exchange": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: "Allows configuration for token exchange", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "allow_any_profile_of_type": { + Required: true, + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "List of allowed profile types for token exchange", + }, + }, + }, + }, "compliance_level": { Type: schema.TypeString, Optional: true, diff --git a/internal/auth0/client/resource_test.go b/internal/auth0/client/resource_test.go index 1f83fd5d..5c153275 100644 --- a/internal/auth0/client/resource_test.go +++ b/internal/auth0/client/resource_test.go @@ -59,6 +59,10 @@ resource "auth0_client" "my_client" { name = "Acceptance Test - Mobile - {{.testName}}" app_type = "native" + token_exchange { + allow_any_profile_of_type = ["custom_authentication"] + } + mobile { android { app_package_name = "com.example" @@ -157,6 +161,7 @@ func TestAccClientMobile(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("auth0_client.my_client", "name", fmt.Sprintf("Acceptance Test - Mobile - %s", t.Name())), resource.TestCheckResourceAttr("auth0_client.my_client", "app_type", "native"), + resource.TestCheckResourceAttr("auth0_client.my_client", "token_exchange.0.allow_any_profile_of_type.0", "custom_authentication"), resource.TestCheckResourceAttr("auth0_client.my_client", "mobile.#", "1"), resource.TestCheckResourceAttr("auth0_client.my_client", "mobile.0.android.#", "1"), resource.TestCheckResourceAttr("auth0_client.my_client", "mobile.0.android.0.app_package_name", "com.example"), diff --git a/test/data/recordings/TestAccClientMobile.yaml b/test/data/recordings/TestAccClientMobile.yaml index e4d1c2ec..2b73a78c 100644 --- a/test/data/recordings/TestAccClientMobile.yaml +++ b/test/data/recordings/TestAccClientMobile.yaml @@ -6,20 +6,20 @@ interactions: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 365 + content_length: 382 transfer_encoding: [] trailer: {} host: terraform-provider-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"native","token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}}} + {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"native","token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"oidc_logout":{}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 + - Go-Auth0/1.15.0 url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients method: POST response: @@ -30,13 +30,13 @@ interactions: trailer: {} content_length: -1 uncompressed: false - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"oidc_backchannel_logout":{},"oidc_logout":{"backchannel_logout_initiators":{"mode":"custom","selected_initiators":["rp-logout","idp-logout"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 201 Created code: 201 - duration: 508.566958ms + duration: 467.127875ms - id: 1 request: proto: HTTP/1.1 @@ -54,8 +54,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -65,13 +65,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"oidc_backchannel_logout":{},"oidc_logout":{"backchannel_logout_initiators":{"mode":"custom","selected_initiators":["rp-logout","idp-logout"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 355.88175ms + duration: 351.042417ms - id: 2 request: proto: HTTP/1.1 @@ -89,8 +89,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -100,13 +100,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"oidc_backchannel_logout":{},"oidc_logout":{"backchannel_logout_initiators":{"mode":"custom","selected_initiators":["rp-logout","idp-logout"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 351.02ms + duration: 539.020958ms - id: 3 request: proto: HTTP/1.1 @@ -124,8 +124,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -135,33 +135,33 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF"]},"ios":{"team_id":"9JA89QQLNQ","app_bundle_identifier":"com.my.bundle.id"}},"native_social_login":{"apple":{"enabled":true},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000},"oidc_backchannel_logout":{},"oidc_logout":{"backchannel_logout_initiators":{"mode":"custom","selected_initiators":["rp-logout","idp-logout"]}}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 390.053125ms + duration: 468.57625ms - id: 4 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 346 + content_length: 363 transfer_encoding: [] trailer: {} host: terraform-provider-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"native","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}}} + {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"native","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"oidc_logout":{}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: PATCH response: proto: HTTP/2.0 @@ -171,13 +171,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 368.082208ms + duration: 361.8045ms - id: 5 request: proto: HTTP/1.1 @@ -195,8 +195,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -206,13 +206,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 353.976958ms + duration: 370.05825ms - id: 6 request: proto: HTTP/1.1 @@ -230,8 +230,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -241,13 +241,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 321.258541ms + duration: 381.755167ms - id: 7 request: proto: HTTP/1.1 @@ -265,8 +265,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -276,33 +276,33 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":true}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 324.901959ms + duration: 342.437167ms - id: 8 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 244 + content_length: 261 transfer_encoding: [] trailer: {} host: terraform-provider-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"native","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]}},"native_social_login":{"facebook":{"enabled":false}}} + {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"native","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]}},"native_social_login":{"facebook":{"enabled":false}},"oidc_logout":{}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: PATCH response: proto: HTTP/2.0 @@ -312,13 +312,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 337.834667ms + duration: 334.054958ms - id: 9 request: proto: HTTP/1.1 @@ -336,8 +336,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -347,13 +347,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 341.786541ms + duration: 882.332792ms - id: 10 request: proto: HTTP/1.1 @@ -371,8 +371,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -382,13 +382,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 333.759958ms + duration: 329.571834ms - id: 11 request: proto: HTTP/1.1 @@ -406,8 +406,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -417,33 +417,33 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"native","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 324.375917ms + duration: 468.295875ms - id: 12 request: proto: HTTP/1.1 proto_major: 1 proto_minor: 1 - content_length: 166 + content_length: 183 transfer_encoding: [] trailer: {} host: terraform-provider-auth0-dev.eu.auth0.com remote_addr: "" request_uri: "" body: | - {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"non_interactive","native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}}} + {"name":"Acceptance Test - Mobile - TestAccClientMobile","app_type":"non_interactive","native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"oidc_logout":{}} form: {} headers: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: PATCH response: proto: HTTP/2.0 @@ -453,13 +453,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"non_interactive","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"non_interactive","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 337.241625ms + duration: 357.563709ms - id: 13 request: proto: HTTP/1.1 @@ -477,8 +477,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -488,13 +488,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"non_interactive","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"non_interactive","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 326.523709ms + duration: 373.037166ms - id: 14 request: proto: HTTP/1.1 @@ -512,8 +512,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: GET response: proto: HTTP/2.0 @@ -523,13 +523,13 @@ interactions: trailer: {} content_length: -1 uncompressed: true - body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l","client_secret":"[REDACTED]","app_type":"non_interactive","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' + body: '{"name":"Acceptance Test - Mobile - TestAccClientMobile","client_id":"7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu","client_secret":"[REDACTED]","app_type":"non_interactive","is_first_party":true,"is_token_endpoint_ip_header_trusted":false,"oidc_conformant":false,"jwt_configuration":{"secret_encoded":false,"lifetime_in_seconds":36000},"signing_keys":[{"cert":"[REDACTED]"}],"sso_disabled":false,"cross_origin_authentication":false,"grant_types":["authorization_code","implicit","refresh_token"],"custom_login_page_on":true,"token_endpoint_auth_method":"none","mobile":{"android":{"app_package_name":"com.example","sha256_cert_fingerprints":["DE:AD:BE:EF","CA:DE:FF:AA"]},"ios":{"team_id":"1111111111","app_bundle_identifier":"com.my.auth0.bundle"}},"native_social_login":{"apple":{"enabled":false},"facebook":{"enabled":false}},"refresh_token":{"rotation_type":"non-rotating","expiration_type":"non-expiring","leeway":0,"token_lifetime":2592000,"infinite_token_lifetime":true,"infinite_idle_token_lifetime":true,"idle_token_lifetime":1296000}}' headers: Content-Type: - application/json; charset=utf-8 status: 200 OK code: 200 - duration: 325.09025ms + duration: 363.084458ms - id: 15 request: proto: HTTP/1.1 @@ -547,8 +547,8 @@ interactions: Content-Type: - application/json User-Agent: - - Go-Auth0/1.9.0 - url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/Kk8IaPGuwvzRSQ7Zf73XO4KGjH3gsQ5l + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/clients/7t1PS7dxCkLX8gFRvU5sYrRVUL5eUyfu method: DELETE response: proto: HTTP/2.0 @@ -564,4 +564,4 @@ interactions: - application/json; charset=utf-8 status: 204 No Content code: 204 - duration: 395.822958ms + duration: 433.958834ms From 6b660c18f2b6303de698afc8aee58081676de3ac Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Wed, 29 Jan 2025 12:02:29 +0530 Subject: [PATCH 12/15] Updated docs --- docs/data-sources/client.md | 10 ++++++++++ docs/data-sources/clients.md | 10 ++++++++++ docs/resources/action.md | 2 +- docs/resources/client.md | 9 +++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/data-sources/client.md b/docs/data-sources/client.md index 11e65f01..99794ff5 100644 --- a/docs/data-sources/client.md +++ b/docs/data-sources/client.md @@ -73,6 +73,7 @@ data "auth0_client" "some-client-by-id" { - `sso` (Boolean) Applies only to SSO clients and determines whether Auth0 will handle Single Sign-On (true) or whether the identity provider will (false). - `sso_disabled` (Boolean) Indicates whether or not SSO is disabled. - `token_endpoint_auth_method` (String) The authentication method for the token endpoint. Results include `none` (public client without a client secret), `client_secret_post` (client uses HTTP POST parameters), `client_secret_basic` (client uses HTTP Basic), Managing a client's authentication method can be done via the `auth0_client_credentials` resource. +- `token_exchange` (List of Object) Allows configuration for token exchange (see [below for nested schema](#nestedatt--token_exchange)) - `web_origins` (List of String) URLs that represent valid web origins for use with web message response mode. @@ -610,3 +611,12 @@ Read-Only: - `updated_at` (String) + + +### Nested Schema for `token_exchange` + +Read-Only: + +- `allow_any_profile_of_type` (List of String) + + diff --git a/docs/data-sources/clients.md b/docs/data-sources/clients.md index d39df491..f3753c06 100644 --- a/docs/data-sources/clients.md +++ b/docs/data-sources/clients.md @@ -60,6 +60,7 @@ Read-Only: - `is_token_endpoint_ip_header_trusted` (Boolean) - `name` (String) - `oidc_logout` (List of Object) (see [below for nested schema](#nestedobjatt--clients--oidc_logout)) +- `token_exchange` (List of Object) (see [below for nested schema](#nestedobjatt--clients--token_exchange)) - `web_origins` (List of String) @@ -79,3 +80,12 @@ Read-Only: - `selected_initiators` (Set of String) + + +### Nested Schema for `clients.token_exchange` + +Read-Only: + +- `allow_any_profile_of_type` (List of String) + + diff --git a/docs/resources/action.md b/docs/resources/action.md index 8deab2dc..aa83b0ff 100644 --- a/docs/resources/action.md +++ b/docs/resources/action.md @@ -67,7 +67,7 @@ resource "auth0_action" "my_action" { - `dependencies` (Block Set) List of third party npm modules, and their versions, that this action depends on. (see [below for nested schema](#nestedblock--dependencies)) - `deploy` (Boolean) Deploying an action will create a new immutable version of the action. If the action is currently bound to a trigger, then the system will begin executing the newly deployed version of the action immediately. -- `runtime` (String) The Node runtime. Defaults to `node18`. Possible values are: `node16` (not recommended), or `node18` (recommended). +- `runtime` (String) The Node runtime. Possible values are: `node12`, `node16` (not recommended), `node18`, `node22` - `secrets` (Block Set) List of secrets that are included in an action or a version of an action. Partial management of secrets is not supported. (see [below for nested schema](#nestedblock--secrets)) ### Read-Only diff --git a/docs/resources/client.md b/docs/resources/client.md index 3abd6fc5..2f25acad 100644 --- a/docs/resources/client.md +++ b/docs/resources/client.md @@ -126,6 +126,7 @@ resource "auth0_client" "my_client" { - `require_pushed_authorization_requests` (Boolean) Makes the use of Pushed Authorization Requests mandatory for this client. This feature currently needs to be enabled on the tenant in order to make use of it. - `sso` (Boolean) Applies only to SSO clients and determines whether Auth0 will handle Single Sign-On (true) or whether the identity provider will (false). - `sso_disabled` (Boolean) Indicates whether or not SSO is disabled. +- `token_exchange` (Block List, Max: 1) Allows configuration for token exchange (see [below for nested schema](#nestedblock--token_exchange)) - `web_origins` (List of String) URLs that represent valid web origins for use with web message response mode. ### Read-Only @@ -568,6 +569,14 @@ Optional: - `leeway` (Number) The amount of time in seconds in which a refresh token may be reused without triggering reuse detection. - `token_lifetime` (Number) The absolute lifetime of a refresh token in seconds. + + +### Nested Schema for `token_exchange` + +Required: + +- `allow_any_profile_of_type` (List of String) List of allowed profile types for token exchange + ## Import Import is supported using the following syntax: From e17c02077f2b017344e5fccee0d8d023ced888fc Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Wed, 29 Jan 2025 15:24:34 +0530 Subject: [PATCH 13/15] Added tests for data-source --- .../tokenexchangeprofile/data_source_test.go | 86 ++- .../TestTokenExchangeDataSourceResource.yaml | 563 ++++++++++++++++++ 2 files changed, 648 insertions(+), 1 deletion(-) create mode 100644 test/data/recordings/TestTokenExchangeDataSourceResource.yaml diff --git a/internal/auth0/tokenexchangeprofile/data_source_test.go b/internal/auth0/tokenexchangeprofile/data_source_test.go index d12e0750..aa773d8a 100644 --- a/internal/auth0/tokenexchangeprofile/data_source_test.go +++ b/internal/auth0/tokenexchangeprofile/data_source_test.go @@ -1 +1,85 @@ -package tokenexchangeprofile +package tokenexchangeprofile_test + +import ( + "fmt" + "github.com/auth0/terraform-provider-auth0/internal/acctest" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "regexp" + "testing" +) + +const testAGivenTokenExchangeProfile = ` +resource "auth0_action" "my_action" { + name = "test-action" + code = <<-EOT + exports.onContinuePostLogin = async (event, api) => { + console.log("foo") + };" + EOT + deploy = true + supported_triggers { + id = "custom-token-exchange" + version = "v1" + } +} + +resource "auth0_token_exchange_profile" "my_token_exchange_profile" { + name = "token-prof-{{.testName}}" + subject_token_type = "https://acme.com/cis-token" + action_id = auth0_action.my_action.id + type = "custom_authentication" +} + +` + +const testDataResourceWithoutID = testAGivenTokenExchangeProfile + ` +data "auth0_token_exchange_profile" "my_profile" { + depends_on = [ auth0_token_exchange_profile.my_token_exchange_profile ] +}` + +const testDataResourceWithValidID = testAGivenTokenExchangeProfile + ` +data "auth0_token_exchange_profile" "my_profile" { + depends_on = [ auth0_token_exchange_profile.my_token_exchange_profile ] + id = auth0_token_exchange_profile.my_token_exchange_profile.id +}` + +const testDataResourceWithInvalidID = testAGivenTokenExchangeProfile + ` +data "auth0_token_exchange_profile" "my_profile" { + depends_on = [ auth0_token_exchange_profile.my_token_exchange_profile ] + id = "tep_Tnvl88SKv98TkMmr" +} +` + +func TestTokenExchangeDataSourceResourceRequiredId(t *testing.T) { + resource.UnitTest(t, resource.TestCase{ + ProviderFactories: acctest.TestFactories(), + Steps: []resource.TestStep{ + { + Config: testDataResourceWithoutID, + ExpectError: regexp.MustCompile("The argument \"id\" is required, but no definition was found."), + }, + }, + }) +} + +func TestTokenExchangeDataSourceResource(t *testing.T) { + acctest.Test(t, resource.TestCase{ + Steps: []resource.TestStep{ + { + Config: acctest.ParseTestName(testDataResourceWithInvalidID, t.Name()), + ExpectError: regexp.MustCompile( + `Error: 404 Not Found`, + ), + }, + { + Config: acctest.ParseTestName(testDataResourceWithValidID, t.Name()), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("data.auth0_token_exchange_profile.my_profile", "name", fmt.Sprintf("token-prof-%s", t.Name())), + resource.TestCheckResourceAttr("data.auth0_token_exchange_profile.my_profile", "subject_token_type", "https://acme.com/cis-token"), + resource.TestCheckResourceAttr("data.auth0_token_exchange_profile.my_profile", "type", "custom_authentication"), + resource.TestCheckResourceAttrSet("data.auth0_token_exchange_profile.my_profile", "action_id"), + ), + }, + }, + }) +} diff --git a/test/data/recordings/TestTokenExchangeDataSourceResource.yaml b/test/data/recordings/TestTokenExchangeDataSourceResource.yaml new file mode 100644 index 00000000..c7a0cfaf --- /dev/null +++ b/test/data/recordings/TestTokenExchangeDataSourceResource.yaml @@ -0,0 +1,563 @@ +--- +version: 2 +interactions: + - id: 0 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 192 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"test-action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"code":"exports.onContinuePostLogin = async (event, api) =\u003e {\n\tconsole.log(\"foo\")\n};\"\n"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 420 + uncompressed: false + body: '{"id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","name":"test-action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-29T09:53:52.589832516Z","updated_at":"2025-01-29T09:53:52.604550669Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node22","status":"pending","secrets":[],"all_changes_deployed":false}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 363.781708ms + - id: 1 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/dd09c70f-20f2-4462-9a92-f2a33f56ca88 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","name":"test-action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-29T09:53:52.589832516Z","updated_at":"2025-01-29T09:53:52.604550669Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node22","status":"built","secrets":[],"all_changes_deployed":false}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 348.319375ms + - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/dd09c70f-20f2-4462-9a92-f2a33f56ca88/deploy + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"7dffa623-21e7-4851-a481-a25eab5f9e90","deployed":false,"number":1,"secrets":[],"status":"built","created_at":"2025-01-29T09:53:53.309087688Z","updated_at":"2025-01-29T09:53:53.309087688Z","runtime":"node22","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"action":{"id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","name":"test-action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-29T09:53:52.589832516Z","updated_at":"2025-01-29T09:53:52.589832516Z","all_changes_deployed":false}}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 355.801875ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/dd09c70f-20f2-4462-9a92-f2a33f56ca88 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","name":"test-action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-29T09:53:52.589832516Z","updated_at":"2025-01-29T09:53:52.604550669Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node22","status":"built","secrets":[],"current_version":{"id":"7dffa623-21e7-4851-a481-a25eab5f9e90","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node22","status":"BUILT","number":1,"build_time":"2025-01-29T09:53:53.415987398Z","created_at":"2025-01-29T09:53:53.309087688Z","updated_at":"2025-01-29T09:53:53.417215370Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"7dffa623-21e7-4851-a481-a25eab5f9e90","deployed":true,"number":1,"built_at":"2025-01-29T09:53:53.415987398Z","secrets":[],"status":"built","created_at":"2025-01-29T09:53:53.309087688Z","updated_at":"2025-01-29T09:53:53.417215370Z","runtime":"node22","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 339.5775ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 190 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: | + {"name":"token-prof-TestTokenExchangeDataSourceResource","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","type":"custom_authentication"} + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles + method: POST + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 297 + uncompressed: false + body: '{"id":"tep_e2rUXaT61AAK0g3O","name":"token-prof-TestTokenExchangeDataSourceResource","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","created_at":"2025-01-29T09:53:54.103Z","updated_at":"2025-01-29T09:53:54.103Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 201 Created + code: 201 + duration: 407.143958ms + - id: 5 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_e2rUXaT61AAK0g3O + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_e2rUXaT61AAK0g3O","name":"token-prof-TestTokenExchangeDataSourceResource","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","created_at":"2025-01-29T09:53:54.103Z","updated_at":"2025-01-29T09:53:54.103Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 341.6245ms + - id: 6 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_Tnvl88SKv98TkMmr + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"statusCode":404,"error":"Not Found","message":"Token exchange profile not found."}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 404 Not Found + code: 404 + duration: 353.847875ms + - id: 7 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/dd09c70f-20f2-4462-9a92-f2a33f56ca88 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","name":"test-action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-29T09:53:52.589832516Z","updated_at":"2025-01-29T09:53:52.604550669Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node22","status":"built","secrets":[],"current_version":{"id":"7dffa623-21e7-4851-a481-a25eab5f9e90","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node22","status":"BUILT","number":1,"build_time":"2025-01-29T09:53:53.415987398Z","created_at":"2025-01-29T09:53:53.309087688Z","updated_at":"2025-01-29T09:53:53.417215370Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"7dffa623-21e7-4851-a481-a25eab5f9e90","deployed":true,"number":1,"built_at":"2025-01-29T09:53:53.415987398Z","secrets":[],"status":"built","created_at":"2025-01-29T09:53:53.309087688Z","updated_at":"2025-01-29T09:53:53.417215370Z","runtime":"node22","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 655.958ms + - id: 8 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_e2rUXaT61AAK0g3O + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_e2rUXaT61AAK0g3O","name":"token-prof-TestTokenExchangeDataSourceResource","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","created_at":"2025-01-29T09:53:54.103Z","updated_at":"2025-01-29T09:53:54.103Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 1.308995834s + - id: 9 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_e2rUXaT61AAK0g3O + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_e2rUXaT61AAK0g3O","name":"token-prof-TestTokenExchangeDataSourceResource","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","created_at":"2025-01-29T09:53:54.103Z","updated_at":"2025-01-29T09:53:54.103Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 2.721923s + - id: 10 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_e2rUXaT61AAK0g3O + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_e2rUXaT61AAK0g3O","name":"token-prof-TestTokenExchangeDataSourceResource","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","created_at":"2025-01-29T09:53:54.103Z","updated_at":"2025-01-29T09:53:54.103Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 1.351988584s + - id: 11 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/dd09c70f-20f2-4462-9a92-f2a33f56ca88 + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","name":"test-action","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}],"created_at":"2025-01-29T09:53:52.589832516Z","updated_at":"2025-01-29T09:53:52.604550669Z","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"runtime":"node22","status":"built","secrets":[],"current_version":{"id":"7dffa623-21e7-4851-a481-a25eab5f9e90","code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","runtime":"node22","status":"BUILT","number":1,"build_time":"2025-01-29T09:53:53.415987398Z","created_at":"2025-01-29T09:53:53.309087688Z","updated_at":"2025-01-29T09:53:53.417215370Z"},"deployed_version":{"code":"exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(\"foo\")\n};\"\n","dependencies":[],"id":"7dffa623-21e7-4851-a481-a25eab5f9e90","deployed":true,"number":1,"built_at":"2025-01-29T09:53:53.415987398Z","secrets":[],"status":"built","created_at":"2025-01-29T09:53:53.309087688Z","updated_at":"2025-01-29T09:53:53.417215370Z","runtime":"node22","supported_triggers":[{"id":"custom-token-exchange","version":"v1"}]},"all_changes_deployed":true}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 924.57575ms + - id: 12 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_e2rUXaT61AAK0g3O + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_e2rUXaT61AAK0g3O","name":"token-prof-TestTokenExchangeDataSourceResource","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","created_at":"2025-01-29T09:53:54.103Z","updated_at":"2025-01-29T09:53:54.103Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 369.334333ms + - id: 13 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_e2rUXaT61AAK0g3O + method: GET + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: -1 + uncompressed: true + body: '{"id":"tep_e2rUXaT61AAK0g3O","name":"token-prof-TestTokenExchangeDataSourceResource","type":"custom_authentication","subject_token_type":"https://acme.com/cis-token","action_id":"dd09c70f-20f2-4462-9a92-f2a33f56ca88","created_at":"2025-01-29T09:53:54.103Z","updated_at":"2025-01-29T09:53:54.103Z"}' + headers: + Content-Type: + - application/json; charset=utf-8 + status: 200 OK + code: 200 + duration: 376.050125ms + - id: 14 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/token-exchange-profiles/tep_e2rUXaT61AAK0g3O + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: {} + status: 204 No Content + code: 204 + duration: 357.569416ms + - id: 15 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: terraform-provider-auth0-dev.eu.auth0.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Content-Type: + - application/json + User-Agent: + - Go-Auth0/1.15.0 + url: https://terraform-provider-auth0-dev.eu.auth0.com/api/v2/actions/actions/dd09c70f-20f2-4462-9a92-f2a33f56ca88 + method: DELETE + response: + proto: HTTP/2.0 + proto_major: 2 + proto_minor: 0 + transfer_encoding: [] + trailer: {} + content_length: 0 + uncompressed: false + body: "" + headers: + Content-Type: + - application/json; charset=utf-8 + status: 204 No Content + code: 204 + duration: 367.977875ms From d9db994ed99fd58fc98ed1c8f2f3e210ae8a67b9 Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Wed, 29 Jan 2025 15:56:09 +0530 Subject: [PATCH 14/15] Added test case --- go.sum | 8 -------- internal/auth0/tokenexchangeprofile/resource_test.go | 6 +++++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/go.sum b/go.sum index b23be802..23694821 100644 --- a/go.sum +++ b/go.sum @@ -24,14 +24,6 @@ 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.14.0 h1:T/wQGIwXylf1DnrDtDEuo/92YBnRizRcw15zXb+e3k4= -github.com/auth0/go-auth0 v1.14.0/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= -github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae h1:fwojeLnkOGp2ty90zp7EAWLpraUjoyUNHMyvUeqYVvU= -github.com/auth0/go-auth0 v1.14.1-0.20250113064852-20ae1831ccae/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= -github.com/auth0/go-auth0 v1.14.1-0.20250113124145-16b8925bd444 h1:f7TS75W5/UzJ+8Z1bgqW5Rid8NbHiodPoWXXE8jLdVs= -github.com/auth0/go-auth0 v1.14.1-0.20250113124145-16b8925bd444/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= -github.com/auth0/go-auth0 v1.14.1-0.20250117054610-a1e5b43bb00f h1:b0E/GFcjVsdAStpZaqVlRHJzeWjSINRXVzr8dmTFfl0= -github.com/auth0/go-auth0 v1.14.1-0.20250117054610-a1e5b43bb00f/go.mod h1:PjkjJXvHIbGPJgig9lNjlYrK2lsP5pdh3tM+VV4Dmpc= 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/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48= diff --git a/internal/auth0/tokenexchangeprofile/resource_test.go b/internal/auth0/tokenexchangeprofile/resource_test.go index 23c123e3..1bbae926 100644 --- a/internal/auth0/tokenexchangeprofile/resource_test.go +++ b/internal/auth0/tokenexchangeprofile/resource_test.go @@ -2,6 +2,7 @@ package tokenexchangeprofile_test import ( "fmt" + "regexp" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -64,7 +65,10 @@ func TestTokenExchangeProfile(t *testing.T) { }, { Config: acctest.ParseTestName(givenACustomTokenAction, t.Name()), - Check: resource.ComposeTestCheckFunc(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_token_exchange_profile.my_token_exchange_profile", "id", ""), + ), + ExpectError: regexp.MustCompile(`Not found: auth0_token_exchange_profile`), }, }, }) From 3cf18c8fe76dd12a95f0352973ea88f15c0e08fb Mon Sep 17 00:00:00 2001 From: Rajat Bajaj Date: Wed, 29 Jan 2025 15:58:01 +0530 Subject: [PATCH 15/15] make docs --- internal/auth0/tokenexchangeprofile/data_source_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/auth0/tokenexchangeprofile/data_source_test.go b/internal/auth0/tokenexchangeprofile/data_source_test.go index aa773d8a..c7470832 100644 --- a/internal/auth0/tokenexchangeprofile/data_source_test.go +++ b/internal/auth0/tokenexchangeprofile/data_source_test.go @@ -2,10 +2,12 @@ package tokenexchangeprofile_test import ( "fmt" - "github.com/auth0/terraform-provider-auth0/internal/acctest" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" "regexp" "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/auth0/terraform-provider-auth0/internal/acctest" ) const testAGivenTokenExchangeProfile = `