diff --git a/CHANGELOG.md b/CHANGELOG.md index 8335213c..abb32d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,20 @@ ## 0.7.0 (Unreleased) + +FEATURES: + +* resource/connection: support for the passwordless `email` connection strategy. + +ENHANCEMENTS: + +* resource/connection: now using the more powerful connection options from `gopkg.in/auth0.v4`. + +BUG FIXES: +* resource/tenant, resource/connection: issues setting boolean attributes within nested blocks should now be resolved ([#163](https://github.com/alexkappa/terraform-provider-auth0/issues/163), [#160](https://github.com/alexkappa/terraform-provider-auth0/issues/160)) + +NOTES: + +* Upgrade to `gopkg.in/auth0.v4` (`v4.0.0`) + ## 0.6.0 (March 03, 2020) FEATURES: diff --git a/README.md b/README.md index abc96922..f1dcb3fb 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,13 @@ for custom domains (`TestAccCustomDomain`), also require a paid Auth0 subscripti At the time of writing, the following configuration steps are also required for the test tenant: * The `Username-Password-Authentication` connection must have _Requires Username_ option enabled for the user tests to -succesfully run. +successfully run. +Supporting the provider +----------------------- +This project is maintained by myself ([@alexkappa](https://github.com/alexkappa)) with contributions from great people across the community. +I am not affiliated with [Auth0](https://auth0.com/) and all work that goes into this provider is done during my spare time. Please be patient with issues and pull requests. + +If you or your company relies on this plugin or the [Go SDK](https://github.com/go-auth0/auth0) and would like to ensure its continuing support please consider [donating](https://github.com/sponsors/alexkappa). \ No newline at end of file diff --git a/auth0/internal/debug/debug.go b/auth0/internal/debug/debug.go new file mode 100644 index 00000000..3d949034 --- /dev/null +++ b/auth0/internal/debug/debug.go @@ -0,0 +1,23 @@ +package debug + +import ( + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" +) + +func DumpAttr(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + log.Printf("[DEBUG] Attrs: \n") + for key, value := range rs.Primary.Attributes { + log.Printf("[DEBUG]\t %s: %q\n", key, value) + } + return nil + } +} diff --git a/auth0/provider.go b/auth0/provider.go index 3bf5e4ec..32a07a12 100644 --- a/auth0/provider.go +++ b/auth0/provider.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/meta" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" ) func Provider() *schema.Provider { diff --git a/auth0/provider_test.go b/auth0/provider_test.go index 33604f3a..b9f10a19 100644 --- a/auth0/provider_test.go +++ b/auth0/provider_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" ) func Auth0() (*management.Management, error) { diff --git a/auth0/resource_auth0_client.go b/auth0/resource_auth0_client.go index 200eab66..f4d00922 100644 --- a/auth0/resource_auth0_client.go +++ b/auth0/resource_auth0_client.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" v "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/validation" ) @@ -588,22 +588,22 @@ func buildClient(d *schema.ResourceData) *management.Client { InitiateLoginURI: String(d, "initiate_login_uri"), } - List(d, "jwt_configuration").First(func(v interface{}) { - - m := v.(map[string]interface{}) - + List(d, "jwt_configuration").Elem(func(d Data) { c.JWTConfiguration = &management.ClientJWTConfiguration{ - LifetimeInSeconds: Int(MapData(m), "lifetime_in_seconds"), - Algorithm: String(MapData(m), "alg"), - Scopes: Map(MapData(m), "scopes"), + LifetimeInSeconds: Int(d, "lifetime_in_seconds"), + Algorithm: String(d, "alg"), + Scopes: Map(d, "scopes"), } }) - List(d, "encryption_key").First(func(v interface{}) { - c.EncryptionKey = v.(map[string]string) - }) + if m := Map(d, "encryption_key"); m != nil { + c.EncryptionKey = map[string]string{} + for k, v := range m { + c.EncryptionKey[k] = v.(string) + } + } - List(d, "addons").First(func(v interface{}) { + List(d, "addons").Range(func(k int, v interface{}) { c.Addons = make(map[string]interface{}) @@ -637,7 +637,7 @@ func buildClient(d *schema.ResourceData) *management.Client { } } - List(d, "mobile").First(func(v interface{}) { + List(d, "mobile").Range(func(k int, v interface{}) { c.Mobile = make(map[string]interface{}) diff --git a/auth0/resource_auth0_client_grant.go b/auth0/resource_auth0_client_grant.go index 45ddca97..1e63ae07 100644 --- a/auth0/resource_auth0_client_grant.go +++ b/auth0/resource_auth0_client_grant.go @@ -5,8 +5,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newClientGrant() *schema.Resource { diff --git a/auth0/resource_auth0_client_test.go b/auth0/resource_auth0_client_test.go index d41f78b9..9d6ec019 100644 --- a/auth0/resource_auth0_client_test.go +++ b/auth0/resource_auth0_client_test.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/random" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" ) func init() { diff --git a/auth0/resource_auth0_connection.go b/auth0/resource_auth0_connection.go index a85d4403..df6a516f 100644 --- a/auth0/resource_auth0_connection.go +++ b/auth0/resource_auth0_connection.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newConnection() *schema.Resource { @@ -24,14 +24,21 @@ func newConnection() *schema.Resource { Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Name of the connection", + }, + "display_name": { + Type: schema.TypeString, + Optional: true, + Description: "Name used in login screen", }, "is_domain_connection": { - Type: schema.TypeBool, - Optional: true, - Computed: true, + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Indicates whether or not the connection is domain level", }, "strategy": { Type: schema.TypeString, @@ -52,7 +59,8 @@ func newConnection() *schema.Resource { "waad", "weibo", "windowslive", "wordpress", "yahoo", "yammer", "yandex", "line", }, true), - ForceNew: true, + ForceNew: true, + Description: "Type of the connection, which indicates the identity provider", }, "options": { Type: schema.TypeList, @@ -71,6 +79,7 @@ func newConnection() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ "none", "low", "fair", "good", "excellent", }, false), + Description: "Indicates level of password strength to enforce during authentication. A strong password policy will make it difficult, if not improbable, for someone to guess a password through either manual or automated means. Options include `none`, `low`, `fair`, `good`, `excellent`", }, "password_history": { Type: schema.TypeList, @@ -88,6 +97,7 @@ func newConnection() *schema.Resource { }, }, }, + Description: "Configuration settings for the password history that is maintained for each user to prevent the reuse of passwords", }, "password_no_personal_info": { Type: schema.TypeList, @@ -101,6 +111,7 @@ func newConnection() *schema.Resource { }, }, }, + Description: "Configuration settings for the password personal info check, which does not allow passwords that contain any part of the user's personal data, including user's name, username, nickname, user_metadata.name, user_metadata.first, user_metadata.last, user's email, or firstpart of the user's email", }, "password_dictionary": { Type: schema.TypeList, @@ -119,6 +130,7 @@ func newConnection() *schema.Resource { }, }, }, + Description: "Configuration settings for the password dictionary check, which does not allow passwords that are part of the password dictionary", }, "password_complexity_options": { Type: schema.TypeList, @@ -133,67 +145,83 @@ func newConnection() *schema.Resource { }, }, }, + Description: "Configuration settings for password complexity", }, - "api_enable_users": { - Type: schema.TypeBool, - Optional: true, - }, + + /* + + */ "basic_profile": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, "ext_admin": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, "ext_is_suspended": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, "ext_agreed_terms": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, "ext_groups": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, "ext_nested_groups": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, "ext_assigned_plans": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, "ext_profile": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Deprecated: "This field is deprecated. Please use the `scopes` field instead.", }, + "enabled_database_customization": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "", }, "brute_force_protection": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "Indicates whether or not to enable brute force protection, which will limit the number of signups and failed logins from a suspicious IP address", }, "import_mode": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "Indicates whether or not you have a legacy user store and want to gradually migrate those users to the Auth0 user store", }, "disable_signup": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "Indicates whether or not to allow user sign-ups to your application", }, "requires_username": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "Indicates whether or not the user is required to provide a username in addition to an email address", }, "custom_scripts": { - Type: schema.TypeMap, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, + Type: schema.TypeMap, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Description: "", }, "configuration": { Type: schema.TypeMap, @@ -203,81 +231,148 @@ func newConnection() *schema.Resource { DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { return strings.HasPrefix(old, "2.0$") || new == old }, + Description: "", }, - // waad options - "app_id": { - Type: schema.TypeString, - Optional: true, + "client_id": { + Type: schema.TypeString, + Optional: true, + Description: "", }, - "app_domain": { - Type: schema.TypeString, - Optional: true, + "client_secret": { + Type: schema.TypeString, + Optional: true, + Sensitive: true, + Description: "", }, - "client_id": { - Type: schema.TypeString, + "allowed_audiences": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Description: "", + }, + "api_enable_users": { + Type: schema.TypeBool, Optional: true, }, - "client_secret": { - Type: schema.TypeString, - Optional: true, - Sensitive: true, + "app_id": { + Type: schema.TypeString, + Optional: true, + Description: "", + }, + "app_domain": { + Type: schema.TypeString, + Optional: true, + Description: "", + Deprecated: "use domain instead", + }, + "domain": { + Type: schema.TypeString, + Optional: true, + Description: "", }, "domain_aliases": { - Type: schema.TypeList, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Description: "", }, "max_groups_to_retrieve": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", }, "tenant_domain": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", }, "use_wsfed": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "", }, "waad_protocol": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", }, "waad_common_endpoint": { - Type: schema.TypeBool, - Optional: true, + Type: schema.TypeBool, + Optional: true, + Description: "", + }, + "icon_url": { + Type: schema.TypeString, + Optional: true, + Description: "", + }, + "identity_api": { + Type: schema.TypeString, + Optional: true, + Description: "", + }, + "ips": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Description: "", + }, + "use_cert_auth": { + Type: schema.TypeBool, + Optional: true, + Description: "", + }, + "use_kerberos": { + Type: schema.TypeBool, + Optional: true, + Description: "", + }, + "disable_cache": { + Type: schema.TypeBool, + Optional: true, + Description: "", }, - - // Twilio/sms options "name": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", }, "twilio_sid": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", }, "twilio_token": { Type: schema.TypeString, Optional: true, Sensitive: true, DefaultFunc: schema.EnvDefaultFunc("TWILIO_TOKEN", nil), + Description: "", }, "from": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", }, "syntax": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", + }, + "subject": { + Type: schema.TypeString, + Optional: true, + Description: "", }, "template": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: "", }, "totp": { - Type: schema.TypeMap, + Type: schema.TypeList, Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "time_step": { @@ -290,6 +385,7 @@ func newConnection() *schema.Resource { }, }, }, + Description: "", }, "messaging_service_sid": { Type: schema.TypeString, @@ -307,26 +403,35 @@ func newConnection() *schema.Resource { Type: schema.TypeString, Optional: true, }, + + "scopes": { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, }, }, + Description: "Configuration settings for connection options", }, "enabled_clients": { - Type: schema.TypeSet, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Description: "IDs of the clients for which the connection is enabled", }, "realms": { - Type: schema.TypeList, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, - Computed: true, + Type: schema.TypeList, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Computed: true, + Description: "Defines the realms for which the connection will be used (i.e., email domains). If not specified, the connection name is added as the realm", }, }, } } func createConnection(d *schema.ResourceData, m interface{}) error { - c := buildConnection(d) + c := expandConnection(d) api := m.(*management.Management) if err := api.Connection.Create(c); err != nil { return err @@ -352,60 +457,13 @@ func readConnection(d *schema.ResourceData, m interface{}) error { d.Set("name", c.Name) d.Set("is_domain_connection", c.IsDomainConnection) d.Set("strategy", c.Strategy) - d.Set("options", []map[string]interface{}{ - { - "validation": c.Options.Validation, - "password_policy": auth0.StringValue(c.Options.PasswordPolicy), - "password_history": c.Options.PasswordHistory, - "password_no_personal_info": c.Options.PasswordNoPersonalInfo, - "password_dictionary": c.Options.PasswordDictionary, - "password_complexity_options": c.Options.PasswordComplexityOptions, - "api_enable_users": auth0.BoolValue(c.Options.APIEnableUsers), - "basic_profile": auth0.BoolValue(c.Options.BasicProfile), - "ext_admin": auth0.BoolValue(c.Options.ExtAdmin), - "ext_is_suspended": auth0.BoolValue(c.Options.ExtIsSuspended), - "ext_agreed_terms": auth0.BoolValue(c.Options.ExtAgreedTerms), - "ext_groups": auth0.BoolValue(c.Options.ExtGroups), - "ext_nested_groups": auth0.BoolValue(c.Options.ExtNestedGroups), - "ext_assigned_plans": auth0.BoolValue(c.Options.ExtAssignedPlans), - "ext_profile": auth0.BoolValue(c.Options.ExtProfile), - "enabled_database_customization": auth0.BoolValue(c.Options.EnabledDatabaseCustomization), - "brute_force_protection": auth0.BoolValue(c.Options.BruteForceProtection), - "import_mode": auth0.BoolValue(c.Options.ImportMode), - "disable_signup": auth0.BoolValue(c.Options.DisableSignup), - "requires_username": auth0.BoolValue(c.Options.RequiresUsername), - "custom_scripts": c.Options.CustomScripts, - "configuration": c.Options.Configuration, - - // waad - "app_id": auth0.StringValue(c.Options.AppID), - "app_domain": auth0.StringValue(c.Options.AppDomain), - "client_id": auth0.StringValue(c.Options.ClientID), - "client_secret": auth0.StringValue(c.Options.ClientSecret), - "domain_aliases": c.Options.DomainAliases, - "max_groups_to_retrieve": auth0.StringValue(c.Options.MaxGroupsToRetrieve), - "tenant_domain": auth0.StringValue(c.Options.TenantDomain), - "use_wsfed": auth0.BoolValue(c.Options.UseWsfed), - "waad_protocol": auth0.StringValue(c.Options.WaadProtocol), - "waad_common_endpoint": auth0.BoolValue(c.Options.WaadCommonEndpoint), + d.Set("options", flattenConnectionOptions(c.Options)) - // twilio/sms - "name": auth0.StringValue(c.Options.Name), - "twilio_sid": auth0.StringValue(c.Options.TwilioSid), - "twilio_token": auth0.StringValue(c.Options.TwilioToken), - "from": auth0.StringValue(c.Options.From), - "syntax": auth0.StringValue(c.Options.Syntax), - "template": auth0.StringValue(c.Options.Template), - "messaging_service_sid": auth0.StringValue(c.Options.MessagingServiceSid), - "totp": c.Options.Totp, + // // adfs + // "adfs_server": auth0.StringValue(c.Options.AdfsServer), - // adfs - "adfs_server": auth0.StringValue(c.Options.AdfsServer), - - // salesforce - "community_base_url": auth0.StringValue(c.Options.CommunityBaseURL), - }, - }) + // // salesforce + // "community_base_url": auth0.StringValue(c.Options.CommunityBaseURL), d.Set("enabled_clients", c.EnabledClients) d.Set("realms", c.Realms) @@ -413,9 +471,7 @@ func readConnection(d *schema.ResourceData, m interface{}) error { } func updateConnection(d *schema.ResourceData, m interface{}) error { - c := buildConnection(d) - c.Strategy = nil - c.Name = nil + c := expandConnection(d) api := m.(*management.Management) err := api.Connection.Update(d.Id(), c) if err != nil { @@ -437,107 +493,3 @@ func deleteConnection(d *schema.ResourceData, m interface{}) error { } return err } - -func buildConnection(d *schema.ResourceData) *management.Connection { - - c := &management.Connection{ - Name: String(d, "name"), - IsDomainConnection: Bool(d, "is_domain_connection"), - Strategy: String(d, "strategy"), - EnabledClients: Set(d, "enabled_clients").Slice(), - Realms: Slice(d, "realms"), - } - - List(d, "options").First(func(v interface{}) { - - m := v.(map[string]interface{}) - - c.Options = &management.ConnectionOptions{ - Validation: Map(MapData(m), "validation"), - PasswordPolicy: String(MapData(m), "password_policy"), - APIEnableUsers: Bool(MapData(m), "api_enable_users"), - BasicProfile: Bool(MapData(m), "basic_profile"), - ExtAdmin: Bool(MapData(m), "ext_admin"), - ExtIsSuspended: Bool(MapData(m), "ext_is_suspended"), - ExtAgreedTerms: Bool(MapData(m), "ext_agreed_terms"), - ExtGroups: Bool(MapData(m), "ext_groups"), - ExtNestedGroups: Bool(MapData(m), "ext_nested_groups"), - ExtAssignedPlans: Bool(MapData(m), "ext_assigned_plans"), - ExtProfile: Bool(MapData(m), "ext_profile"), - EnabledDatabaseCustomization: Bool(MapData(m), "enabled_database_customization"), - BruteForceProtection: Bool(MapData(m), "brute_force_protection"), - ImportMode: Bool(MapData(m), "import_mode"), - DisableSignup: Bool(MapData(m), "disable_signup"), - RequiresUsername: Bool(MapData(m), "requires_username"), - CustomScripts: Map(MapData(m), "custom_scripts"), - Configuration: Map(MapData(m), "configuration"), - - // Waad - AppID: String(MapData(m), "app_id"), - AppDomain: String(MapData(m), "app_domain"), - ClientID: String(MapData(m), "client_id"), - ClientSecret: String(MapData(m), "client_secret"), - DomainAliases: Slice(MapData(m), "domain_aliases"), - MaxGroupsToRetrieve: String(MapData(m), "max_groups_to_retrieve"), - TenantDomain: String(MapData(m), "tenant_domain"), - UseWsfed: Bool(MapData(m), "use_wsfed"), - WaadProtocol: String(MapData(m), "waad_protocol"), - WaadCommonEndpoint: Bool(MapData(m), "waad_common_endpoint"), - - // Twilio - Name: String(MapData(m), "name"), - TwilioSid: String(MapData(m), "twilio_sid"), - TwilioToken: String(MapData(m), "twilio_token"), - From: String(MapData(m), "from"), - Syntax: String(MapData(m), "syntax"), - Template: String(MapData(m), "template"), - MessagingServiceSid: String(MapData(m), "messaging_service_sid"), - Totp: &management.ConnectionOptionsTotp{ - TimeStep: Int(MapData(m), "time_step"), - Length: Int(MapData(m), "length"), - }, - - // adfs - AdfsServer: String(MapData(m), "adfs_server"), - - // salesforce - CommunityBaseURL: String(MapData(m), "community_base_url"), - } - - List(MapData(m), "password_history").First(func(v interface{}) { - - m := v.(map[string]interface{}) - - c.Options.PasswordHistory = make(map[string]interface{}) - c.Options.PasswordHistory["enable"] = Bool(MapData(m), "enable") - c.Options.PasswordHistory["size"] = Int(MapData(m), "size") - }) - - List(MapData(m), "password_no_personal_info").First(func(v interface{}) { - - m := v.(map[string]interface{}) - - c.Options.PasswordNoPersonalInfo = make(map[string]interface{}) - c.Options.PasswordNoPersonalInfo["enable"] = Bool(MapData(m), "enable") - }) - - List(MapData(m), "password_dictionary").First(func(v interface{}) { - - m := v.(map[string]interface{}) - - c.Options.PasswordDictionary = make(map[string]interface{}) - c.Options.PasswordDictionary["enable"] = Bool(MapData(m), "enable") - c.Options.PasswordDictionary["dictionary"] = Set(MapData(m), "dictionary").Slice() - }) - - List(MapData(m), "password_complexity_options").First(func(v interface{}) { - - m := v.(map[string]interface{}) - - c.Options.PasswordComplexityOptions = make(map[string]interface{}) - c.Options.PasswordComplexityOptions["min_length"] = Int(MapData(m), "min_length") - }) - }) - - return c -} diff --git a/auth0/resource_auth0_connection_test.go b/auth0/resource_auth0_connection_test.go index 3a18c2b7..3a1831cb 100644 --- a/auth0/resource_auth0_connection_test.go +++ b/auth0/resource_auth0_connection_test.go @@ -1,14 +1,16 @@ package auth0 import ( + "log" "strings" "testing" "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/debug" "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/random" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" ) func init() { @@ -21,13 +23,16 @@ func init() { } var page int for { - l, err := api.Connection.List(management.Page(page)) + l, err := api.Connection.List( + management.WithFields("id", "name"), + management.Page(page)) if err != nil { return err } for _, connection := range l.Connections { if strings.Contains(connection.GetName(), "Acceptance-Test") { - if e := api.Client.Delete(connection.GetID()); e != nil { + log.Printf("[DEBUG] Deleting connection %v\n", connection.GetName()) + if e := api.Connection.Delete(connection.GetID()); e != nil { multierror.Append(err, e) } } @@ -162,8 +167,15 @@ func TestAccConnectionAD(t *testing.T) { resource.TestStep{ Config: random.Template(testAccConnectionADConfig, rand), Check: resource.ComposeTestCheckFunc( - random.TestCheckResourceAttr("auth0_connection.my_ad_connection", "name", "Acceptance-Test-AD-Connection-{{.random}}", rand), - resource.TestCheckResourceAttr("auth0_connection.my_ad_connection", "strategy", "ad"), + random.TestCheckResourceAttr("auth0_connection.ad", "name", "Acceptance-Test-AD-{{.random}}", rand), + resource.TestCheckResourceAttr("auth0_connection.ad", "strategy", "ad"), + resource.TestCheckResourceAttr("auth0_connection.ad", "options.0.domain_aliases.#", "2"), + resource.TestCheckResourceAttr("auth0_connection.ad", "options.0.tenant_domain", "example.com"), + resource.TestCheckResourceAttr("auth0_connection.ad", "options.0.use_kerberos", "false"), + resource.TestCheckResourceAttr("auth0_connection.ad", "options.0.ips.3011009788", "192.168.1.2"), + resource.TestCheckResourceAttr("auth0_connection.ad", "options.0.ips.2555711295", "192.168.1.1"), + resource.TestCheckResourceAttr("auth0_connection.ad", "options.0.domain_aliases.3506632655", "example.com"), + resource.TestCheckResourceAttr("auth0_connection.ad", "options.0.domain_aliases.3154807651", "api.example.com"), ), }, }, @@ -172,13 +184,21 @@ func TestAccConnectionAD(t *testing.T) { const testAccConnectionADConfig = ` -resource "auth0_connection" "my_ad_connection" { - name = "Acceptance-Test-AD-Connection-{{.random}}" +resource "auth0_connection" "ad" { + name = "Acceptance-Test-AD-{{.random}}" strategy = "ad" + options { + tenant_domain = "example.com" + domain_aliases = [ + "example.com", + "api.example.com" + ] + ips = [ "192.168.1.1", "192.168.1.2" ] + } } ` -func TestAccConnectionWAAD(t *testing.T) { +func TestAccConnectionAzureAD(t *testing.T) { rand := random.String(6) @@ -188,36 +208,50 @@ func TestAccConnectionWAAD(t *testing.T) { }, Steps: []resource.TestStep{ resource.TestStep{ - Config: random.Template(testAccConnectionWAADConfig, rand), + Config: random.Template(testAccConnectionAzureADConfig, rand), Check: resource.ComposeTestCheckFunc( - random.TestCheckResourceAttr("auth0_connection.my_connection", "name", "Acceptance-Test-WAAD-Connection-{{.random}}", rand), - resource.TestCheckResourceAttr("auth0_connection.my_connection", "strategy", "waad"), + random.TestCheckResourceAttr("auth0_connection.azure_ad", "name", "Acceptance-Test-Azure-AD-{{.random}}", rand), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "strategy", "waad"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.client_id", "123456"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.client_secret", "123456"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.tenant_domain", "example.onmicrosoft.com"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.domain", "example.onmicrosoft.com"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.domain_aliases.#", "2"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.domain_aliases.3506632655", "example.com"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.domain_aliases.3154807651", "api.example.com"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.scopes.#", "3"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.scopes.370042894", "basic_profile"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.scopes.1268340351", "ext_profile"), + resource.TestCheckResourceAttr("auth0_connection.azure_ad", "options.0.scopes.541325467", "ext_groups"), ), }, }, }) } -const testAccConnectionWAADConfig = ` +const testAccConnectionAzureADConfig = ` -resource "auth0_connection" "my_connection" { - name = "Acceptance-Test-WAAD-Connection-{{.random}}" +resource "auth0_connection" "azure_ad" { + name = "Acceptance-Test-Azure-AD-{{.random}}" strategy = "waad" options { client_id = "123456" client_secret = "123456" tenant_domain = "example.onmicrosoft.com" + domain = "example.onmicrosoft.com" domain_aliases = [ - "example.io", + "example.com", + "api.example.com" ] use_wsfed = false waad_protocol = "openid-connect" waad_common_endpoint = false - app_domain = "my-auth0-app.eu.auth0.com" - api_enable_users = true - basic_profile = true - ext_groups = true - ext_profile = true + api_enable_users = true + scopes = [ + "basic_profile", + "ext_groups", + "ext_profile" + ] } } ` @@ -281,7 +315,7 @@ resource "auth0_connection" "my_connection" { } ` -func TestAccTwilioConnection(t *testing.T) { +func TestAccConnectionSMS(t *testing.T) { rand := random.String(6) @@ -291,27 +325,32 @@ func TestAccTwilioConnection(t *testing.T) { }, Steps: []resource.TestStep{ resource.TestStep{ - Config: random.Template(testAccTwilioConnectionConfig, rand), + Config: random.Template(testAccConnectionSMSConfig, rand), Check: resource.ComposeTestCheckFunc( - random.TestCheckResourceAttr("auth0_connection.sms_connection", "name", "Acceptance-Test-SMS-Connection-{{.random}}", rand), - resource.TestCheckResourceAttr("auth0_connection.sms_connection", "strategy", "sms"), - resource.TestCheckResourceAttr("auth0_connection.sms_connection", "options.0.twilio_token", "DEF456"), + random.TestCheckResourceAttr("auth0_connection.sms", "name", "Acceptance-Test-SMS-{{.random}}", rand), + resource.TestCheckResourceAttr("auth0_connection.sms", "strategy", "sms"), + resource.TestCheckResourceAttr("auth0_connection.sms", "options.0.twilio_sid", "ABC123"), + resource.TestCheckResourceAttr("auth0_connection.sms", "options.0.twilio_token", "DEF456"), + resource.TestCheckResourceAttr("auth0_connection.sms", "options.0.totp.#", "1"), + resource.TestCheckResourceAttr("auth0_connection.sms", "options.0.totp.0.time_step", "300"), + resource.TestCheckResourceAttr("auth0_connection.sms", "options.0.totp.0.length", "6"), + debug.DumpAttr("auth0_connection.sms"), ), }, }, }) } -const testAccTwilioConnectionConfig = ` +const testAccConnectionSMSConfig = ` -resource "auth0_connection" "sms_connection" { - name = "Acceptance-Test-SMS-Connection-{{.random}}" +resource "auth0_connection" "sms" { + name = "Acceptance-Test-SMS-{{.random}}" is_domain_connection = false strategy = "sms" - + options { disable_signup = false - name = "sms-connection" + name = "SMS OTP" twilio_sid = "ABC123" twilio_token = "DEF456" from = "+12345678" @@ -319,8 +358,59 @@ resource "auth0_connection" "sms_connection" { template = "@@password@@" messaging_service_sid = "GHI789" brute_force_protection = true + + totp { + time_step = 300 + length = 6 + } + } +} +` + +func TestAccConnectionEmail(t *testing.T) { + + rand := random.String(6) + + resource.Test(t, resource.TestCase{ + Providers: map[string]terraform.ResourceProvider{ + "auth0": Provider(), + }, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: random.Template(testAccConnectionEmailConfig, rand), + Check: resource.ComposeTestCheckFunc( + random.TestCheckResourceAttr("auth0_connection.email", "name", "Acceptance-Test-Email-{{.random}}", rand), + resource.TestCheckResourceAttr("auth0_connection.email", "strategy", "email"), + resource.TestCheckResourceAttr("auth0_connection.email", "options.0.from", "Magic Password "), + resource.TestCheckResourceAttr("auth0_connection.email", "options.0.subject", "Sign in!"), + resource.TestCheckResourceAttr("auth0_connection.email", "options.0.totp.#", "1"), + resource.TestCheckResourceAttr("auth0_connection.email", "options.0.totp.0.time_step", "300"), + resource.TestCheckResourceAttr("auth0_connection.email", "options.0.totp.0.length", "6"), + debug.DumpAttr("auth0_connection.email"), + ), + }, + }, + }) +} + +const testAccConnectionEmailConfig = ` + +resource "auth0_connection" "email" { + name = "Acceptance-Test-Email-{{.random}}" + is_domain_connection = false + strategy = "email" + + options { + disable_signup = false + name = "Email OTP" + from = "Magic Password " + subject = "Sign in!" + syntax = "liquid" + template = "

Here's your password!

" - totp = { + brute_force_protection = true + + totp { time_step = 300 length = 6 } @@ -328,7 +418,7 @@ resource "auth0_connection" "sms_connection" { } ` -func TestAccSalesforceCommunityConnection(t *testing.T) { +func TestAccConnectionSalesforce(t *testing.T) { rand := random.String(6) @@ -338,28 +428,73 @@ func TestAccSalesforceCommunityConnection(t *testing.T) { }, Steps: []resource.TestStep{ resource.TestStep{ - Config: random.Template(testAccSalesforceConnectionConfig, rand), + Config: random.Template(testAccConnectionSalesforceConfig, rand), Check: resource.ComposeTestCheckFunc( random.TestCheckResourceAttr("auth0_connection.salesforce_community", "name", "Acceptance-Test-Salesforce-Connection-{{.random}}", rand), resource.TestCheckResourceAttr("auth0_connection.salesforce_community", "strategy", "salesforce-community"), - resource.TestCheckResourceAttr("auth0_connection.salesforce_community", "options.0.community_base_url", "https://salesforce-community.example"), + resource.TestCheckResourceAttr("auth0_connection.salesforce_community", "options.0.community_base_url", "https://salesforce.example.com"), + debug.DumpAttr("auth0_connection.salesforce_community"), ), }, }, }) } -const testAccSalesforceConnectionConfig = ` +const testAccConnectionSalesforceConfig = ` resource "auth0_connection" "salesforce_community" { name = "Acceptance-Test-Salesforce-Connection-{{.random}}" is_domain_connection = false strategy = "salesforce-community" - + options { client_id = false client_secret = "sms-connection" - community_base_url = "https://salesforce-community.example" + community_base_url = "https://salesforce.example.com" + } +} +` + +func TestAccConnectionGoogleOAuth2(t *testing.T) { + + rand := random.String(6) + + resource.Test(t, resource.TestCase{ + Providers: map[string]terraform.ResourceProvider{ + "auth0": Provider(), + }, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: random.Template(testAccConnectionGoogleOAuth2Config, rand), + Check: resource.ComposeTestCheckFunc( + random.TestCheckResourceAttr("auth0_connection.google_oauth2", "name", "Acceptance-Test-Google-OAuth2-{{.random}}", rand), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "strategy", "google-oauth2"), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.client_id", ""), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.client_secret", ""), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.allowed_audiences.#", "2"), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.allowed_audiences.3506632655", "example.com"), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.allowed_audiences.3154807651", "api.example.com"), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.scopes.#", "4"), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.scopes.881205744", "email"), + resource.TestCheckResourceAttr("auth0_connection.google_oauth2", "options.0.scopes.4080487570", "profile"), + // debug.DumpAttr("auth0_connection.google_oauth2"), + ), + }, + }, + }) +} + +const testAccConnectionGoogleOAuth2Config = ` + +resource "auth0_connection" "google_oauth2" { + name = "Acceptance-Test-Google-OAuth2-{{.random}}" + is_domain_connection = false + strategy = "google-oauth2" + options { + client_id = "" + client_secret = "" + allowed_audiences = [ "example.com", "api.example.com" ] + scopes = [ "email", "profile", "gmail", "youtube" ] } } ` diff --git a/auth0/resource_auth0_custom_domain.go b/auth0/resource_auth0_custom_domain.go index a6bef8bf..19ba13a1 100644 --- a/auth0/resource_auth0_custom_domain.go +++ b/auth0/resource_auth0_custom_domain.go @@ -6,8 +6,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newCustomDomain() *schema.Resource { diff --git a/auth0/resource_auth0_email.go b/auth0/resource_auth0_email.go index a34b693e..cce50967 100644 --- a/auth0/resource_auth0_email.go +++ b/auth0/resource_auth0_email.go @@ -5,8 +5,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newEmail() *schema.Resource { @@ -171,19 +171,19 @@ func buildEmail(d *schema.ResourceData) *management.Email { DefaultFromAddress: String(d, "default_from_address"), } - List(d, "credentials").First(func(v interface{}) { + List(d, "credentials").Elem(func(d Data) { // e.Credentials = buildEmailCredentials(v.(map[string]interface{})) e.Credentials = &management.EmailCredentials{ - APIUser: String(d, "credentials.0.api_user"), - APIKey: String(d, "credentials.0.api_key"), - AccessKeyID: String(d, "credentials.0.access_key_id"), - SecretAccessKey: String(d, "credentials.0.secret_access_key"), - Region: String(d, "credentials.0.region"), - Domain: String(d, "credentials.0.domain"), - SMTPHost: String(d, "credentials.0.smtp_host"), - SMTPPort: Int(d, "credentials.0.smtp_port"), - SMTPUser: String(d, "credentials.0.smtp_user"), - SMTPPass: String(d, "credentials.0.smtp_pass"), + APIUser: String(d, "api_user"), + APIKey: String(d, "api_key"), + AccessKeyID: String(d, "access_key_id"), + SecretAccessKey: String(d, "secret_access_key"), + Region: String(d, "region"), + Domain: String(d, "domain"), + SMTPHost: String(d, "smtp_host"), + SMTPPort: Int(d, "smtp_port"), + SMTPUser: String(d, "smtp_user"), + SMTPPass: String(d, "smtp_pass"), } }) diff --git a/auth0/resource_auth0_email_template.go b/auth0/resource_auth0_email_template.go index bc84bb7e..d032d6e8 100644 --- a/auth0/resource_auth0_email_template.go +++ b/auth0/resource_auth0_email_template.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newEmailTemplate() *schema.Resource { diff --git a/auth0/resource_auth0_email_template_test.go b/auth0/resource_auth0_email_template_test.go index 4c50f1cc..a74283aa 100644 --- a/auth0/resource_auth0_email_template_test.go +++ b/auth0/resource_auth0_email_template_test.go @@ -5,8 +5,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func init() { diff --git a/auth0/resource_auth0_global_client.go b/auth0/resource_auth0_global_client.go index 0996cdbc..31448d01 100644 --- a/auth0/resource_auth0_global_client.go +++ b/auth0/resource_auth0_global_client.go @@ -5,7 +5,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" ) func newGlobalClient() *schema.Resource { diff --git a/auth0/resource_auth0_hook.go b/auth0/resource_auth0_hook.go index 624b7e6a..8b61cb0e 100644 --- a/auth0/resource_auth0_hook.go +++ b/auth0/resource_auth0_hook.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) var hookNameRegexp = regexp.MustCompile("^[^\\s-][\\w -]+[^\\s-]$") diff --git a/auth0/resource_auth0_resource_server.go b/auth0/resource_auth0_resource_server.go index 7c5338f8..fb74212b 100644 --- a/auth0/resource_auth0_resource_server.go +++ b/auth0/resource_auth0_resource_server.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newResourceServer() *schema.Resource { @@ -40,7 +40,7 @@ func newResourceServer() *schema.Resource { Schema: map[string]*schema.Schema{ "value": { Type: schema.TypeString, - Optional: true, + Required: true, }, "description": { Type: schema.TypeString, @@ -115,7 +115,7 @@ func newResourceServer() *schema.Resource { } func createResourceServer(d *schema.ResourceData, m interface{}) error { - s := buildResourceServer(d) + s := expandResourceServer(d) api := m.(*management.Management) if err := api.ResourceServer.Create(s); err != nil { return err @@ -163,7 +163,7 @@ func readResourceServer(d *schema.ResourceData, m interface{}) error { } func updateResourceServer(d *schema.ResourceData, m interface{}) error { - s := buildResourceServer(d) + s := expandResourceServer(d) s.Identifier = nil api := m.(*management.Management) err := api.ResourceServer.Update(d.Id(), s) @@ -187,30 +187,28 @@ func deleteResourceServer(d *schema.ResourceData, m interface{}) error { return err } -func buildResourceServer(d *schema.ResourceData) *management.ResourceServer { +func expandResourceServer(d *schema.ResourceData) *management.ResourceServer { s := &management.ResourceServer{ - Name: String(d, "name"), - Identifier: String(d, "identifier"), - SigningAlgorithm: String(d, "signing_alg"), - SigningSecret: String(d, "signing_secret"), - AllowOfflineAccess: Bool(d, "allow_offline_access"), - TokenLifetime: Int(d, "token_lifetime"), - TokenLifetimeForWeb: Int(d, "token_lifetime_for_web"), + Name: String(d, "name"), + Identifier: String(d, "identifier"), + SigningAlgorithm: String(d, "signing_alg"), + SigningSecret: String(d, "signing_secret"), + AllowOfflineAccess: Bool(d, "allow_offline_access"), + TokenLifetime: Int(d, "token_lifetime"), + TokenLifetimeForWeb: Int(d, "token_lifetime_for_web"), + VerificationLocation: String(d, "verification_location"), + Options: Map(d, "options"), + EnforcePolicies: Bool(d, "enforce_policies"), + TokenDialect: String(d, "token_dialect"), + SkipConsentForVerifiableFirstPartyClients: Bool(d, "skip_consent_for_verifiable_first_party_clients"), - VerificationLocation: String(d, "verification_location"), - Options: Map(d, "options"), - EnforcePolicies: Bool(d, "enforce_policies"), - TokenDialect: String(d, "token_dialect"), } - Set(d, "scopes").All(func(key int, value interface{}) { - - scopes := value.(map[string]interface{}) - + Set(d, "scopes").Elem(func(d Data) { s.Scopes = append(s.Scopes, &management.ResourceServerScope{ - Value: String(MapData(scopes), "value"), - Description: String(MapData(scopes), "description"), + Value: String(d, "value"), + Description: String(d, "description"), }) }) diff --git a/auth0/resource_auth0_resource_server_test.go b/auth0/resource_auth0_resource_server_test.go index c1205afc..23475e9c 100644 --- a/auth0/resource_auth0_resource_server_test.go +++ b/auth0/resource_auth0_resource_server_test.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/random" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" ) func init() { diff --git a/auth0/resource_auth0_role.go b/auth0/resource_auth0_role.go index 4e7191bd..67f130cc 100644 --- a/auth0/resource_auth0_role.go +++ b/auth0/resource_auth0_role.go @@ -5,8 +5,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newRole() *schema.Resource { diff --git a/auth0/resource_auth0_role_test.go b/auth0/resource_auth0_role_test.go index b9f171d3..1f0b64fb 100644 --- a/auth0/resource_auth0_role_test.go +++ b/auth0/resource_auth0_role_test.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/random" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" ) func init() { diff --git a/auth0/resource_auth0_rule.go b/auth0/resource_auth0_rule.go index 9e86ddbe..043d44b6 100644 --- a/auth0/resource_auth0_rule.go +++ b/auth0/resource_auth0_rule.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) var ruleNameRegexp = regexp.MustCompile("^[^\\s-][\\w -]+[^\\s-]$") diff --git a/auth0/resource_auth0_rule_config.go b/auth0/resource_auth0_rule_config.go index 7270f304..b26a21f6 100644 --- a/auth0/resource_auth0_rule_config.go +++ b/auth0/resource_auth0_rule_config.go @@ -5,8 +5,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newRuleConfig() *schema.Resource { diff --git a/auth0/resource_auth0_tenant.go b/auth0/resource_auth0_tenant.go index d3d424c5..7a777e77 100644 --- a/auth0/resource_auth0_tenant.go +++ b/auth0/resource_auth0_tenant.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" v "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/validation" ) @@ -122,7 +122,7 @@ func newTenant() *schema.Resource { Optional: true, }, "enabled_locales": { - Type: schema.TypeList, + Type: schema.TypeSet, Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, }, @@ -231,37 +231,12 @@ func readTenant(d *schema.ResourceData, m interface{}) error { return err } - if changePassword := t.ChangePassword; changePassword != nil { - d.Set("change_password", []map[string]interface{}{ - { - "enabled": changePassword.Enabled, - "html": changePassword.HTML, - }, - }) - } - - if guardianMFAPage := t.GuardianMFAPage; guardianMFAPage != nil { - d.Set("guardian_mfa_page", []map[string]interface{}{ - { - "enabled": guardianMFAPage.Enabled, - "html": guardianMFAPage.HTML, - }, - }) - } + d.Set("change_password", flattenTenantChangePassword(t.ChangePassword)) + d.Set("guardian_mfa_page", flattenTenantGuardianMFAPage(t.GuardianMFAPage)) d.Set("default_audience", t.DefaultAudience) d.Set("default_directory", t.DefaultDirectory) - if errorPage := t.ErrorPage; errorPage != nil { - d.Set("error_page", []map[string]interface{}{ - { - "html": errorPage.HTML, - "show_log_link": errorPage.ShowLogLink, - "url": errorPage.URL, - }, - }) - } - d.Set("friendly_name", t.FriendlyName) d.Set("picture_url", t.PictureURL) d.Set("support_email", t.SupportEmail) @@ -270,39 +245,14 @@ func readTenant(d *schema.ResourceData, m interface{}) error { d.Set("session_lifetime", t.SessionLifetime) d.Set("sandbox_version", t.SandboxVersion) d.Set("idle_session_lifetime", t.IdleSessionLifetime) - d.Set("enabled_locales", t.EnabledLocales) - if flags := t.Flags; flags != nil { - d.Set("flags", []map[string]interface{}{ - { - "change_pwd_flow_v1": flags.ChangePasswordFlowV1, - "enable_client_connections": flags.EnableClientConnections, - "enable_apis_section": flags.EnableAPIsSection, - "enable_pipeline2": flags.EnablePipeline2, - "enable_dynamic_client_registration": flags.EnableDynamicClientRegistration, - "enable_custom_domain_in_emails": flags.EnableCustomDomainInEmails, - "universal_login": flags.UniversalLogin, - "enable_legacy_logs_search_v2": flags.EnableLegacyLogsSearchV2, - "disable_clickjack_protection_headers": flags.DisableClickjackProtectionHeaders, - "enable_public_signup_user_exists_error": flags.EnablePublicSignupUserExistsError, - }, - }) - } + // TODO: figure out why it is necessary to wrap what is aleady an + // []interface{} with another []interface{}. + d.Set("enabled_locales", []interface{}{t.EnabledLocales}) - if universalLogin := t.UniversalLogin; universalLogin != nil { - if colors := universalLogin.Colors; colors != nil { - d.Set("universal_login", []map[string]interface{}{ - { - "colors": []map[string]interface{}{ - { - "primary": universalLogin.Colors.Primary, - "page_background": universalLogin.Colors.PageBackground, - }, - }, - }, - }) - } - } + d.Set("error_page", flattenTenantErrorPage(t.ErrorPage)) + d.Set("flags", flattenTenantFlags(t.Flags)) + d.Set("universal_login", flattenTenantUniversalLogin(t.UniversalLogin)) return nil } @@ -334,67 +284,13 @@ func buildTenant(d *schema.ResourceData) *management.Tenant { SessionLifetime: Int(d, "session_lifetime"), SandboxVersion: String(d, "sandbox_version"), IdleSessionLifetime: Int(d, "idle_session_lifetime"), - EnabledLocales: Slice(d, "enabled_locales"), + EnabledLocales: Set(d, "enabled_locales").List(), + ChangePassword: expandTenantChangePassword(d), + GuardianMFAPage: expandTenantGuardianMFAPage(d), + ErrorPage: expandTenantErrorPage(d), + Flags: expandTenantFlags(d), + UniversalLogin: expandTenantUniversalLogin(d), } - List(d, "change_password").First(func(v interface{}) { - m := v.(map[string]interface{}) - - t.ChangePassword = &management.TenantChangePassword{ - Enabled: Bool(MapData(m), "enabled"), - HTML: String(MapData(m), "html"), - } - }) - - List(d, "guardian_mfa_page").First(func(v interface{}) { - m := v.(map[string]interface{}) - - t.GuardianMFAPage = &management.TenantGuardianMFAPage{ - Enabled: Bool(MapData(m), "enabled"), - HTML: String(MapData(m), "html"), - } - }) - - List(d, "error_page").First(func(v interface{}) { - m := v.(map[string]interface{}) - - t.ErrorPage = &management.TenantErrorPage{ - HTML: String(MapData(m), "html"), - ShowLogLink: Bool(MapData(m), "show_log_link"), - URL: String(MapData(m), "url"), - } - }) - - List(d, "flags").First(func(v interface{}) { - m := v.(map[string]interface{}) - - t.Flags = &management.TenantFlags{ - ChangePasswordFlowV1: Bool(MapData(m), "change_pwd_flow_v1"), - EnableClientConnections: Bool(MapData(m), "enable_client_connections"), - EnableAPIsSection: Bool(MapData(m), "enable_apis_section"), - EnablePipeline2: Bool(MapData(m), "enable_pipeline2"), - EnableDynamicClientRegistration: Bool(MapData(m), "enable_dynamic_client_registration"), - EnableCustomDomainInEmails: Bool(MapData(m), "enable_custom_domain_in_emails"), - UniversalLogin: Bool(MapData(m), "universal_login"), - EnableLegacyLogsSearchV2: Bool(MapData(m), "enable_legacy_logs_search_v2"), - DisableClickjackProtectionHeaders: Bool(MapData(m), "disable_clickjack_protection_headers"), - EnablePublicSignupUserExistsError: Bool(MapData(m), "enable_public_signup_user_exists_error"), - } - }) - - List(d, "universal_login").First(func(v interface{}) { - m := v.(map[string]interface{}) - - t.UniversalLogin = &management.TenantUniversalLogin{} - - List(MapData(m), "colors").First(func(v interface{}) { - m := v.(map[string]interface{}) - t.UniversalLogin.Colors = &management.TenantUniversalLoginColors{ - Primary: String(MapData(m), "primary"), - PageBackground: String(MapData(m), "page_background"), - } - }) - }) - return t } diff --git a/auth0/resource_auth0_tenant_test.go b/auth0/resource_auth0_tenant_test.go index 36fa4158..49aa93b6 100644 --- a/auth0/resource_auth0_tenant_test.go +++ b/auth0/resource_auth0_tenant_test.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" + "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/debug" ) func TestAccTenant(t *testing.T) { @@ -34,15 +35,16 @@ func TestAccTenant(t *testing.T) { resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "session_lifetime", "1080"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "sandbox_version", "8"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "idle_session_lifetime", "720"), - resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.0", "en"), - resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.1", "de"), - resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.2", "fr"), + resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.4213735380", "en"), + resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.421448744", "de"), + resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "enabled_locales.521772240", "fr"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.universal_login", "true"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.disable_clickjack_protection_headers", "true"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.enable_public_signup_user_exists_error", "true"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "universal_login.0.colors.0.primary", "#0059d6"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "universal_login.0.colors.0.page_background", "#000000"), resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "default_redirection_uri", "https://example.com/login"), + debug.DumpAttr("auth0_tenant.my_tenant"), ), }, // This test case confirms issue #160 where boolean values from a @@ -51,13 +53,13 @@ func TestAccTenant(t *testing.T) { // // See: https://github.com/alexkappa/terraform-provider-auth0/issues/160 // - // { - // Config: testAccTenantConfigUpdate, - // Check: resource.ComposeTestCheckFunc( - // resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.disable_clickjack_protection_headers", "false"), - // resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.enable_public_signup_user_exists_error", "true"), - // ), - // }, + { + Config: testAccTenantConfigUpdate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.disable_clickjack_protection_headers", "false"), + resource.TestCheckResourceAttr("auth0_tenant.my_tenant", "flags.0.enable_public_signup_user_exists_error", "true"), + ), + }, }, }) } @@ -106,6 +108,7 @@ resource "auth0_tenant" "my_tenant" { ` const testAccTenantConfigUpdate = ` + resource "auth0_tenant" "my_tenant" { change_password { enabled = true diff --git a/auth0/resource_auth0_user.go b/auth0/resource_auth0_user.go index e4a6057a..c46a371f 100644 --- a/auth0/resource_auth0_user.go +++ b/auth0/resource_auth0_user.go @@ -9,8 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/structure" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" - "gopkg.in/auth0.v3" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" ) func newUser() *schema.Resource { diff --git a/auth0/resource_auth0_user_test.go b/auth0/resource_auth0_user_test.go index 33a0a10c..4ed6aaf7 100644 --- a/auth0/resource_auth0_user_test.go +++ b/auth0/resource_auth0_user_test.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" - "gopkg.in/auth0.v3/management" + "gopkg.in/auth0.v4/management" "github.com/terraform-providers/terraform-provider-auth0/auth0/internal/random" ) diff --git a/auth0/resource_data.go b/auth0/resource_data.go index f9a53d67..f399d54a 100644 --- a/auth0/resource_data.go +++ b/auth0/resource_data.go @@ -2,11 +2,12 @@ package auth0 import ( "reflect" + "strconv" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/structure" - "gopkg.in/auth0.v3" + "gopkg.in/auth0.v4" ) // Data generalises schema.ResourceData so that we can reuse the accessor @@ -20,6 +21,13 @@ type Data interface { // HasChange reports whether or not the given key has been changed. HasChange(key string) bool + // GetChange returns the old and new value for a given key. + GetChange(key string) (interface{}, interface{}) + + // Get returns the data for the given key, or nil if the key doesn't exist + // in the schema. + Get(key string) interface{} + // GetOkExists returns the data for a given key and whether or not the key // has been set to a non-zero value. This is only useful for determining // if boolean attributes have been set, if they are Optional but do not @@ -27,6 +35,34 @@ type Data interface { GetOkExists(key string) (interface{}, bool) } +type data struct { + prefix string + Data +} + +func dataAtKey(key string, d Data) Data { return &data{key, d} } +func dataAtIndex(i int, d Data) Data { return &data{strconv.Itoa(i), d} } + +func (d *data) IsNewResource() bool { + return d.Data.IsNewResource() +} + +func (d *data) HasChange(key string) bool { + return d.Data.HasChange(d.prefix + "." + key) +} + +func (d *data) GetChange(key string) (interface{}, interface{}) { + return d.Data.GetChange(d.prefix + "." + key) +} + +func (d *data) Get(key string) interface{} { + return d.Data.Get(d.prefix + "." + key) +} + +func (d *data) GetOkExists(key string) (interface{}, bool) { + return d.Data.GetOkExists(d.prefix + "." + key) +} + // MapData wraps a map satisfying the Data interface, so it can be used in the // accessor methods defined below. type MapData map[string]interface{} @@ -40,6 +76,14 @@ func (md MapData) HasChange(key string) bool { return ok } +func (md MapData) GetChange(key string) (interface{}, interface{}) { + return md[key], md[key] +} + +func (md MapData) Get(key string) interface{} { + return md[key] +} + func (md MapData) GetOkExists(key string) (interface{}, bool) { v, ok := md[key] return v, ok && !isNil(v) && !isZero(v) @@ -114,67 +158,115 @@ func Map(d Data, key string) (m map[string]interface{}) { } // List accesses the value held by key and returns an iterator able to go over -// the items of the list. -// -// The iterator can go over all the items in the list or just the first one, -// which is a common use case for defining nested schemas in Terraform. -func List(d Data, key string) *iterator { +// its elements. +func List(d Data, key string) Iterator { if d.IsNewResource() || d.HasChange(key) { v, ok := d.GetOkExists(key) if ok { - return &iterator{v.([]interface{})} + return &list{dataAtKey(key, d), v.([]interface{})} } } - return &iterator{} + return &list{} } // Set accesses the value held by key, type asserts it to a set and returns an -// iterator able to go over the items of the list. -func Set(d Data, key string) *iterator { +// iterator able to go over its elements. +func Set(d Data, key string) Iterator { if d.IsNewResource() || d.HasChange(key) { v, ok := d.GetOkExists(key) if ok { if s, ok := v.(*schema.Set); ok { - return &iterator{s.List()} + return &set{dataAtKey(key, d), s} } } } - return &iterator{} + return &set{nil, &schema.Set{}} } -type iterator struct { - i []interface{} +type Iterator interface { + + // Elem iterates over all elements of the list or set, calling fn with each + // iteration. + // + // The callback takes a Data interface as argument which is prefixed with + // its parents key, making nested data access more convenient. + // + // The operation + // + // bar = d.Get("foo.0.bar").(string) + // + // can be expressed as + // + // List(d, "foo").Elem(func (d Data) { + // bar = String(d, "bar") + // }) + // + // making data access more intuitive for nested structures. + Elem(func(d Data)) + + // Range iterates over all elements of the list, calling fn in each iteration. + Range(func(k int, v interface{})) + + // List returns the underlying list as a Go slice. + List() []interface{} +} + +type list struct { + d Data + v []interface{} +} + +func (l *list) Range(fn func(key int, value interface{})) { + for key, value := range l.v { + fn(key, value) + } +} + +func (l *list) Elem(fn func(Data)) { + for idx := range l.v { + fn(dataAtIndex(idx, l.d)) + } +} + +func (l *list) List() []interface{} { + return l.v +} + +type set struct { + d Data + s *schema.Set +} + +func (s *set) hash(item interface{}) string { + code := s.s.F(item) + if code < 0 { + code = -code + } + return strconv.Itoa(code) } -// All iterates over all elements of the list, calling f in each iteration. -func (i *iterator) All(f func(key int, value interface{})) { - for key, value := range i.i { - f(key, value) +func (s *set) Range(fn func(key int, value interface{})) { + for key, value := range s.s.List() { + fn(key, value) } } -// First iterates over the first element of the list, calling f with the value -// at the first key. -// -// The function f will be called at most one time, as the list may be empty. -func (i *iterator) First(f func(value interface{})) { - for _, value := range i.i { - f(value) - return +func (s *set) Elem(fn func(Data)) { + for _, v := range s.s.List() { + fn(dataAtKey(s.hash(v), s.d)) } } -// Slice returns the underlying list as a raw slice. -func (i *iterator) Slice() []interface{} { - return i.i +func (s *set) List() []interface{} { + return s.s.List() } -// Set accesses the value held by key, type asserts it to a set. It then -// compares it's changes if any and returns what needs to be added (created) and -// what needs to be removed (delete). -func Diff(d *schema.ResourceData, key string) (add []interface{}, rm []interface{}) { +// Diff accesses the value held by key and type asserts it to a set. It then +// compares it's changes if any and returns what needs to be added and what +// needs to be removed. +func Diff(d Data, key string) (add []interface{}, rm []interface{}) { if d.IsNewResource() { - add = Set(d, key).Slice() + add = Set(d, key).List() } if d.HasChange(key) { o, n := d.GetChange(key) diff --git a/auth0/structure_auth0_connection.go b/auth0/structure_auth0_connection.go new file mode 100644 index 00000000..310579d4 --- /dev/null +++ b/auth0/structure_auth0_connection.go @@ -0,0 +1,366 @@ +package auth0 + +import ( + "gopkg.in/auth0.v4" + "gopkg.in/auth0.v4/management" +) + +func flattenConnectionOptions(options interface{}) []interface{} { + + var m interface{} + + switch o := options.(type) { + case *management.ConnectionOptions: + m = flattenConnectionOptionsAuth0(o) + case *management.ConnectionOptionsGoogleOAuth2: + m = flattenConnectionOptionsGoogleOAuth2(o) + // case *management.ConnectionOptionsFacebook: + // m = flattenConnectionOptionsFacebook(o) + // case *management.ConnectionOptionsApple: + // m = flattenConnectionOptionsApple(o) + // case *management.ConnectionOptionsLinkedin: + // m = flattenConnectionOptionsLinkedin(o) + // case *management.ConnectionOptionsGitHub: + // m = flattenConnectionOptionsGitHub(o) + // case *management.ConnectionOptionsWindowsLive: + // m = flattenConnectionOptionsWindowsLive(o) + case *management.ConnectionOptionsSalesforce: + m = flattenConnectionOptionsSalesforce(o) + case *management.ConnectionOptionsEmail: + m = flattenConnectionOptionsEmail(o) + case *management.ConnectionOptionsSMS: + m = flattenConnectionOptionsSMS(o) + // case *management.ConnectionOptionsOIDC: + // m = flattenConnectionOptionsOIDC(o) + case *management.ConnectionOptionsAD: + m = flattenConnectionOptionsAD(o) + case *management.ConnectionOptionsAzureAD: + m = flattenConnectionOptionsAzureAD(o) + } + + return []interface{}{m} +} + +func flattenConnectionOptionsAuth0(o *management.ConnectionOptions) interface{} { + return map[string]interface{}{ + "validation": o.Validation, + "password_policy": o.GetPasswordPolicy(), + "password_history": o.PasswordHistory, + "password_no_personal_info": o.PasswordNoPersonalInfo, + "password_dictionary": o.PasswordDictionary, + "password_complexity_options": o.PasswordComplexityOptions, + "enabled_database_customization": o.GetEnabledDatabaseCustomization(), + "brute_force_protection": o.GetBruteForceProtection(), + "import_mode": o.GetImportMode(), + "disable_signup": o.GetDisableSignup(), + "requires_username": o.GetRequiresUsername(), + "custom_scripts": o.CustomScripts, + "configuration": o.Configuration, + } +} + +func flattenConnectionOptionsGoogleOAuth2(o *management.ConnectionOptionsGoogleOAuth2) interface{} { + return map[string]interface{}{ + "client_id": o.GetClientID(), + "client_secret": o.GetClientSecret(), + "allowed_audiences": o.AllowedAudiences, + "scopes": o.Scopes(), + } +} + +func flattenConnectionOptionsSalesforce(o *management.ConnectionOptionsSalesforce) interface{} { + return map[string]interface{}{ + "client_id": o.GetClientID(), + "client_secret": o.GetClientSecret(), + "community_base_url": o.GetCommunityBaseURL(), + "scopes": o.Scopes(), + } +} + +func flattenConnectionOptionsSMS(o *management.ConnectionOptionsSMS) interface{} { + return map[string]interface{}{ + "name": o.GetName(), + "from": o.GetFrom(), + "syntax": o.GetSyntax(), + "template": o.GetTemplate(), + "twilio_sid": o.GetTwilioSID(), + "twilio_token": o.GetTwilioToken(), + "messaging_service_sid": o.GetMessagingServiceSID(), + "disable_signup": o.GetDisableSignup(), + "brute_force_protection": o.GetBruteForceProtection(), + "totp": map[string]interface{}{ + "time_step": o.OTP.GetTimeStep(), + "length": o.OTP.GetLength(), + }, + } +} + +func flattenConnectionOptionsEmail(o *management.ConnectionOptionsEmail) interface{} { + return map[string]interface{}{ + "name": o.GetName(), + "from": o.GetEmail().GetFrom(), + "syntax": o.GetEmail().GetSyntax(), + "subject": o.GetEmail().GetSubject(), + "template": o.GetEmail().GetBody(), + "disable_signup": o.GetDisableSignup(), + "brute_force_protection": o.GetBruteForceProtection(), + "totp": map[string]interface{}{ + "time_step": o.OTP.GetTimeStep(), + "length": o.OTP.GetLength(), + }, + } +} + +func flattenConnectionOptionsAD(o *management.ConnectionOptionsAD) interface{} { + return map[string]interface{}{ + "tenant_domain": o.GetTenantDomain(), + "domain_aliases": o.DomainAliases, + "icon_url": o.GetLogoURL(), + "ips": o.IPs, + "use_cert_auth": o.GetCertAuth(), + "use_kerberos": o.GetKerberos(), + "disable_cache": o.GetDisableCache(), + "brute_force_protection": o.GetBruteForceProtection(), + } +} + +func flattenConnectionOptionsAzureAD(o *management.ConnectionOptionsAzureAD) interface{} { + return map[string]interface{}{ + "client_id": o.GetClientID(), + "client_secret": o.GetClientSecret(), + "app_id": o.GetAppID(), + "tenant_domain": o.GetTenantDomain(), + "domain": o.GetDomain(), + "domain_aliases": o.DomainAliases, + "icon_url": o.GetLogoURL(), + "identity_api": o.GetIdentityAPI(), + "waad_protocol": o.GetWAADProtocol(), + "waad_common_endpoint": o.GetUseCommonEndpoint(), + "use_wsfed": o.GetUseWSFederation(), + "api_enable_users": o.GetEnableUsersAPI(), + "max_groups_to_retrieve": o.GetMaxGroupsToRetrieve(), + "scopes": o.Scopes(), + } +} + +func expandConnection(d Data) *management.Connection { + + c := &management.Connection{ + Name: String(d, "name"), + IsDomainConnection: Bool(d, "is_domain_connection"), + Strategy: String(d, "strategy"), + EnabledClients: Set(d, "enabled_clients").List(), + Realms: Slice(d, "realms"), + } + + s := d.Get("strategy").(string) + + List(d, "options").Elem(func(d Data) { + switch s { + case management.ConnectionStrategyAuth0: + c.Options = expandConnectionOptionsAuth0(d) + case management.ConnectionStrategyGoogleOAuth2: + c.Options = expandConnectionOptionsGoogleOAuth2(d) + // case management.ConnectionStrategyFacebook + // management.ConnectionStrategyApple + // management.ConnectionStrategyLinkedin + // management.ConnectionStrategyGitHub + // management.ConnectionStrategyWindowsLive: + case management.ConnectionStrategySalesforce, + management.ConnectionStrategySalesforceCommunity, + management.ConnectionStrategySalesforceSandbox: + c.Options = expandConnectionOptionsSalesforce(d) + case management.ConnectionStrategySMS: + c.Options = expandConnectionOptionsSMS(d) + // case management.ConnectionStrategyOIDC: + case management.ConnectionStrategyAD: + c.Options = expandConnectionOptionsAD(d) + case management.ConnectionStrategyAzureAD: + c.Options = expandConnectionOptionsAzureAD(d) + } + }) + + return c +} + +func expandConnectionOptionsAuth0(d Data) *management.ConnectionOptions { + + o := &management.ConnectionOptions{ + Validation: Map(d, "validation"), + PasswordPolicy: String(d, "password_policy"), + } + + List(d, "password_history").Elem(func(d Data) { + o.PasswordHistory = make(map[string]interface{}) + o.PasswordHistory["enable"] = Bool(d, "enable") + o.PasswordHistory["size"] = Int(d, "size") + }) + + List(d, "password_no_personal_info").Elem(func(d Data) { + o.PasswordNoPersonalInfo = make(map[string]interface{}) + o.PasswordNoPersonalInfo["enable"] = Bool(d, "enable") + }) + + List(d, "password_dictionary").Elem(func(d Data) { + o.PasswordDictionary = make(map[string]interface{}) + o.PasswordDictionary["enable"] = Bool(d, "enable") + o.PasswordDictionary["dictionary"] = Set(d, "dictionary").List() + }) + + List(d, "password_complexity_options").Elem(func(d Data) { + o.PasswordComplexityOptions = make(map[string]interface{}) + o.PasswordComplexityOptions["min_length"] = Int(d, "min_length") + }) + + o.EnabledDatabaseCustomization = Bool(d, "enabled_database_customization") + o.BruteForceProtection = Bool(d, "brute_force_protection") + o.ImportMode = Bool(d, "import_mode") + o.DisableSignup = Bool(d, "disable_signup") + o.RequiresUsername = Bool(d, "requires_username") + o.CustomScripts = Map(d, "custom_scripts") + o.Configuration = Map(d, "configuration") + + return o +} + +func expandConnectionOptionsGoogleOAuth2(d Data) *management.ConnectionOptionsGoogleOAuth2 { + + o := &management.ConnectionOptionsGoogleOAuth2{ + ClientID: String(d, "client_id"), + ClientSecret: String(d, "client_secret"), + AllowedAudiences: Set(d, "allowed_audiences").List(), + } + + expandConnectionOptionsScopes(d, o) + + return o +} + +func expandConnectionOptionsSalesforce(d Data) *management.ConnectionOptionsSalesforce { + + o := &management.ConnectionOptionsSalesforce{ + ClientID: String(d, "client_id"), + ClientSecret: String(d, "client_secret"), + CommunityBaseURL: String(d, "community_base_url"), + } + + expandConnectionOptionsScopes(d, o) + + return o +} + +func expandConnectionOptionsSMS(d Data) *management.ConnectionOptionsSMS { + + o := &management.ConnectionOptionsSMS{ + Name: String(d, "name"), + From: String(d, "from"), + Syntax: String(d, "syntax"), + Template: String(d, "template"), + TwilioSID: String(d, "twilio_sid"), + TwilioToken: String(d, "twilio_token"), + MessagingServiceSID: String(d, "messaging_service_sid"), + DisableSignup: Bool(d, "disable_signup"), + BruteForceProtection: Bool(d, "brute_force_protection"), + } + + List(d, "totp").Elem(func(d Data) { + o.OTP = &management.ConnectionOptionsOTP{ + TimeStep: Int(d, "time_step"), + Length: Int(d, "length"), + } + }) + + return o +} + +func expandConnectionOptionsEmail(d Data) *management.ConnectionOptionsEmail { + + o := &management.ConnectionOptionsEmail{ + Name: String(d, "name"), + DisableSignup: Bool(d, "disable_signup"), + Email: &management.ConnectionOptionsEmailSettings{ + Syntax: String(d, "syntax"), + From: String(d, "from"), + Subject: String(d, "subject"), + Body: String(d, "template"), + }, + BruteForceProtection: Bool(d, "brute_force_protection"), + } + + List(d, "totp").Elem(func(d Data) { + o.OTP = &management.ConnectionOptionsOTP{ + TimeStep: Int(d, "time_step"), + Length: Int(d, "length"), + } + }) + + return o +} + +func expandConnectionOptionsAD(d Data) *management.ConnectionOptionsAD { + + o := &management.ConnectionOptionsAD{ + DomainAliases: Set(d, "domain_aliases").List(), + TenantDomain: String(d, "tenant_domain"), + LogoURL: String(d, "icon_url"), + IPs: Set(d, "ips").List(), + CertAuth: Bool(d, "use_cert_auth"), + Kerberos: Bool(d, "use_kerberos"), + DisableCache: Bool(d, "disable_cache"), + } + + // `brute_force_protection` will default to true by the API if we don't + // specify it. Therefore if it's not specified we'll set it to false + // ourselves. + v, ok := d.GetOkExists("brute_force_protection") + if !ok { + v = false + } + o.BruteForceProtection = auth0.Bool(v.(bool)) + + return o +} + +func expandConnectionOptionsAzureAD(d Data) *management.ConnectionOptionsAzureAD { + + o := &management.ConnectionOptionsAzureAD{ + ClientID: String(d, "client_id"), + ClientSecret: String(d, "client_secret"), + AppID: String(d, "app_id"), + Domain: String(d, "domain"), + DomainAliases: Set(d, "domain_aliases").List(), + TenantDomain: String(d, "tenant_domain"), + MaxGroupsToRetrieve: String(d, "max_groups_to_retrieve"), + UseWSFederation: Bool(d, "use_wsfed"), + WAADProtocol: String(d, "waad_protocol"), + UseCommonEndpoint: Bool(d, "waad_common_endpoint"), + EnableUsersAPI: Bool(d, "api_enable_users"), + LogoURL: String(d, "icon_url"), + IdentityAPI: String(d, "identity_api"), + } + + add, rm := Diff(d, "scopes") + for _, scope := range add { + o.SetScopes(true, scope.(string)) + } + for _, scope := range rm { + o.SetScopes(false, scope.(string)) + } + + return o +} + +type scoper interface { + Scopes() []string + SetScopes(enable bool, scopes ...string) +} + +func expandConnectionOptionsScopes(d Data, s scoper) { + add, rm := Diff(d, "scopes") + for _, scope := range add { + s.SetScopes(true, scope.(string)) + } + for _, scope := range rm { + s.SetScopes(false, scope.(string)) + } +} diff --git a/auth0/structure_auth0_tenant.go b/auth0/structure_auth0_tenant.go new file mode 100644 index 00000000..7ccd2a36 --- /dev/null +++ b/auth0/structure_auth0_tenant.go @@ -0,0 +1,124 @@ +package auth0 + +import "gopkg.in/auth0.v4/management" + +func flattenTenantChangePassword(cp *management.TenantChangePassword) []interface{} { + return []interface{}{ + map[string]interface{}{ + "enabled": cp.Enabled, + "html": cp.HTML, + }, + } +} + +func flattenTenantGuardianMFAPage(mfa *management.TenantGuardianMFAPage) []interface{} { + return []interface{}{ + map[string]interface{}{ + "enabled": mfa.Enabled, + "html": mfa.HTML, + }, + } +} + +func flattenTenantErrorPage(ep *management.TenantErrorPage) []interface{} { + return []interface{}{ + map[string]interface{}{ + "html": ep.HTML, + "show_log_link": ep.ShowLogLink, + "url": ep.URL, + }, + } +} + +func flattenTenantFlags(f *management.TenantFlags) []interface{} { + return []interface{}{ + map[string]interface{}{ + "change_pwd_flow_v1": f.ChangePasswordFlowV1, + "enable_client_connections": f.EnableClientConnections, + "enable_apis_section": f.EnableAPIsSection, + "enable_pipeline2": f.EnablePipeline2, + "enable_dynamic_client_registration": f.EnableDynamicClientRegistration, + "enable_custom_domain_in_emails": f.EnableCustomDomainInEmails, + "universal_login": f.UniversalLogin, + "enable_legacy_logs_search_v2": f.EnableLegacyLogsSearchV2, + "disable_clickjack_protection_headers": f.DisableClickjackProtectionHeaders, + "enable_public_signup_user_exists_error": f.EnablePublicSignupUserExistsError, + }, + } +} + +func flattenTenantUniversalLogin(ul *management.TenantUniversalLogin) []interface{} { + return []interface{}{ + map[string]interface{}{ + "colors": []interface{}{ + map[string]interface{}{ + "primary": ul.Colors.Primary, + "page_background": ul.Colors.PageBackground, + }, + }, + }, + } +} + +func expandTenantChangePassword(d Data) (c *management.TenantChangePassword) { + List(d, "change_password").Elem(func(d Data) { + c = &management.TenantChangePassword{ + Enabled: Bool(d, "enabled"), + HTML: String(d, "html"), + } + }) + return +} + +func expandTenantGuardianMFAPage(d Data) (mfa *management.TenantGuardianMFAPage) { + List(d, "guardian_mfa_page").Elem(func(d Data) { + mfa = &management.TenantGuardianMFAPage{ + Enabled: Bool(d, "enabled"), + HTML: String(d, "html"), + } + }) + return +} + +func expandTenantErrorPage(d Data) (e *management.TenantErrorPage) { + List(d, "error_page").Elem(func(d Data) { + e = &management.TenantErrorPage{ + HTML: String(d, "html"), + ShowLogLink: Bool(d, "show_log_link"), + URL: String(d, "url"), + } + }) + return +} + +func expandTenantFlags(d Data) (f *management.TenantFlags) { + List(d, "flags").Elem(func(d Data) { + f = &management.TenantFlags{ + ChangePasswordFlowV1: Bool(d, "change_pwd_flow_v1"), + EnableClientConnections: Bool(d, "enable_client_connections"), + EnableAPIsSection: Bool(d, "enable_apis_section"), + EnablePipeline2: Bool(d, "enable_pipeline2"), + EnableDynamicClientRegistration: Bool(d, "enable_dynamic_client_registration"), + EnableCustomDomainInEmails: Bool(d, "enable_custom_domain_in_emails"), + UniversalLogin: Bool(d, "universal_login"), + EnableLegacyLogsSearchV2: Bool(d, "enable_legacy_logs_search_v2"), + DisableClickjackProtectionHeaders: Bool(d, "disable_clickjack_protection_headers"), + EnablePublicSignupUserExistsError: Bool(d, "enable_public_signup_user_exists_error"), + } + }) + return +} + +func expandTenantUniversalLogin(d Data) (u *management.TenantUniversalLogin) { + List(d, "universal_login").Elem(func(d Data) { + List(d, "colors").Elem(func(d Data) { + u = &management.TenantUniversalLogin{ + Colors: &management.TenantUniversalLoginColors{ + Primary: String(d, "primary"), + PageBackground: String(d, "page_background"), + }, + } + }) + }) + return +} diff --git a/go.mod b/go.mod index ca1bfe1f..de7c9670 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,6 @@ go 1.13 require ( github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/terraform-plugin-sdk v1.7.0 - gopkg.in/auth0.v3 v3.3.0 + gopkg.in/auth0.v3 v3.3.1 // indirect + gopkg.in/auth0.v4 v4.0.0 ) diff --git a/go.sum b/go.sum index 6f7b5b0d..89108fc8 100644 --- a/go.sum +++ b/go.sum @@ -120,6 +120,7 @@ github.com/hashicorp/terraform-json v0.4.0 h1:KNh29iNxozP5adfUFBJ4/fWd0Cu3taGgjH github.com/hashicorp/terraform-json v0.4.0/go.mod h1:eAbqb4w0pSlRmdvl8fOyHAi/+8jnkVYN28gJkSJrLhU= github.com/hashicorp/terraform-plugin-sdk v1.7.0 h1:B//oq0ZORG+EkVrIJy0uPGSonvmXqxSzXe8+GhknoW0= github.com/hashicorp/terraform-plugin-sdk v1.7.0/go.mod h1:OjgQmey5VxnPej/buEhe+YqKm0KNvV3QqU4hkqHqPCY= +github.com/hashicorp/terraform-plugin-sdk v1.8.0 h1:HE1p52nzcgz88hIJmapUnkmM9noEjV3QhTOLaua5XUA= github.com/hashicorp/terraform-plugin-test v1.2.0 h1:AWFdqyfnOj04sxTdaAF57QqvW7XXrT8PseUHkbKsE8I= github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs= github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 h1:hjyO2JsNZUKT1ym+FAdlBEkGPevazYsmVgIMw7dVELg= @@ -313,6 +314,22 @@ gopkg.in/auth0.v3 v3.3.0 h1:3ZqNIUL5F1kCFrNHtyJuFTGkwIuUdqwJKF9dWCOSDtQ= gopkg.in/auth0.v3 v3.3.0 h1:3ZqNIUL5F1kCFrNHtyJuFTGkwIuUdqwJKF9dWCOSDtQ= gopkg.in/auth0.v3 v3.3.0/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= gopkg.in/auth0.v3 v3.3.0/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v3 v3.3.1 h1:kuTBSbLIaYjVVPDZSJ6AfCQD3BBDdVt/asBfRWMQCRg= +gopkg.in/auth0.v3 v3.3.1/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v3 v3.3.2-0.20200317162509-44e06b7558ee h1:emQM7UZS8JqEyAItkNULkFjkfJCefti8dXj5+dcFYPE= +gopkg.in/auth0.v3 v3.3.2-0.20200317162509-44e06b7558ee/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v3 v3.3.2-0.20200317162919-7e58d0062144 h1:5ShcjkfnJZ0Yvn6jVa2CcPjiMR8sJGSpAGgDcJ6kljY= +gopkg.in/auth0.v3 v3.3.2-0.20200317162919-7e58d0062144/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v3 v3.3.2-0.20200318121556-ea58ce781c43 h1:Tp+7r9S84T/zAqZRTO23E4U4amvMmtzbM7K0OCNAaj8= +gopkg.in/auth0.v3 v3.3.2-0.20200318121556-ea58ce781c43/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v3 v3.3.2-0.20200318162921-8b428984d2df h1:hi8ob8DOWQFL6U8anGl+9nfH0Qpf3rn0Yshb24fXQVs= +gopkg.in/auth0.v3 v3.3.2-0.20200318162921-8b428984d2df/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v3 v3.3.2-0.20200319085324-6c64ab4169d1 h1:qBnH3CR7qP1GgWbLx1L/edKqgtg98n03Zr/RGC9qstE= +gopkg.in/auth0.v3 v3.3.2-0.20200319085324-6c64ab4169d1/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v3 v3.3.2-0.20200319092025-3a598d35f91f h1:zKbLCtx+ezRRPpBx2uPt7627HvQ46+hjD7N6HPWV9VU= +gopkg.in/auth0.v3 v3.3.2-0.20200319092025-3a598d35f91f/go.mod h1:Ov66ahVcsIQ4WIPyJosrlQ4F8KjyZ6EbIHD+7fauhE0= +gopkg.in/auth0.v4 v4.0.0 h1:kNoNf2W5xCCKCTYt593HX4jg2Jo4C0LmjCCyIfvrDcs= +gopkg.in/auth0.v4 v4.0.0/go.mod h1:B9QUu0MG0np724IVcwWu/azhsckQ+3/niPVtQEThPlU= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= diff --git a/vendor/gopkg.in/auth0.v3/management/connection.go b/vendor/gopkg.in/auth0.v3/management/connection.go deleted file mode 100644 index af64257b..00000000 --- a/vendor/gopkg.in/auth0.v3/management/connection.go +++ /dev/null @@ -1,191 +0,0 @@ -package management - -type Connection struct { - // A generated string identifying the connection. - ID *string `json:"id,omitempty"` - - // The name of the connection. Must start and end with an alphanumeric - // character and can only contain alphanumeric characters and '-'. Max - // length 128. - Name *string `json:"name,omitempty"` - - // The identity provider identifier for the connection. Can be any of the - // following: - // - // "ad", "adfs", "amazon", "dropbox", "bitbucket", "aol", "auth0-adldap", - // "auth0-oidc", "auth0", "baidu", "bitly", "box", "custom", "daccount", - // "dwolla", "email", "evernote-sandbox", "evernote", "exact", "facebook", - // "fitbit", "flickr", "github", "google-apps", "google-oauth2", "guardian", - // "instagram", "ip", "linkedin", "miicard", "oauth1", "oauth2", - // "office365", "paypal", "paypal-sandbox", "pingfederate", - // "planningcenter", "renren", "salesforce-community", "salesforce-sandbox", - // "salesforce", "samlp", "sharepoint", "shopify", "sms", "soundcloud", - // "thecity-sandbox", "thecity", "thirtysevensignals", "twitter", "untappd", - // "vkontakte", "waad", "weibo", "windowslive", "wordpress", "yahoo", - // "yammer" or "yandex". - Strategy *string `json:"strategy,omitempty"` - - // True if the connection is domain level - IsDomainConnection *bool `json:"is_domain_connection,omitempty"` - - // Options for validation. - Options *ConnectionOptions `json:"options,omitempty"` - - // The identifiers of the clients for which the connection is to be - // enabled. If the array is empty or the property is not specified, no - // clients are enabled. - EnabledClients []interface{} `json:"enabled_clients,omitempty"` - - // Defines the realms for which the connection will be used (ie: email - // domains). If the array is empty or the property is not specified, the - // connection name will be added as realm. - Realms []interface{} `json:"realms,omitempty"` - - Metadata *interface{} `json:"metadata,omitempty"` -} - -// ConnectionOptions general options -type ConnectionOptions struct { - // Options for validation. - Validation map[string]interface{} `json:"validation,omitempty"` - - // Password strength level, can be one of: - // "none", "low", "fair", "good", "excellent" or null. - PasswordPolicy *string `json:"passwordPolicy,omitempty"` - - // Options for password history policy. - PasswordHistory map[string]interface{} `json:"password_history,omitempty"` - - // Options for password expiration policy. - PasswordNoPersonalInfo map[string]interface{} `json:"password_no_personal_info,omitempty"` - - // Options for password dictionary policy. - PasswordDictionary map[string]interface{} `json:"password_dictionary,omitempty"` - - // Options for password complexity options. - PasswordComplexityOptions map[string]interface{} `json:"password_complexity_options,omitempty"` - - APIEnableUsers *bool `json:"api_enable_users,omitempty"` - BasicProfile *bool `json:"basic_profile,omitempty"` - ExtAdmin *bool `json:"ext_admin,omitempty"` - ExtIsSuspended *bool `json:"ext_is_suspended,omitempty"` - ExtAgreedTerms *bool `json:"ext_agreed_terms,omitempty"` - ExtGroups *bool `json:"ext_groups,omitempty"` - ExtNestedGroups *bool `json:"ext_nested_groups,omitempty"` - ExtAssignedPlans *bool `json:"ext_assigned_plans,omitempty"` - ExtProfile *bool `json:"ext_profile,omitempty"` - EnabledDatabaseCustomization *bool `json:"enabledDatabaseCustomization,omitempty"` - BruteForceProtection *bool `json:"brute_force_protection,omitempty"` - ImportMode *bool `json:"import_mode,omitempty"` - DisableSignup *bool `json:"disable_signup,omitempty"` - RequiresUsername *bool `json:"requires_username,omitempty"` - - // Options for adding parameters in the request to the upstream IdP. - UpstreamParams *interface{} `json:"upstream_params,omitempty"` - - ClientID *string `json:"client_id,omitempty"` - ClientSecret *string `json:"client_secret,omitempty"` - TenantDomain *string `json:"tenant_domain,omitempty"` - DomainAliases []interface{} `json:"domain_aliases,omitempty"` - UseWsfed *bool `json:"use_wsfed,omitempty"` - WaadProtocol *string `json:"waad_protocol,omitempty"` - WaadCommonEndpoint *bool `json:"waad_common_endpoint,omitempty"` - AppID *string `json:"app_id,omitempty"` - AppDomain *string `json:"app_domain,omitempty"` - MaxGroupsToRetrieve *string `json:"max_groups_to_retrieve,omitempty"` - - // Scripts for the connection - // Allowed keys are: "get_user", "login", "create", "verify", "change_password", "delete" or "change_email". - CustomScripts map[string]interface{} `json:"customScripts,omitempty"` - // configuration variables that can be used in custom scripts - Configuration map[string]interface{} `json:"configuration,omitempty"` - - // Options to add integration with Twilio - // https://community.auth0.com/t/using-management-api-to-create-a-twilio-connection/23576/3 - Totp *ConnectionOptionsTotp `json:"totp,omitempty"` - Name *string `json:"name,omitempty"` - TwilioSid *string `json:"twilio_sid,omitempty"` - TwilioToken *string `json:"twilio_token,omitempty"` - From *string `json:"from,omitempty"` - Syntax *string `json:"syntax,omitempty"` - Template *string `json:"template,omitempty"` - MessagingServiceSid *string `json:"messaging_service_sid,omitempty"` - - // Adfs - AdfsServer *string `json:"adfs_server,omitempty"` - - // Salesforce community - CommunityBaseURL *string `json:"community_base_url"` -} - -type ConnectionManager struct { - *Management -} - -type ConnectionOptionsTotp struct { - TimeStep *int `json:"time_step,omitempty"` - Length *int `json:"length,omitempty"` -} - -type ConnectionList struct { - List - Connections []*Connection `json:"connections"` -} - -func newConnectionManager(m *Management) *ConnectionManager { - return &ConnectionManager{m} -} - -// Create a new connection. -// -// See: https://auth0.com/docs/api/management/v2#!/Connections/post_connections -func (m *ConnectionManager) Create(c *Connection) error { - return m.post(m.uri("connections"), c) -} - -// Read retrieves a connection by its id. -// -// See: https://auth0.com/docs/api/management/v2#!/Connections/get_connections_by_id -func (m *ConnectionManager) Read(id string) (c *Connection, err error) { - err = m.get(m.uri("connections", id), &c) - return -} - -// List all connections. -// -// See: https://auth0.com/docs/api/management/v2#!/Connections/get_connections -func (m *ConnectionManager) List(opts ...ListOption) (c *ConnectionList, err error) { - opts = m.defaults(opts) - err = m.get(m.uri("connections")+m.q(opts), &c) - return -} - -// Update a connection. -// -// Note: if you use the options parameter, the whole options object will be -// overridden, so ensure that all parameters are present. -// -// See: https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id -func (m *ConnectionManager) Update(id string, c *Connection) (err error) { - return m.patch(m.uri("connections", id), c) -} - -// Delete a connection and all its users. -// -// See: https://auth0.com/docs/api/management/v2#!/Connections/delete_connections_by_id -func (m *ConnectionManager) Delete(id string) (err error) { - return m.delete(m.uri("connections", id)) -} - -// ReadByName retrieves a connection by its name. This is a helper method when a -// connection id is not readily available. -func (m *ConnectionManager) ReadByName(name string) (*Connection, error) { - c, err := m.List(Parameter("name", name)) - if err != nil { - return nil, err - } - if len(c.Connections) > 0 { - return c.Connections[0], nil - } - return nil, &managementError{404, "Not Found", "Connection not found"} -} diff --git a/vendor/gopkg.in/auth0.v3/.gitignore b/vendor/gopkg.in/auth0.v4/.gitignore similarity index 100% rename from vendor/gopkg.in/auth0.v3/.gitignore rename to vendor/gopkg.in/auth0.v4/.gitignore diff --git a/vendor/gopkg.in/auth0.v3/LICENSE b/vendor/gopkg.in/auth0.v4/LICENSE similarity index 100% rename from vendor/gopkg.in/auth0.v3/LICENSE rename to vendor/gopkg.in/auth0.v4/LICENSE diff --git a/vendor/gopkg.in/auth0.v3/README.md b/vendor/gopkg.in/auth0.v4/README.md similarity index 97% rename from vendor/gopkg.in/auth0.v3/README.md rename to vendor/gopkg.in/auth0.v4/README.md index eab870dd..e2d5d30a 100644 --- a/vendor/gopkg.in/auth0.v3/README.md +++ b/vendor/gopkg.in/auth0.v4/README.md @@ -1,6 +1,6 @@ # Auth0 Go SDK -[![GoDoc](https://godoc.org/gopkg.in/auth0.v3?status.svg)](https://godoc.org/gopkg.in/auth0.v3) +[![GoDoc](https://godoc.org/gopkg.in/auth0.v4?status.svg)](https://godoc.org/gopkg.in/auth0.v4) [![build status](https://img.shields.io/github/workflow/status/go-auth0/auth0/Go)](https://github.com/go-auth0/auth0/actions?query=workflow%3ABuild+branch%3Amaster) [![Maintainability](https://img.shields.io/codeclimate/maintainability/go-auth0/auth0)](https://codeclimate.com/github/go-auth0/auth0/maintainability) [![Test Coverage](https://img.shields.io/codeclimate/coverage/go-auth0/auth0)](https://codeclimate.com/github/go-auth0/auth0/test_coverage) @@ -17,8 +17,8 @@ The Auth0 Management API is meant to be used by back-end servers or trusted part ```go import ( - gopkg.in/auth0.v3 - gopkg.in/auth0.v3/management + gopkg.in/auth0.v4 + gopkg.in/auth0.v4/management ) ``` diff --git a/vendor/gopkg.in/auth0.v3/auth0.go b/vendor/gopkg.in/auth0.v4/auth0.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/auth0.go rename to vendor/gopkg.in/auth0.v4/auth0.go diff --git a/vendor/gopkg.in/auth0.v3/doc.go b/vendor/gopkg.in/auth0.v4/doc.go similarity index 96% rename from vendor/gopkg.in/auth0.v3/doc.go rename to vendor/gopkg.in/auth0.v4/doc.go index 37f4d50f..9b39de15 100644 --- a/vendor/gopkg.in/auth0.v3/doc.go +++ b/vendor/gopkg.in/auth0.v4/doc.go @@ -4,8 +4,8 @@ Package auth0 provides a client for using the Auth0 Management API. Usage import ( - gopkg.in/auth0.v3 - gopkg.in/auth0.v3/management + gopkg.in/auth0.v4 + gopkg.in/auth0.v4/management ) Initialize a new client using a domain, client ID and secret. diff --git a/vendor/gopkg.in/auth0.v3/go.mod b/vendor/gopkg.in/auth0.v4/go.mod similarity index 85% rename from vendor/gopkg.in/auth0.v3/go.mod rename to vendor/gopkg.in/auth0.v4/go.mod index 966fb4d3..d607fdbd 100644 --- a/vendor/gopkg.in/auth0.v3/go.mod +++ b/vendor/gopkg.in/auth0.v4/go.mod @@ -1,4 +1,4 @@ -module gopkg.in/auth0.v3 +module gopkg.in/auth0.v4 go 1.12 diff --git a/vendor/gopkg.in/auth0.v3/go.sum b/vendor/gopkg.in/auth0.v4/go.sum similarity index 100% rename from vendor/gopkg.in/auth0.v3/go.sum rename to vendor/gopkg.in/auth0.v4/go.sum diff --git a/vendor/gopkg.in/auth0.v3/internal/client/client.go b/vendor/gopkg.in/auth0.v4/internal/client/client.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/internal/client/client.go rename to vendor/gopkg.in/auth0.v4/internal/client/client.go diff --git a/vendor/gopkg.in/auth0.v4/internal/tag/tag.go b/vendor/gopkg.in/auth0.v4/internal/tag/tag.go new file mode 100644 index 00000000..6d6bb615 --- /dev/null +++ b/vendor/gopkg.in/auth0.v4/internal/tag/tag.go @@ -0,0 +1,67 @@ +package tag + +import ( + "reflect" +) + +func Scopes(v interface{}) (scopes []string) { + + val := reflect.ValueOf(v) + if val.Kind() == reflect.Ptr { + val = val.Elem() + + } + typ := val.Type() + + for i := 0; i < typ.NumField(); i++ { + + if scope, ok := typ.Field(i).Tag.Lookup("scope"); ok { + if scope != "" { + field := val.Field(i) + if field.Kind() == reflect.Ptr { + field = field.Elem() + } + if field.CanAddr() && field.Bool() { + scopes = append(scopes, scope) + } + } + } + } + + return +} + +func SetScopes(v interface{}, enable bool, scopes ...string) { + + val := reflect.ValueOf(v) + if val.Kind() == reflect.Ptr { + val = val.Elem() + + } + typ := val.Type() + + in := func(scope string, scopes []string) bool { + for _, s := range scopes { + if s == scope { + return true + } + } + return false + } + + for i := 0; i < typ.NumField(); i++ { + + if scope, ok := typ.Field(i).Tag.Lookup("scope"); ok { + if in(scope, scopes) { + field := val.Field(i) + v := reflect.ValueOf(enable) + if field.Kind() == reflect.Ptr { + v = reflect.ValueOf(&enable) + } + if field.CanSet() { + field.Set(v) + } + } + } + } +} diff --git a/vendor/gopkg.in/auth0.v3/management/blacklist.go b/vendor/gopkg.in/auth0.v4/management/blacklist.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/blacklist.go rename to vendor/gopkg.in/auth0.v4/management/blacklist.go diff --git a/vendor/gopkg.in/auth0.v3/management/branding.go b/vendor/gopkg.in/auth0.v4/management/branding.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/branding.go rename to vendor/gopkg.in/auth0.v4/management/branding.go diff --git a/vendor/gopkg.in/auth0.v3/management/client.go b/vendor/gopkg.in/auth0.v4/management/client.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/client.go rename to vendor/gopkg.in/auth0.v4/management/client.go diff --git a/vendor/gopkg.in/auth0.v3/management/client_grant.go b/vendor/gopkg.in/auth0.v4/management/client_grant.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/client_grant.go rename to vendor/gopkg.in/auth0.v4/management/client_grant.go diff --git a/vendor/gopkg.in/auth0.v4/management/connection.go b/vendor/gopkg.in/auth0.v4/management/connection.go new file mode 100644 index 00000000..5f54e821 --- /dev/null +++ b/vendor/gopkg.in/auth0.v4/management/connection.go @@ -0,0 +1,624 @@ +package management + +import ( + "encoding/json" + + "gopkg.in/auth0.v4/internal/tag" +) + +const ( + ConnectionStrategyAuth0 = "auth0" + ConnectionStrategyGoogleOAuth2 = "google-oauth2" + ConnectionStrategyFacebook = "facebook" + ConnectionStrategyApple = "apple" + ConnectionStrategyLinkedin = "linkedin" + ConnectionStrategyGitHub = "github" + ConnectionStrategyWindowsLive = "windowslive" + ConnectionStrategySalesforce = "salesforce" + ConnectionStrategySalesforceCommunity = "salesforce-community" + ConnectionStrategySalesforceSandbox = "salesforce-sandbox" + ConnectionStrategyEmail = "email" + ConnectionStrategySMS = "sms" + ConnectionStrategyOIDC = "oidc" + ConnectionStrategyAD = "ad" + ConnectionStrategyAzureAD = "waad" +) + +type Connection struct { + // A generated string identifying the connection. + ID *string `json:"id,omitempty"` + + // The name of the connection. Must start and end with an alphanumeric + // character and can only contain alphanumeric characters and '-'. Max + // length 128. + Name *string `json:"name,omitempty"` + + // The identity provider identifier for the connection. Can be any of the + // following: + // + // "ad", "adfs", "amazon", "dropbox", "bitbucket", "aol", "auth0-adldap", + // "auth0-oidc", "auth0", "baidu", "bitly", "box", "custom", "daccount", + // "dwolla", "email", "evernote-sandbox", "evernote", "exact", "facebook", + // "fitbit", "flickr", "github", "google-apps", "google-oauth2", "guardian", + // "instagram", "ip", "linkedin", "miicard", "oauth1", "oauth2", + // "office365", "paypal", "paypal-sandbox", "pingfederate", + // "planningcenter", "renren", "salesforce-community", "salesforce-sandbox", + // "salesforce", "samlp", "sharepoint", "shopify", "sms", "soundcloud", + // "thecity-sandbox", "thecity", "thirtysevensignals", "twitter", "untappd", + // "vkontakte", "waad", "weibo", "windowslive", "wordpress", "yahoo", + // "yammer" or "yandex". + Strategy *string `json:"strategy,omitempty"` + + // True if the connection is domain level + IsDomainConnection *bool `json:"is_domain_connection,omitempty"` + + // Options for validation. + Options interface{} `json:"-"` + RawOptions json.RawMessage `json:"options,omitempty"` + + // The identifiers of the clients for which the connection is to be + // enabled. If the array is empty or the property is not specified, no + // clients are enabled. + EnabledClients []interface{} `json:"enabled_clients,omitempty"` + + // Defines the realms for which the connection will be used (ie: email + // domains). If the array is empty or the property is not specified, the + // connection name will be added as realm. + Realms []interface{} `json:"realms,omitempty"` + + Metadata *interface{} `json:"metadata,omitempty"` +} + +func (c *Connection) MarshalJSON() ([]byte, error) { + + type connection Connection + + if c.Options != nil { + b, err := json.Marshal(c.Options) + if err != nil { + return nil, err + } + c.RawOptions = b + } + + return json.Marshal((*connection)(c)) +} + +func (c *Connection) UnmarshalJSON(b []byte) error { + + type connection Connection + + err := json.Unmarshal(b, (*connection)(c)) + if err != nil { + return err + } + + if c.Strategy != nil { + + var v interface{} + + switch *c.Strategy { + case ConnectionStrategyAuth0: + v = &ConnectionOptions{} + case ConnectionStrategyGoogleOAuth2: + v = &ConnectionOptionsGoogleOAuth2{} + case ConnectionStrategyFacebook: + v = &ConnectionOptionsFacebook{} + case ConnectionStrategyApple: + v = &ConnectionOptionsApple{} + case ConnectionStrategyLinkedin: + v = &ConnectionOptionsLinkedin{} + case ConnectionStrategyGitHub: + v = &ConnectionOptionsGitHub{} + case ConnectionStrategyWindowsLive: + v = &ConnectionOptionsWindowsLive{} + case ConnectionStrategySalesforce, + ConnectionStrategySalesforceCommunity, + ConnectionStrategySalesforceSandbox: + v = &ConnectionOptionsSalesforce{} + case ConnectionStrategyEmail: + v = &ConnectionOptionsEmail{} + case ConnectionStrategySMS: + v = &ConnectionOptionsSMS{} + case ConnectionStrategyOIDC: + v = &ConnectionOptionsOIDC{} + case ConnectionStrategyAD: + v = &ConnectionOptionsAD{} + case ConnectionStrategyAzureAD: + v = &ConnectionOptionsAzureAD{} + default: + v = make(map[string]interface{}) + } + + err = json.Unmarshal(c.RawOptions, &v) + if err != nil { + return err + } + + c.Options = v + } + + return nil +} + +type ConnectionOptions struct { + + // Options for multifactor authentication. Can be used to set active and + // return_enroll_settings. + MFA map[string]interface{} `json:"mfa,omitempty"` + + // Options for validation. + Validation map[string]interface{} `json:"validation,omitempty"` + + // Password strength level, can be one of: + // "none", "low", "fair", "good", "excellent" or null. + PasswordPolicy *string `json:"passwordPolicy,omitempty"` + + // Options for password history policy. + PasswordHistory map[string]interface{} `json:"password_history,omitempty"` + + // Options for password expiration policy. + PasswordNoPersonalInfo map[string]interface{} `json:"password_no_personal_info,omitempty"` + + // Options for password dictionary policy. + PasswordDictionary map[string]interface{} `json:"password_dictionary,omitempty"` + + // Options for password complexity options. + PasswordComplexityOptions map[string]interface{} `json:"password_complexity_options,omitempty"` + + EnabledDatabaseCustomization *bool `json:"enabledDatabaseCustomization,omitempty"` + + BruteForceProtection *bool `json:"brute_force_protection,omitempty"` + + ImportMode *bool `json:"import_mode,omitempty"` + + DisableSignup *bool `json:"disable_signup,omitempty"` + + RequiresUsername *bool `json:"requires_username,omitempty"` + + // Scripts for the connection + // Allowed keys are: "get_user", "login", "create", "verify", "change_password", "delete" or "change_email". + CustomScripts map[string]interface{} `json:"customScripts,omitempty"` + // configuration variables that can be used in custom scripts + Configuration map[string]interface{} `json:"configuration,omitempty"` + + StrategyVersion *int `json:"strategy_version"` +} + +type ConnectionOptionsGoogleOAuth2 struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + AllowedAudiences []interface{} `json:"allowed_audiences,omitempty"` + + Email *bool `json:"email,omitempty" scope:"email"` + Profile *bool `json:"profile,omitempty" scope:"profile"` + Contacts *bool `json:"contacts,omitempty" scope:"contacts"` + Blogger *bool `json:"blogger,omitempty" scope:"blogger"` + Calendar *bool `json:"calendar,omitempty" scope:"calendar"` + Gmail *bool `json:"gmail,omitempty" scope:"gmail"` + GooglePlus *bool `json:"google_plus,omitempty" scope:"google_plus"` + Orkut *bool `json:"orkut,omitempty" scope:"orkut"` + PicasaWeb *bool `json:"picasa_web,omitempty" scope:"picasa_web"` + Tasks *bool `json:"tasks,omitempty" scope:"tasks"` + Youtube *bool `json:"youtube,omitempty" scope:"youtube"` + AdsenseManagement *bool `json:"adsense_management,omitempty" scope:"adsense_management"` + GoogleAffiliateNetwork *bool `json:"google_affiliate_network,omitempty" scope:"google_affiliate_network"` + Analytics *bool `json:"analytics,omitempty" scope:"analytics"` + GoogleBooks *bool `json:"google_books,omitempty" scope:"google_books"` + GoogleCloudStorage *bool `json:"google_cloud_storage,omitempty" scope:"google_cloud_storage"` + ContentAPIForShopping *bool `json:"content_api_for_shopping,omitempty" scope:"content_api_for_shopping"` + ChromeWebStore *bool `json:"chrome_web_store,omitempty" scope:"chrome_web_store"` + DocumentList *bool `json:"document_list,omitempty" scope:"document_list"` + GoogleDrive *bool `json:"google_drive,omitempty" scope:"google_drive"` + GoogleDriveFiles *bool `json:"google_drive_files,omitempty" scope:"google_drive_files"` + LatitudeBest *bool `json:"latitude_best,omitempty" scope:"latitude_best"` + LatitudeCity *bool `json:"latitude_city,omitempty" scope:"latitude_city"` + Moderator *bool `json:"moderator,omitempty" scope:"moderator"` + Sites *bool `json:"sites,omitempty" scope:"sites"` + Spreadsheets *bool `json:"spreadsheets,omitempty" scope:"spreadsheets"` + URLShortener *bool `json:"url_shortener,omitempty" scope:"url_shortener"` + WebmasterTools *bool `json:"webmaster_tools,omitempty" scope:"webmaster_tools"` + Coordinate *bool `json:"coordinate,omitempty" scope:"coordinate"` + CoordinateReadonly *bool `json:"coordinate_readonly,omitempty" scope:"coordinate_readonly"` + + Scope []interface{} `json:"scope,omitempty"` +} + +func (c *ConnectionOptionsGoogleOAuth2) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsGoogleOAuth2) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsFacebook struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + AllowContextProfileField *bool `json:"allow_context_profile_field,omitempty"` + + Email *bool `json:"email,omitempty" scope:"email"` + GroupsAccessMemberInfo *bool `json:"groups_access_member_info,omitempty" scope:"groups_access_member_info"` + PublishToGroups *bool `json:"publish_to_groups,omitempty" scope:"publish_to_groups"` + UserAgeRange *bool `json:"user_age_range,omitempty" scope:"user_age_range"` + UserBirthday *bool `json:"user_birthday,omitempty" scope:"user_birthday"` + AdsManagement *bool `json:"ads_management,omitempty" scope:"ads_management"` + AdsRead *bool `json:"ads_read,omitempty" scope:"ads_read"` + ReadAudienceNetworkInsights *bool `json:"read_audience_network_insights,omitempty" scope:"read_audience_network_insights"` + ReadInsights *bool `json:"read_insights,omitempty" scope:"read_insights"` + ManageNotifications *bool `json:"manage_notifications,omitempty" scope:"manage_notifications"` + PublishActions *bool `json:"publish_actions,omitempty" scope:"publish_actions"` + ReadMailbox *bool `json:"read_mailbox,omitempty" scope:"read_mailbox"` + PublicProfile *bool `json:"public_profile,omitempty" scope:"public_profile"` + UserEvents *bool `json:"user_events,omitempty" scope:"user_events"` + UserFriends *bool `json:"user_friends,omitempty" scope:"user_friends"` + UserGender *bool `json:"user_gender,omitempty" scope:"user_gender"` + UserHometown *bool `json:"user_hometown,omitempty" scope:"user_hometown"` + UserLikes *bool `json:"user_likes,omitempty" scope:"user_likes"` + UserLink *bool `json:"user_link,omitempty" scope:"user_link"` + UserLocation *bool `json:"user_location,omitempty" scope:"user_location"` + UserPhotos *bool `json:"user_photos,omitempty" scope:"user_photos"` + UserPosts *bool `json:"user_posts,omitempty" scope:"user_posts"` + UserTaggedPlaces *bool `json:"user_tagged_places,omitempty" scope:"user_tagged_places"` + UserVideos *bool `json:"user_videos,omitempty" scope:"user_videos"` + BusinessManagement *bool `json:"business_management,omitempty" scope:"business_management"` + LeadsRetrieval *bool `json:"leads_retrieval,omitempty" scope:"leads_retrieval"` + ManagePages *bool `json:"manage_pages,omitempty" scope:"manage_pages"` + PagesManageCTA *bool `json:"pages_manage_cta,omitempty" scope:"pages_manage_cta"` + PagesManageInstantArticles *bool `json:"pages_manage_instant_articles,omitempty" scope:"pages_manage_instant_articles"` + PagesShowList *bool `json:"pages_show_list,omitempty" scope:"pages_show_list"` + PagesMessaging *bool `json:"pages_messaging,omitempty" scope:"pages_messaging"` + PagesMessagingPhoneNumber *bool `json:"pages_messaging_phone_number,omitempty" scope:"pages_messaging_phone_number"` + PagesMessagingSubscriptions *bool `json:"pages_messaging_subscriptions,omitempty" scope:"pages_messaging_subscriptions"` + PublishPages *bool `json:"publish_pages,omitempty" scope:"publish_pages"` + PublishVideo *bool `json:"publish_video,omitempty" scope:"publish_video"` + ReadPageMailboxes *bool `json:"read_page_mailboxes,omitempty" scope:"read_page_mailboxes"` + ReadStream *bool `json:"read_stream,omitempty" scope:"read_stream"` + UserGroups *bool `json:"user_groups,omitempty" scope:"user_groups"` + UserManagedGroups *bool `json:"user_managed_groups,omitempty" scope:"user_managed_groups"` + UserStatus *bool `json:"user_status,omitempty" scope:"user_status"` + + // Scope is a comma separated list of scopes. + Scope *string `json:"scope,omitempty"` +} + +func (c *ConnectionOptionsFacebook) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsFacebook) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsApple struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"app_secret,omitempty"` + + TeamID *string `json:"team_id,omitempty"` + KeyID *string `json:"kid,omitempty"` + + Name *bool `json:"name,omitempty" scope:"name"` + Email *bool `json:"email,omitempty" scope:"email"` + + Scope *string `json:"scope,omitempty"` +} + +func (c *ConnectionOptionsApple) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsApple) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsLinkedin struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + StrategyVersion *int `json:"strategy_version"` + + Email *bool `json:"email,omitempty" scope:"email"` + Profile *bool `json:"profile,omitempty" scope:"profile"` + BasicProfile *bool `json:"basic_profile,omitempty" scope:"basic_profile"` + + Scope []interface{} `json:"scope,omitempty"` + + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` +} + +func (c *ConnectionOptionsLinkedin) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsLinkedin) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsGitHub struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + Email *bool `json:"email,omitempty" scope:"email"` + ReadUser *bool `json:"read_user,omitempty" scope:"read_user"` + Follow *bool `json:"follow,omitempty" scope:"follow"` + PublicRepo *bool `json:"public_repo,omitempty" scope:"public_repo"` + Repo *bool `json:"repo,omitempty" scope:"repo"` + RepoDeployment *bool `json:"repo_deployment,omitempty" scope:"repo_deployment"` + RepoStatus *bool `json:"repo_status,omitempty" scope:"repo_status"` + DeleteRepo *bool `json:"delete_repo,omitempty" scope:"delete_repo"` + Notifications *bool `json:"notifications,omitempty" scope:"notifications"` + Gist *bool `json:"gist,omitempty" scope:"gist"` + ReadRepoHook *bool `json:"read_repo_hook,omitempty" scope:"read_repo_hook"` + WriteRepoHook *bool `json:"write_repo_hook,omitempty" scope:"write_repo_hook"` + AdminRepoHook *bool `json:"admin_repo_hook,omitempty" scope:"admin_repo_hook"` + ReadOrg *bool `json:"read_org,omitempty" scope:"read_org"` + AdminOrg *bool `json:"admin_org,omitempty" scope:"admin_org"` + ReadPublicKey *bool `json:"read_public_key,omitempty" scope:"read_public_key"` + WritePublicKey *bool `json:"write_public_key,omitempty" scope:"write_public_key"` + AdminPublicKey *bool `json:"admin_public_key,omitempty" scope:"admin_public_key"` + WriteOrg *bool `json:"write_org,omitempty" scope:"write_org"` + Profile *bool `json:"profile,omitempty" scope:"profile"` + + Scope []interface{} `json:"scope,omitempty"` + + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` +} + +func (c *ConnectionOptionsGitHub) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsGitHub) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsEmail struct { + Name *string `json:"name,omitempty"` + Email *ConnectionOptionsEmailSettings `json:"email,omitempty"` + OTP *ConnectionOptionsOTP `json:"totp,omitempty"` + + DisableSignup *bool `json:"disable_signup,omitempty"` + BruteForceProtection *bool `json:"brute_force_protection,omitempty"` +} + +type ConnectionOptionsEmailSettings struct { + Syntax *string `json:"syntax,omitempty"` + From *string `json:"from,omitempty"` + Subject *string `json:"subject,omitempty"` + Body *string `json:"body,omitempty"` +} + +type ConnectionOptionsOTP struct { + TimeStep *int `json:"time_step,omitempty"` + Length *int `json:"length,omitempty"` +} + +type ConnectionOptionsSMS struct { + Name *string `json:"name,omitempty"` + From *string `json:"from,omitempty"` + Syntax *string `json:"syntax,omitempty"` + Template *string `json:"template,omitempty"` + + OTP *ConnectionOptionsOTP `json:"totp,omitempty"` + + TwilioSID *string `json:"twilio_sid"` + TwilioToken *string `json:"twilio_token"` + MessagingServiceSID *string `json:"messaging_service_sid"` + + DisableSignup *bool `json:"disable_signup,omitempty"` + BruteForceProtection *bool `json:"brute_force_protection,omitempty"` +} + +type ConnectionOptionsWindowsLive struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + StrategyVersion *int `json:"strategy_version"` + + OfflineAccess *bool `json:"offline_access,omitempty" scope:"offline_access"` + UserUpdate *bool `json:"graph_user_update,omitempty" scope:"graph_user_update"` + UserActivity *bool `json:"graph_user_activity,omitempty" scope:"graph_user_activity"` + Device *bool `json:"graph_device,omitempty" scope:"graph_device"` + Emails *bool `json:"graph_emails,omitempty" scope:"graph_emails"` + NotesUpdate *bool `json:"graph_notes_update,omitempty" scope:"graph_notes_update"` + User *bool `json:"graph_user,omitempty" scope:"graph_user"` + DeviceCommand *bool `json:"graph_device_command,omitempty" scope:"graph_device_command"` + EmailsUpdate *bool `json:"graph_emails_update,omitempty" scope:"graph_emails_update"` + Calendars *bool `json:"graph_calendars,omitempty" scope:"graph_calendars"` + CalendarsUpdate *bool `json:"graph_calendars_update,omitempty" scope:"graph_calendars_update"` + Contacts *bool `json:"graph_contacts,omitempty" scope:"graph_contacts"` + ContactsUpdate *bool `json:"graph_contacts_update,omitempty" scope:"graph_contacts_update"` + Files *bool `json:"graph_files,omitempty" scope:"graph_files"` + FilesAll *bool `json:"graph_files_all,omitempty" scope:"graph_files_all"` + FilesUpdate *bool `json:"graph_files_update,omitempty" scope:"graph_files_update"` + FilesAllUpdate *bool `json:"graph_files_all_update,omitempty" scope:"graph_files_all_update"` + Notes *bool `json:"graph_notes,omitempty" scope:"graph_notes"` + NotesCreate *bool `json:"graph_notes_create,omitempty" scope:"graph_notes_create"` + Tasks *bool `json:"graph_tasks,omitempty" scope:"graph_tasks"` + TasksUpdate *bool `json:"graph_tasks_update,omitempty" scope:"graph_tasks_update"` + Signin *bool `json:"signin,omitempty" scope:"signin"` + + Scope []interface{} `json:"scope,omitempty"` + + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` +} + +func (c *ConnectionOptionsWindowsLive) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsWindowsLive) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsSalesforce struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + Profile *bool `json:"profile,omitempty" scope:"profile"` + + Scope []interface{} `json:"scope,omitempty"` + + CommunityBaseURL *string `json:"community_base_url,omitempty"` + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` +} + +func (c *ConnectionOptionsSalesforce) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsSalesforce) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsOIDC struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + TenantDomain *string `json:"tenant_domain,omitempty"` + DomainAliases []interface{} `json:"domain_aliases,omitempty"` + LogoURL *string `json:"icon_url,omitempty"` + + DiscoveryURL *string `json:"discovery_url"` + AuthorizationEndpoint *string `json:"authorization_endpoint"` + Issuer *string `json:"issuer"` + JWKSURI *string `json:"jwks_uri"` + Type *string `json:"type"` + UserInfoEndpoint *string `json:"userinfo_endpoint"` + TokenEndpoint *string `json:"token_endpoint"` + + Scope *string `json:"scope,omitempty"` +} + +type ConnectionOptionsAD struct { + TenantDomain *string `json:"tenant_domain,omitempty"` + DomainAliases []interface{} `json:"domain_aliases,omitempty"` + LogoURL *string `json:"icon_url,omitempty"` + IPs []interface{} `json:"ips"` + + CertAuth *bool `json:"certAuth,omitempty"` + Kerberos *bool `json:"kerberos,omitempty"` + DisableCache *bool `json:"disable_cache,omitempty"` + BruteForceProtection *bool `json:"brute_force_protection,omitempty"` + + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` +} + +type ConnectionOptionsAzureAD struct { + ClientID *string `json:"client_id,omitempty"` + ClientSecret *string `json:"client_secret,omitempty"` + + AppID *string `json:"app_id,omitempty"` + TenantDomain *string `json:"tenant_domain,omitempty"` + Domain *string `json:"domain,omitempty"` + DomainAliases []interface{} `json:"domain_aliases,omitempty"` + LogoURL *string `json:"icon_url,omitempty"` + + IdentityAPI *string `json:"identity_api"` + + WAADProtocol *string `json:"waad_protocol,omitempty"` + WAADCommonEndpoint *bool `json:"waad_common_endpoint,omitempty"` + + UseWSFederation *bool `json:"use_wsfed,omitempty"` + UseCommonEndpoint *bool `json:"useCommonEndpoint,omitempty"` + EnableUsersAPI *bool `json:"api_enable_users,omitempty"` + MaxGroupsToRetrieve *string `json:"max_groups_to_retrieve,omitempty"` + + BasicProfile *bool `json:"basic_profile,omitempty" scope:"basic_profile"` + ExtendedProfile *bool `json:"ext_profile,omitempty" scope:"ext_profile"` + Groups *bool `json:"ext_groups,omitempty" scope:"ext_groups"` + NestedGroups *bool `json:"ext_nested_groups,omitempty" scope:"ext_nested_groups"` + Admin *bool `json:"ext_admin,omitempty" scope:"ext_admin"` + IsSuspended *bool `json:"ext_is_suspended,omitempty" scope:"ext_is_suspended"` + AgreedTerms *bool `json:"ext_agreed_terms,omitempty" scope:"ext_agreed_terms"` + AssignedPlans *bool `json:"ext_assigned_plans,omitempty" scope:"ext_assigned_plans"` +} + +func (c *ConnectionOptionsAzureAD) Scopes() []string { + return tag.Scopes(c) +} + +func (c *ConnectionOptionsAzureAD) SetScopes(enable bool, scopes ...string) { + tag.SetScopes(c, true, scopes...) +} + +type ConnectionOptionsADFS struct { + TenantDomain *string `json:"tenant_domain,omitempty"` + DomainAliases []interface{} `json:"domain_aliases,omitempty"` + LogoURL *string `json:"icon_url,omitempty"` + ADFSServer *string `json:"adfs_server,omitempty"` + + EnableUsersAPI *bool `json:"api_enable_users,omitempty"` + + // Set to on_first_login to avoid setting user attributes at each login. + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` +} + +type ConnectionManager struct { + *Management +} + +type ConnectionList struct { + List + Connections []*Connection `json:"connections"` +} + +func newConnectionManager(m *Management) *ConnectionManager { + return &ConnectionManager{m} +} + +// Create a new connection. +// +// See: https://auth0.com/docs/api/management/v2#!/Connections/post_connections +func (m *ConnectionManager) Create(c *Connection) error { + return m.post(m.uri("connections"), c) +} + +// Read retrieves a connection by its id. +// +// See: https://auth0.com/docs/api/management/v2#!/Connections/get_connections_by_id +func (m *ConnectionManager) Read(id string) (c *Connection, err error) { + err = m.get(m.uri("connections", id), &c) + return +} + +// List all connections. +// +// See: https://auth0.com/docs/api/management/v2#!/Connections/get_connections +func (m *ConnectionManager) List(opts ...ListOption) (c *ConnectionList, err error) { + opts = m.defaults(opts) + err = m.get(m.uri("connections")+m.q(opts), &c) + return +} + +// Update a connection. +// +// Note: if you use the options parameter, the whole options object will be +// overridden, so ensure that all parameters are present. +// +// See: https://auth0.com/docs/api/management/v2#!/Connections/patch_connections_by_id +func (m *ConnectionManager) Update(id string, c *Connection) (err error) { + return m.patch(m.uri("connections", id), c) +} + +// Delete a connection and all its users. +// +// See: https://auth0.com/docs/api/management/v2#!/Connections/delete_connections_by_id +func (m *ConnectionManager) Delete(id string) (err error) { + return m.delete(m.uri("connections", id)) +} + +// ReadByName retrieves a connection by its name. This is a helper method when a +// connection id is not readily available. +func (m *ConnectionManager) ReadByName(name string) (*Connection, error) { + c, err := m.List(Parameter("name", name)) + if err != nil { + return nil, err + } + if len(c.Connections) > 0 { + return c.Connections[0], nil + } + return nil, &managementError{404, "Not Found", "Connection not found"} +} diff --git a/vendor/gopkg.in/auth0.v3/management/custom_domain.go b/vendor/gopkg.in/auth0.v4/management/custom_domain.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/custom_domain.go rename to vendor/gopkg.in/auth0.v4/management/custom_domain.go diff --git a/vendor/gopkg.in/auth0.v3/management/email.go b/vendor/gopkg.in/auth0.v4/management/email.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/email.go rename to vendor/gopkg.in/auth0.v4/management/email.go diff --git a/vendor/gopkg.in/auth0.v3/management/email_template.go b/vendor/gopkg.in/auth0.v4/management/email_template.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/email_template.go rename to vendor/gopkg.in/auth0.v4/management/email_template.go diff --git a/vendor/gopkg.in/auth0.v3/management/grant.go b/vendor/gopkg.in/auth0.v4/management/grant.go similarity index 74% rename from vendor/gopkg.in/auth0.v3/management/grant.go rename to vendor/gopkg.in/auth0.v4/management/grant.go index ff3c1665..b9c6e81f 100644 --- a/vendor/gopkg.in/auth0.v3/management/grant.go +++ b/vendor/gopkg.in/auth0.v4/management/grant.go @@ -32,3 +32,9 @@ func (m *GrantManager) List(opts ...ListOption) (g []*Grant, err error) { err = m.get(m.uri("grants")+m.q(opts), &g) return } + +// Delete revokes a grant associated with a user-id +// https://auth0.com/docs/api/management/v2#!/Grants/delete_grants_by_id +func (m *GrantManager) Delete(id string, opts ...ListOption) error { + return m.delete(m.uri("grants", id) + m.q(opts)) +} diff --git a/vendor/gopkg.in/auth0.v3/management/guardian.go b/vendor/gopkg.in/auth0.v4/management/guardian.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/guardian.go rename to vendor/gopkg.in/auth0.v4/management/guardian.go diff --git a/vendor/gopkg.in/auth0.v3/management/hook.go b/vendor/gopkg.in/auth0.v4/management/hook.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/hook.go rename to vendor/gopkg.in/auth0.v4/management/hook.go diff --git a/vendor/gopkg.in/auth0.v3/management/job.go b/vendor/gopkg.in/auth0.v4/management/job.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/job.go rename to vendor/gopkg.in/auth0.v4/management/job.go diff --git a/vendor/gopkg.in/auth0.v3/management/log.go b/vendor/gopkg.in/auth0.v4/management/log.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/log.go rename to vendor/gopkg.in/auth0.v4/management/log.go diff --git a/vendor/gopkg.in/auth0.v3/management/management.gen.go b/vendor/gopkg.in/auth0.v4/management/management.gen.go similarity index 54% rename from vendor/gopkg.in/auth0.v3/management/management.gen.go rename to vendor/gopkg.in/auth0.v4/management/management.gen.go index c1b81cbb..4961c5dd 100644 --- a/vendor/gopkg.in/auth0.v3/management/management.gen.go +++ b/vendor/gopkg.in/auth0.v4/management/management.gen.go @@ -381,14 +381,6 @@ func (c *Connection) GetName() string { return *c.Name } -// GetOptions returns the Options field. -func (c *Connection) GetOptions() *ConnectionOptions { - if c == nil { - return nil - } - return c.Options -} - // GetStrategy returns the Strategy field if it's non-nil, zero value otherwise. func (c *Connection) GetStrategy() string { if c == nil || c.Strategy == nil { @@ -407,56 +399,175 @@ func (c *ConnectionList) String() string { return Stringify(c) } -// GetAdfsServer returns the AdfsServer field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetAdfsServer() string { - if c == nil || c.AdfsServer == nil { - return "" +// GetBruteForceProtection returns the BruteForceProtection field if it's non-nil, zero value otherwise. +func (c *ConnectionOptions) GetBruteForceProtection() bool { + if c == nil || c.BruteForceProtection == nil { + return false } - return *c.AdfsServer + return *c.BruteForceProtection } -// GetAPIEnableUsers returns the APIEnableUsers field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetAPIEnableUsers() bool { - if c == nil || c.APIEnableUsers == nil { +// GetDisableSignup returns the DisableSignup field if it's non-nil, zero value otherwise. +func (c *ConnectionOptions) GetDisableSignup() bool { + if c == nil || c.DisableSignup == nil { return false } - return *c.APIEnableUsers + return *c.DisableSignup } -// GetAppDomain returns the AppDomain field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetAppDomain() string { - if c == nil || c.AppDomain == nil { - return "" +// GetEnabledDatabaseCustomization returns the EnabledDatabaseCustomization field if it's non-nil, zero value otherwise. +func (c *ConnectionOptions) GetEnabledDatabaseCustomization() bool { + if c == nil || c.EnabledDatabaseCustomization == nil { + return false } - return *c.AppDomain + return *c.EnabledDatabaseCustomization } -// GetAppID returns the AppID field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetAppID() string { - if c == nil || c.AppID == nil { +// GetImportMode returns the ImportMode field if it's non-nil, zero value otherwise. +func (c *ConnectionOptions) GetImportMode() bool { + if c == nil || c.ImportMode == nil { + return false + } + return *c.ImportMode +} + +// GetPasswordPolicy returns the PasswordPolicy field if it's non-nil, zero value otherwise. +func (c *ConnectionOptions) GetPasswordPolicy() string { + if c == nil || c.PasswordPolicy == nil { return "" } - return *c.AppID + return *c.PasswordPolicy } -// GetBasicProfile returns the BasicProfile field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetBasicProfile() bool { - if c == nil || c.BasicProfile == nil { +// GetRequiresUsername returns the RequiresUsername field if it's non-nil, zero value otherwise. +func (c *ConnectionOptions) GetRequiresUsername() bool { + if c == nil || c.RequiresUsername == nil { return false } - return *c.BasicProfile + return *c.RequiresUsername +} + +// GetStrategyVersion returns the StrategyVersion field if it's non-nil, zero value otherwise. +func (c *ConnectionOptions) GetStrategyVersion() int { + if c == nil || c.StrategyVersion == nil { + return 0 + } + return *c.StrategyVersion +} + +// String returns a string representation of ConnectionOptions. +func (c *ConnectionOptions) String() string { + return Stringify(c) } // GetBruteForceProtection returns the BruteForceProtection field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetBruteForceProtection() bool { +func (c *ConnectionOptionsAD) GetBruteForceProtection() bool { if c == nil || c.BruteForceProtection == nil { return false } return *c.BruteForceProtection } +// GetCertAuth returns the CertAuth field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAD) GetCertAuth() bool { + if c == nil || c.CertAuth == nil { + return false + } + return *c.CertAuth +} + +// GetDisableCache returns the DisableCache field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAD) GetDisableCache() bool { + if c == nil || c.DisableCache == nil { + return false + } + return *c.DisableCache +} + +// GetKerberos returns the Kerberos field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAD) GetKerberos() bool { + if c == nil || c.Kerberos == nil { + return false + } + return *c.Kerberos +} + +// GetLogoURL returns the LogoURL field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAD) GetLogoURL() string { + if c == nil || c.LogoURL == nil { + return "" + } + return *c.LogoURL +} + +// GetSetUserAttributes returns the SetUserAttributes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAD) GetSetUserAttributes() string { + if c == nil || c.SetUserAttributes == nil { + return "" + } + return *c.SetUserAttributes +} + +// GetTenantDomain returns the TenantDomain field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAD) GetTenantDomain() string { + if c == nil || c.TenantDomain == nil { + return "" + } + return *c.TenantDomain +} + +// String returns a string representation of ConnectionOptionsAD. +func (c *ConnectionOptionsAD) String() string { + return Stringify(c) +} + +// GetADFSServer returns the ADFSServer field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsADFS) GetADFSServer() string { + if c == nil || c.ADFSServer == nil { + return "" + } + return *c.ADFSServer +} + +// GetEnableUsersAPI returns the EnableUsersAPI field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsADFS) GetEnableUsersAPI() bool { + if c == nil || c.EnableUsersAPI == nil { + return false + } + return *c.EnableUsersAPI +} + +// GetLogoURL returns the LogoURL field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsADFS) GetLogoURL() string { + if c == nil || c.LogoURL == nil { + return "" + } + return *c.LogoURL +} + +// GetSetUserAttributes returns the SetUserAttributes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsADFS) GetSetUserAttributes() string { + if c == nil || c.SetUserAttributes == nil { + return "" + } + return *c.SetUserAttributes +} + +// GetTenantDomain returns the TenantDomain field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsADFS) GetTenantDomain() string { + if c == nil || c.TenantDomain == nil { + return "" + } + return *c.TenantDomain +} + +// String returns a string representation of ConnectionOptionsADFS. +func (c *ConnectionOptionsADFS) String() string { + return Stringify(c) +} + // GetClientID returns the ClientID field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetClientID() string { +func (c *ConnectionOptionsApple) GetClientID() string { if c == nil || c.ClientID == nil { return "" } @@ -464,244 +575,1643 @@ func (c *ConnectionOptions) GetClientID() string { } // GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetClientSecret() string { +func (c *ConnectionOptionsApple) GetClientSecret() string { if c == nil || c.ClientSecret == nil { return "" } return *c.ClientSecret } -// GetCommunityBaseURL returns the CommunityBaseURL field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetCommunityBaseURL() string { - if c == nil || c.CommunityBaseURL == nil { - return "" +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsApple) GetEmail() bool { + if c == nil || c.Email == nil { + return false } - return *c.CommunityBaseURL + return *c.Email } -// GetDisableSignup returns the DisableSignup field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetDisableSignup() bool { - if c == nil || c.DisableSignup == nil { - return false +// GetKeyID returns the KeyID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsApple) GetKeyID() string { + if c == nil || c.KeyID == nil { + return "" } - return *c.DisableSignup + return *c.KeyID } -// GetEnabledDatabaseCustomization returns the EnabledDatabaseCustomization field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetEnabledDatabaseCustomization() bool { - if c == nil || c.EnabledDatabaseCustomization == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsApple) GetName() bool { + if c == nil || c.Name == nil { return false } - return *c.EnabledDatabaseCustomization + return *c.Name } -// GetExtAdmin returns the ExtAdmin field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetExtAdmin() bool { - if c == nil || c.ExtAdmin == nil { - return false +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsApple) GetScope() string { + if c == nil || c.Scope == nil { + return "" } - return *c.ExtAdmin + return *c.Scope } -// GetExtAgreedTerms returns the ExtAgreedTerms field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetExtAgreedTerms() bool { - if c == nil || c.ExtAgreedTerms == nil { - return false +// GetTeamID returns the TeamID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsApple) GetTeamID() string { + if c == nil || c.TeamID == nil { + return "" } - return *c.ExtAgreedTerms + return *c.TeamID +} + +// String returns a string representation of ConnectionOptionsApple. +func (c *ConnectionOptionsApple) String() string { + return Stringify(c) } -// GetExtAssignedPlans returns the ExtAssignedPlans field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetExtAssignedPlans() bool { - if c == nil || c.ExtAssignedPlans == nil { +// GetAdmin returns the Admin field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetAdmin() bool { + if c == nil || c.Admin == nil { return false } - return *c.ExtAssignedPlans + return *c.Admin } -// GetExtGroups returns the ExtGroups field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetExtGroups() bool { - if c == nil || c.ExtGroups == nil { +// GetAgreedTerms returns the AgreedTerms field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetAgreedTerms() bool { + if c == nil || c.AgreedTerms == nil { return false } - return *c.ExtGroups + return *c.AgreedTerms } -// GetExtIsSuspended returns the ExtIsSuspended field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetExtIsSuspended() bool { - if c == nil || c.ExtIsSuspended == nil { - return false +// GetAppID returns the AppID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetAppID() string { + if c == nil || c.AppID == nil { + return "" } - return *c.ExtIsSuspended + return *c.AppID } -// GetExtNestedGroups returns the ExtNestedGroups field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetExtNestedGroups() bool { - if c == nil || c.ExtNestedGroups == nil { +// GetAssignedPlans returns the AssignedPlans field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetAssignedPlans() bool { + if c == nil || c.AssignedPlans == nil { return false } - return *c.ExtNestedGroups + return *c.AssignedPlans } -// GetExtProfile returns the ExtProfile field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetExtProfile() bool { - if c == nil || c.ExtProfile == nil { +// GetBasicProfile returns the BasicProfile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetBasicProfile() bool { + if c == nil || c.BasicProfile == nil { return false } - return *c.ExtProfile + return *c.BasicProfile } -// GetFrom returns the From field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetFrom() string { - if c == nil || c.From == nil { +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetClientID() string { + if c == nil || c.ClientID == nil { return "" } - return *c.From + return *c.ClientID } -// GetImportMode returns the ImportMode field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetImportMode() bool { - if c == nil || c.ImportMode == nil { - return false +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" } - return *c.ImportMode + return *c.ClientSecret } -// GetMaxGroupsToRetrieve returns the MaxGroupsToRetrieve field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetMaxGroupsToRetrieve() string { - if c == nil || c.MaxGroupsToRetrieve == nil { +// GetDomain returns the Domain field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetDomain() string { + if c == nil || c.Domain == nil { return "" } - return *c.MaxGroupsToRetrieve + return *c.Domain } -// GetMessagingServiceSid returns the MessagingServiceSid field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetMessagingServiceSid() string { - if c == nil || c.MessagingServiceSid == nil { - return "" +// GetEnableUsersAPI returns the EnableUsersAPI field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetEnableUsersAPI() bool { + if c == nil || c.EnableUsersAPI == nil { + return false } - return *c.MessagingServiceSid + return *c.EnableUsersAPI } -// GetName returns the Name field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetName() string { - if c == nil || c.Name == nil { - return "" +// GetExtendedProfile returns the ExtendedProfile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetExtendedProfile() bool { + if c == nil || c.ExtendedProfile == nil { + return false } - return *c.Name + return *c.ExtendedProfile } -// GetPasswordPolicy returns the PasswordPolicy field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetPasswordPolicy() string { - if c == nil || c.PasswordPolicy == nil { +// GetGroups returns the Groups field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetGroups() bool { + if c == nil || c.Groups == nil { + return false + } + return *c.Groups +} + +// GetIdentityAPI returns the IdentityAPI field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetIdentityAPI() string { + if c == nil || c.IdentityAPI == nil { return "" } - return *c.PasswordPolicy + return *c.IdentityAPI } -// GetRequiresUsername returns the RequiresUsername field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetRequiresUsername() bool { - if c == nil || c.RequiresUsername == nil { +// GetIsSuspended returns the IsSuspended field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetIsSuspended() bool { + if c == nil || c.IsSuspended == nil { return false } - return *c.RequiresUsername + return *c.IsSuspended } -// GetSyntax returns the Syntax field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetSyntax() string { - if c == nil || c.Syntax == nil { +// GetLogoURL returns the LogoURL field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetLogoURL() string { + if c == nil || c.LogoURL == nil { return "" } - return *c.Syntax + return *c.LogoURL } -// GetTemplate returns the Template field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetTemplate() string { - if c == nil || c.Template == nil { +// GetMaxGroupsToRetrieve returns the MaxGroupsToRetrieve field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetMaxGroupsToRetrieve() string { + if c == nil || c.MaxGroupsToRetrieve == nil { return "" } - return *c.Template + return *c.MaxGroupsToRetrieve +} + +// GetNestedGroups returns the NestedGroups field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetNestedGroups() bool { + if c == nil || c.NestedGroups == nil { + return false + } + return *c.NestedGroups } // GetTenantDomain returns the TenantDomain field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetTenantDomain() string { +func (c *ConnectionOptionsAzureAD) GetTenantDomain() string { if c == nil || c.TenantDomain == nil { return "" } return *c.TenantDomain } -// GetTotp returns the Totp field. -func (c *ConnectionOptions) GetTotp() *ConnectionOptionsTotp { - if c == nil { - return nil +// GetUseCommonEndpoint returns the UseCommonEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetUseCommonEndpoint() bool { + if c == nil || c.UseCommonEndpoint == nil { + return false } - return c.Totp + return *c.UseCommonEndpoint } -// GetTwilioSid returns the TwilioSid field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetTwilioSid() string { - if c == nil || c.TwilioSid == nil { - return "" +// GetUseWSFederation returns the UseWSFederation field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetUseWSFederation() bool { + if c == nil || c.UseWSFederation == nil { + return false } - return *c.TwilioSid + return *c.UseWSFederation } -// GetTwilioToken returns the TwilioToken field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetTwilioToken() string { - if c == nil || c.TwilioToken == nil { +// GetWAADCommonEndpoint returns the WAADCommonEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetWAADCommonEndpoint() bool { + if c == nil || c.WAADCommonEndpoint == nil { + return false + } + return *c.WAADCommonEndpoint +} + +// GetWAADProtocol returns the WAADProtocol field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsAzureAD) GetWAADProtocol() string { + if c == nil || c.WAADProtocol == nil { return "" } - return *c.TwilioToken + return *c.WAADProtocol } -// GetUseWsfed returns the UseWsfed field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetUseWsfed() bool { - if c == nil || c.UseWsfed == nil { +// String returns a string representation of ConnectionOptionsAzureAD. +func (c *ConnectionOptionsAzureAD) String() string { + return Stringify(c) +} + +// GetBruteForceProtection returns the BruteForceProtection field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsEmail) GetBruteForceProtection() bool { + if c == nil || c.BruteForceProtection == nil { return false } - return *c.UseWsfed + return *c.BruteForceProtection } -// GetWaadCommonEndpoint returns the WaadCommonEndpoint field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetWaadCommonEndpoint() bool { - if c == nil || c.WaadCommonEndpoint == nil { +// GetDisableSignup returns the DisableSignup field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsEmail) GetDisableSignup() bool { + if c == nil || c.DisableSignup == nil { return false } - return *c.WaadCommonEndpoint + return *c.DisableSignup +} + +// GetEmail returns the Email field. +func (c *ConnectionOptionsEmail) GetEmail() *ConnectionOptionsEmailSettings { + if c == nil { + return nil + } + return c.Email } -// GetWaadProtocol returns the WaadProtocol field if it's non-nil, zero value otherwise. -func (c *ConnectionOptions) GetWaadProtocol() string { - if c == nil || c.WaadProtocol == nil { +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsEmail) GetName() string { + if c == nil || c.Name == nil { return "" } - return *c.WaadProtocol + return *c.Name } -// String returns a string representation of ConnectionOptions. -func (c *ConnectionOptions) String() string { +// GetOTP returns the OTP field. +func (c *ConnectionOptionsEmail) GetOTP() *ConnectionOptionsOTP { + if c == nil { + return nil + } + return c.OTP +} + +// String returns a string representation of ConnectionOptionsEmail. +func (c *ConnectionOptionsEmail) String() string { return Stringify(c) } -// GetLength returns the Length field if it's non-nil, zero value otherwise. -func (c *ConnectionOptionsTotp) GetLength() int { - if c == nil || c.Length == nil { - return 0 +// GetBody returns the Body field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsEmailSettings) GetBody() string { + if c == nil || c.Body == nil { + return "" } - return *c.Length + return *c.Body } -// GetTimeStep returns the TimeStep field if it's non-nil, zero value otherwise. -func (c *ConnectionOptionsTotp) GetTimeStep() int { - if c == nil || c.TimeStep == nil { - return 0 +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsEmailSettings) GetFrom() string { + if c == nil || c.From == nil { + return "" } - return *c.TimeStep + return *c.From +} + +// GetSubject returns the Subject field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsEmailSettings) GetSubject() string { + if c == nil || c.Subject == nil { + return "" + } + return *c.Subject +} + +// GetSyntax returns the Syntax field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsEmailSettings) GetSyntax() string { + if c == nil || c.Syntax == nil { + return "" + } + return *c.Syntax +} + +// String returns a string representation of ConnectionOptionsEmailSettings. +func (c *ConnectionOptionsEmailSettings) String() string { + return Stringify(c) +} + +// GetAdsManagement returns the AdsManagement field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetAdsManagement() bool { + if c == nil || c.AdsManagement == nil { + return false + } + return *c.AdsManagement +} + +// GetAdsRead returns the AdsRead field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetAdsRead() bool { + if c == nil || c.AdsRead == nil { + return false + } + return *c.AdsRead +} + +// GetAllowContextProfileField returns the AllowContextProfileField field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetAllowContextProfileField() bool { + if c == nil || c.AllowContextProfileField == nil { + return false + } + return *c.AllowContextProfileField +} + +// GetBusinessManagement returns the BusinessManagement field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetBusinessManagement() bool { + if c == nil || c.BusinessManagement == nil { + return false + } + return *c.BusinessManagement +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetEmail() bool { + if c == nil || c.Email == nil { + return false + } + return *c.Email +} + +// GetGroupsAccessMemberInfo returns the GroupsAccessMemberInfo field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetGroupsAccessMemberInfo() bool { + if c == nil || c.GroupsAccessMemberInfo == nil { + return false + } + return *c.GroupsAccessMemberInfo +} + +// GetLeadsRetrieval returns the LeadsRetrieval field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetLeadsRetrieval() bool { + if c == nil || c.LeadsRetrieval == nil { + return false + } + return *c.LeadsRetrieval +} + +// GetManageNotifications returns the ManageNotifications field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetManageNotifications() bool { + if c == nil || c.ManageNotifications == nil { + return false + } + return *c.ManageNotifications +} + +// GetManagePages returns the ManagePages field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetManagePages() bool { + if c == nil || c.ManagePages == nil { + return false + } + return *c.ManagePages +} + +// GetPagesManageCTA returns the PagesManageCTA field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPagesManageCTA() bool { + if c == nil || c.PagesManageCTA == nil { + return false + } + return *c.PagesManageCTA +} + +// GetPagesManageInstantArticles returns the PagesManageInstantArticles field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPagesManageInstantArticles() bool { + if c == nil || c.PagesManageInstantArticles == nil { + return false + } + return *c.PagesManageInstantArticles +} + +// GetPagesMessaging returns the PagesMessaging field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPagesMessaging() bool { + if c == nil || c.PagesMessaging == nil { + return false + } + return *c.PagesMessaging +} + +// GetPagesMessagingPhoneNumber returns the PagesMessagingPhoneNumber field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPagesMessagingPhoneNumber() bool { + if c == nil || c.PagesMessagingPhoneNumber == nil { + return false + } + return *c.PagesMessagingPhoneNumber +} + +// GetPagesMessagingSubscriptions returns the PagesMessagingSubscriptions field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPagesMessagingSubscriptions() bool { + if c == nil || c.PagesMessagingSubscriptions == nil { + return false + } + return *c.PagesMessagingSubscriptions +} + +// GetPagesShowList returns the PagesShowList field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPagesShowList() bool { + if c == nil || c.PagesShowList == nil { + return false + } + return *c.PagesShowList +} + +// GetPublicProfile returns the PublicProfile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPublicProfile() bool { + if c == nil || c.PublicProfile == nil { + return false + } + return *c.PublicProfile +} + +// GetPublishActions returns the PublishActions field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPublishActions() bool { + if c == nil || c.PublishActions == nil { + return false + } + return *c.PublishActions +} + +// GetPublishPages returns the PublishPages field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPublishPages() bool { + if c == nil || c.PublishPages == nil { + return false + } + return *c.PublishPages +} + +// GetPublishToGroups returns the PublishToGroups field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPublishToGroups() bool { + if c == nil || c.PublishToGroups == nil { + return false + } + return *c.PublishToGroups +} + +// GetPublishVideo returns the PublishVideo field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetPublishVideo() bool { + if c == nil || c.PublishVideo == nil { + return false + } + return *c.PublishVideo +} + +// GetReadAudienceNetworkInsights returns the ReadAudienceNetworkInsights field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetReadAudienceNetworkInsights() bool { + if c == nil || c.ReadAudienceNetworkInsights == nil { + return false + } + return *c.ReadAudienceNetworkInsights +} + +// GetReadInsights returns the ReadInsights field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetReadInsights() bool { + if c == nil || c.ReadInsights == nil { + return false + } + return *c.ReadInsights +} + +// GetReadMailbox returns the ReadMailbox field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetReadMailbox() bool { + if c == nil || c.ReadMailbox == nil { + return false + } + return *c.ReadMailbox +} + +// GetReadPageMailboxes returns the ReadPageMailboxes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetReadPageMailboxes() bool { + if c == nil || c.ReadPageMailboxes == nil { + return false + } + return *c.ReadPageMailboxes +} + +// GetReadStream returns the ReadStream field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetReadStream() bool { + if c == nil || c.ReadStream == nil { + return false + } + return *c.ReadStream +} + +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetScope() string { + if c == nil || c.Scope == nil { + return "" + } + return *c.Scope +} + +// GetUserAgeRange returns the UserAgeRange field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserAgeRange() bool { + if c == nil || c.UserAgeRange == nil { + return false + } + return *c.UserAgeRange +} + +// GetUserBirthday returns the UserBirthday field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserBirthday() bool { + if c == nil || c.UserBirthday == nil { + return false + } + return *c.UserBirthday +} + +// GetUserEvents returns the UserEvents field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserEvents() bool { + if c == nil || c.UserEvents == nil { + return false + } + return *c.UserEvents +} + +// GetUserFriends returns the UserFriends field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserFriends() bool { + if c == nil || c.UserFriends == nil { + return false + } + return *c.UserFriends +} + +// GetUserGender returns the UserGender field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserGender() bool { + if c == nil || c.UserGender == nil { + return false + } + return *c.UserGender +} + +// GetUserGroups returns the UserGroups field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserGroups() bool { + if c == nil || c.UserGroups == nil { + return false + } + return *c.UserGroups +} + +// GetUserHometown returns the UserHometown field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserHometown() bool { + if c == nil || c.UserHometown == nil { + return false + } + return *c.UserHometown +} + +// GetUserLikes returns the UserLikes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserLikes() bool { + if c == nil || c.UserLikes == nil { + return false + } + return *c.UserLikes +} + +// GetUserLink returns the UserLink field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserLink() bool { + if c == nil || c.UserLink == nil { + return false + } + return *c.UserLink +} + +// GetUserLocation returns the UserLocation field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserLocation() bool { + if c == nil || c.UserLocation == nil { + return false + } + return *c.UserLocation +} + +// GetUserManagedGroups returns the UserManagedGroups field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserManagedGroups() bool { + if c == nil || c.UserManagedGroups == nil { + return false + } + return *c.UserManagedGroups +} + +// GetUserPhotos returns the UserPhotos field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserPhotos() bool { + if c == nil || c.UserPhotos == nil { + return false + } + return *c.UserPhotos +} + +// GetUserPosts returns the UserPosts field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserPosts() bool { + if c == nil || c.UserPosts == nil { + return false + } + return *c.UserPosts +} + +// GetUserStatus returns the UserStatus field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserStatus() bool { + if c == nil || c.UserStatus == nil { + return false + } + return *c.UserStatus +} + +// GetUserTaggedPlaces returns the UserTaggedPlaces field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserTaggedPlaces() bool { + if c == nil || c.UserTaggedPlaces == nil { + return false + } + return *c.UserTaggedPlaces +} + +// GetUserVideos returns the UserVideos field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsFacebook) GetUserVideos() bool { + if c == nil || c.UserVideos == nil { + return false + } + return *c.UserVideos +} + +// String returns a string representation of ConnectionOptionsFacebook. +func (c *ConnectionOptionsFacebook) String() string { + return Stringify(c) +} + +// GetAdminOrg returns the AdminOrg field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetAdminOrg() bool { + if c == nil || c.AdminOrg == nil { + return false + } + return *c.AdminOrg +} + +// GetAdminPublicKey returns the AdminPublicKey field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetAdminPublicKey() bool { + if c == nil || c.AdminPublicKey == nil { + return false + } + return *c.AdminPublicKey +} + +// GetAdminRepoHook returns the AdminRepoHook field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetAdminRepoHook() bool { + if c == nil || c.AdminRepoHook == nil { + return false + } + return *c.AdminRepoHook +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetDeleteRepo returns the DeleteRepo field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetDeleteRepo() bool { + if c == nil || c.DeleteRepo == nil { + return false + } + return *c.DeleteRepo +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetEmail() bool { + if c == nil || c.Email == nil { + return false + } + return *c.Email +} + +// GetFollow returns the Follow field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetFollow() bool { + if c == nil || c.Follow == nil { + return false + } + return *c.Follow +} + +// GetGist returns the Gist field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetGist() bool { + if c == nil || c.Gist == nil { + return false + } + return *c.Gist +} + +// GetNotifications returns the Notifications field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetNotifications() bool { + if c == nil || c.Notifications == nil { + return false + } + return *c.Notifications +} + +// GetProfile returns the Profile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetProfile() bool { + if c == nil || c.Profile == nil { + return false + } + return *c.Profile +} + +// GetPublicRepo returns the PublicRepo field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetPublicRepo() bool { + if c == nil || c.PublicRepo == nil { + return false + } + return *c.PublicRepo +} + +// GetReadOrg returns the ReadOrg field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetReadOrg() bool { + if c == nil || c.ReadOrg == nil { + return false + } + return *c.ReadOrg +} + +// GetReadPublicKey returns the ReadPublicKey field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetReadPublicKey() bool { + if c == nil || c.ReadPublicKey == nil { + return false + } + return *c.ReadPublicKey +} + +// GetReadRepoHook returns the ReadRepoHook field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetReadRepoHook() bool { + if c == nil || c.ReadRepoHook == nil { + return false + } + return *c.ReadRepoHook +} + +// GetReadUser returns the ReadUser field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetReadUser() bool { + if c == nil || c.ReadUser == nil { + return false + } + return *c.ReadUser +} + +// GetRepo returns the Repo field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetRepo() bool { + if c == nil || c.Repo == nil { + return false + } + return *c.Repo +} + +// GetRepoDeployment returns the RepoDeployment field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetRepoDeployment() bool { + if c == nil || c.RepoDeployment == nil { + return false + } + return *c.RepoDeployment +} + +// GetRepoStatus returns the RepoStatus field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetRepoStatus() bool { + if c == nil || c.RepoStatus == nil { + return false + } + return *c.RepoStatus +} + +// GetSetUserAttributes returns the SetUserAttributes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetSetUserAttributes() string { + if c == nil || c.SetUserAttributes == nil { + return "" + } + return *c.SetUserAttributes +} + +// GetWriteOrg returns the WriteOrg field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetWriteOrg() bool { + if c == nil || c.WriteOrg == nil { + return false + } + return *c.WriteOrg +} + +// GetWritePublicKey returns the WritePublicKey field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetWritePublicKey() bool { + if c == nil || c.WritePublicKey == nil { + return false + } + return *c.WritePublicKey +} + +// GetWriteRepoHook returns the WriteRepoHook field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGitHub) GetWriteRepoHook() bool { + if c == nil || c.WriteRepoHook == nil { + return false + } + return *c.WriteRepoHook +} + +// String returns a string representation of ConnectionOptionsGitHub. +func (c *ConnectionOptionsGitHub) String() string { + return Stringify(c) +} + +// GetAdsenseManagement returns the AdsenseManagement field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetAdsenseManagement() bool { + if c == nil || c.AdsenseManagement == nil { + return false + } + return *c.AdsenseManagement +} + +// GetAnalytics returns the Analytics field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetAnalytics() bool { + if c == nil || c.Analytics == nil { + return false + } + return *c.Analytics +} + +// GetBlogger returns the Blogger field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetBlogger() bool { + if c == nil || c.Blogger == nil { + return false + } + return *c.Blogger +} + +// GetCalendar returns the Calendar field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetCalendar() bool { + if c == nil || c.Calendar == nil { + return false + } + return *c.Calendar +} + +// GetChromeWebStore returns the ChromeWebStore field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetChromeWebStore() bool { + if c == nil || c.ChromeWebStore == nil { + return false + } + return *c.ChromeWebStore +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetContacts returns the Contacts field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetContacts() bool { + if c == nil || c.Contacts == nil { + return false + } + return *c.Contacts +} + +// GetContentAPIForShopping returns the ContentAPIForShopping field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetContentAPIForShopping() bool { + if c == nil || c.ContentAPIForShopping == nil { + return false + } + return *c.ContentAPIForShopping +} + +// GetCoordinate returns the Coordinate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetCoordinate() bool { + if c == nil || c.Coordinate == nil { + return false + } + return *c.Coordinate +} + +// GetCoordinateReadonly returns the CoordinateReadonly field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetCoordinateReadonly() bool { + if c == nil || c.CoordinateReadonly == nil { + return false + } + return *c.CoordinateReadonly +} + +// GetDocumentList returns the DocumentList field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetDocumentList() bool { + if c == nil || c.DocumentList == nil { + return false + } + return *c.DocumentList +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetEmail() bool { + if c == nil || c.Email == nil { + return false + } + return *c.Email +} + +// GetGmail returns the Gmail field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetGmail() bool { + if c == nil || c.Gmail == nil { + return false + } + return *c.Gmail +} + +// GetGoogleAffiliateNetwork returns the GoogleAffiliateNetwork field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetGoogleAffiliateNetwork() bool { + if c == nil || c.GoogleAffiliateNetwork == nil { + return false + } + return *c.GoogleAffiliateNetwork +} + +// GetGoogleBooks returns the GoogleBooks field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetGoogleBooks() bool { + if c == nil || c.GoogleBooks == nil { + return false + } + return *c.GoogleBooks +} + +// GetGoogleCloudStorage returns the GoogleCloudStorage field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetGoogleCloudStorage() bool { + if c == nil || c.GoogleCloudStorage == nil { + return false + } + return *c.GoogleCloudStorage +} + +// GetGoogleDrive returns the GoogleDrive field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetGoogleDrive() bool { + if c == nil || c.GoogleDrive == nil { + return false + } + return *c.GoogleDrive +} + +// GetGoogleDriveFiles returns the GoogleDriveFiles field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetGoogleDriveFiles() bool { + if c == nil || c.GoogleDriveFiles == nil { + return false + } + return *c.GoogleDriveFiles +} + +// GetGooglePlus returns the GooglePlus field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetGooglePlus() bool { + if c == nil || c.GooglePlus == nil { + return false + } + return *c.GooglePlus +} + +// GetLatitudeBest returns the LatitudeBest field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetLatitudeBest() bool { + if c == nil || c.LatitudeBest == nil { + return false + } + return *c.LatitudeBest +} + +// GetLatitudeCity returns the LatitudeCity field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetLatitudeCity() bool { + if c == nil || c.LatitudeCity == nil { + return false + } + return *c.LatitudeCity +} + +// GetModerator returns the Moderator field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetModerator() bool { + if c == nil || c.Moderator == nil { + return false + } + return *c.Moderator +} + +// GetOrkut returns the Orkut field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetOrkut() bool { + if c == nil || c.Orkut == nil { + return false + } + return *c.Orkut +} + +// GetPicasaWeb returns the PicasaWeb field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetPicasaWeb() bool { + if c == nil || c.PicasaWeb == nil { + return false + } + return *c.PicasaWeb +} + +// GetProfile returns the Profile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetProfile() bool { + if c == nil || c.Profile == nil { + return false + } + return *c.Profile +} + +// GetSites returns the Sites field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetSites() bool { + if c == nil || c.Sites == nil { + return false + } + return *c.Sites +} + +// GetSpreadsheets returns the Spreadsheets field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetSpreadsheets() bool { + if c == nil || c.Spreadsheets == nil { + return false + } + return *c.Spreadsheets +} + +// GetTasks returns the Tasks field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetTasks() bool { + if c == nil || c.Tasks == nil { + return false + } + return *c.Tasks +} + +// GetURLShortener returns the URLShortener field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetURLShortener() bool { + if c == nil || c.URLShortener == nil { + return false + } + return *c.URLShortener +} + +// GetWebmasterTools returns the WebmasterTools field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetWebmasterTools() bool { + if c == nil || c.WebmasterTools == nil { + return false + } + return *c.WebmasterTools +} + +// GetYoutube returns the Youtube field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsGoogleOAuth2) GetYoutube() bool { + if c == nil || c.Youtube == nil { + return false + } + return *c.Youtube +} + +// String returns a string representation of ConnectionOptionsGoogleOAuth2. +func (c *ConnectionOptionsGoogleOAuth2) String() string { + return Stringify(c) +} + +// GetBasicProfile returns the BasicProfile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsLinkedin) GetBasicProfile() bool { + if c == nil || c.BasicProfile == nil { + return false + } + return *c.BasicProfile +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsLinkedin) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsLinkedin) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetEmail returns the Email field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsLinkedin) GetEmail() bool { + if c == nil || c.Email == nil { + return false + } + return *c.Email +} + +// GetProfile returns the Profile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsLinkedin) GetProfile() bool { + if c == nil || c.Profile == nil { + return false + } + return *c.Profile +} + +// GetSetUserAttributes returns the SetUserAttributes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsLinkedin) GetSetUserAttributes() string { + if c == nil || c.SetUserAttributes == nil { + return "" + } + return *c.SetUserAttributes +} + +// GetStrategyVersion returns the StrategyVersion field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsLinkedin) GetStrategyVersion() int { + if c == nil || c.StrategyVersion == nil { + return 0 + } + return *c.StrategyVersion +} + +// String returns a string representation of ConnectionOptionsLinkedin. +func (c *ConnectionOptionsLinkedin) String() string { + return Stringify(c) +} + +// GetAuthorizationEndpoint returns the AuthorizationEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetAuthorizationEndpoint() string { + if c == nil || c.AuthorizationEndpoint == nil { + return "" + } + return *c.AuthorizationEndpoint +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetDiscoveryURL returns the DiscoveryURL field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetDiscoveryURL() string { + if c == nil || c.DiscoveryURL == nil { + return "" + } + return *c.DiscoveryURL +} + +// GetIssuer returns the Issuer field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetIssuer() string { + if c == nil || c.Issuer == nil { + return "" + } + return *c.Issuer +} + +// GetJWKSURI returns the JWKSURI field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetJWKSURI() string { + if c == nil || c.JWKSURI == nil { + return "" + } + return *c.JWKSURI +} + +// GetLogoURL returns the LogoURL field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetLogoURL() string { + if c == nil || c.LogoURL == nil { + return "" + } + return *c.LogoURL +} + +// GetScope returns the Scope field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetScope() string { + if c == nil || c.Scope == nil { + return "" + } + return *c.Scope +} + +// GetTenantDomain returns the TenantDomain field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetTenantDomain() string { + if c == nil || c.TenantDomain == nil { + return "" + } + return *c.TenantDomain +} + +// GetTokenEndpoint returns the TokenEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetTokenEndpoint() string { + if c == nil || c.TokenEndpoint == nil { + return "" + } + return *c.TokenEndpoint +} + +// GetType returns the Type field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetType() string { + if c == nil || c.Type == nil { + return "" + } + return *c.Type +} + +// GetUserInfoEndpoint returns the UserInfoEndpoint field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOIDC) GetUserInfoEndpoint() string { + if c == nil || c.UserInfoEndpoint == nil { + return "" + } + return *c.UserInfoEndpoint +} + +// String returns a string representation of ConnectionOptionsOIDC. +func (c *ConnectionOptionsOIDC) String() string { + return Stringify(c) +} + +// GetLength returns the Length field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOTP) GetLength() int { + if c == nil || c.Length == nil { + return 0 + } + return *c.Length +} + +// GetTimeStep returns the TimeStep field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsOTP) GetTimeStep() int { + if c == nil || c.TimeStep == nil { + return 0 + } + return *c.TimeStep +} + +// String returns a string representation of ConnectionOptionsOTP. +func (c *ConnectionOptionsOTP) String() string { + return Stringify(c) +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSalesforce) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSalesforce) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetCommunityBaseURL returns the CommunityBaseURL field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSalesforce) GetCommunityBaseURL() string { + if c == nil || c.CommunityBaseURL == nil { + return "" + } + return *c.CommunityBaseURL +} + +// GetProfile returns the Profile field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSalesforce) GetProfile() bool { + if c == nil || c.Profile == nil { + return false + } + return *c.Profile +} + +// GetSetUserAttributes returns the SetUserAttributes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSalesforce) GetSetUserAttributes() string { + if c == nil || c.SetUserAttributes == nil { + return "" + } + return *c.SetUserAttributes +} + +// String returns a string representation of ConnectionOptionsSalesforce. +func (c *ConnectionOptionsSalesforce) String() string { + return Stringify(c) +} + +// GetBruteForceProtection returns the BruteForceProtection field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetBruteForceProtection() bool { + if c == nil || c.BruteForceProtection == nil { + return false + } + return *c.BruteForceProtection +} + +// GetDisableSignup returns the DisableSignup field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetDisableSignup() bool { + if c == nil || c.DisableSignup == nil { + return false + } + return *c.DisableSignup +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetFrom() string { + if c == nil || c.From == nil { + return "" + } + return *c.From +} + +// GetMessagingServiceSID returns the MessagingServiceSID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetMessagingServiceSID() string { + if c == nil || c.MessagingServiceSID == nil { + return "" + } + return *c.MessagingServiceSID +} + +// GetName returns the Name field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetName() string { + if c == nil || c.Name == nil { + return "" + } + return *c.Name +} + +// GetOTP returns the OTP field. +func (c *ConnectionOptionsSMS) GetOTP() *ConnectionOptionsOTP { + if c == nil { + return nil + } + return c.OTP +} + +// GetSyntax returns the Syntax field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetSyntax() string { + if c == nil || c.Syntax == nil { + return "" + } + return *c.Syntax +} + +// GetTemplate returns the Template field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetTemplate() string { + if c == nil || c.Template == nil { + return "" + } + return *c.Template +} + +// GetTwilioSID returns the TwilioSID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetTwilioSID() string { + if c == nil || c.TwilioSID == nil { + return "" + } + return *c.TwilioSID +} + +// GetTwilioToken returns the TwilioToken field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsSMS) GetTwilioToken() string { + if c == nil || c.TwilioToken == nil { + return "" + } + return *c.TwilioToken +} + +// String returns a string representation of ConnectionOptionsSMS. +func (c *ConnectionOptionsSMS) String() string { + return Stringify(c) +} + +// GetCalendars returns the Calendars field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetCalendars() bool { + if c == nil || c.Calendars == nil { + return false + } + return *c.Calendars +} + +// GetCalendarsUpdate returns the CalendarsUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetCalendarsUpdate() bool { + if c == nil || c.CalendarsUpdate == nil { + return false + } + return *c.CalendarsUpdate +} + +// GetClientID returns the ClientID field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetClientID() string { + if c == nil || c.ClientID == nil { + return "" + } + return *c.ClientID +} + +// GetClientSecret returns the ClientSecret field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetClientSecret() string { + if c == nil || c.ClientSecret == nil { + return "" + } + return *c.ClientSecret +} + +// GetContacts returns the Contacts field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetContacts() bool { + if c == nil || c.Contacts == nil { + return false + } + return *c.Contacts +} + +// GetContactsUpdate returns the ContactsUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetContactsUpdate() bool { + if c == nil || c.ContactsUpdate == nil { + return false + } + return *c.ContactsUpdate +} + +// GetDevice returns the Device field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetDevice() bool { + if c == nil || c.Device == nil { + return false + } + return *c.Device +} + +// GetDeviceCommand returns the DeviceCommand field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetDeviceCommand() bool { + if c == nil || c.DeviceCommand == nil { + return false + } + return *c.DeviceCommand +} + +// GetEmails returns the Emails field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetEmails() bool { + if c == nil || c.Emails == nil { + return false + } + return *c.Emails +} + +// GetEmailsUpdate returns the EmailsUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetEmailsUpdate() bool { + if c == nil || c.EmailsUpdate == nil { + return false + } + return *c.EmailsUpdate +} + +// GetFiles returns the Files field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetFiles() bool { + if c == nil || c.Files == nil { + return false + } + return *c.Files +} + +// GetFilesAll returns the FilesAll field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetFilesAll() bool { + if c == nil || c.FilesAll == nil { + return false + } + return *c.FilesAll +} + +// GetFilesAllUpdate returns the FilesAllUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetFilesAllUpdate() bool { + if c == nil || c.FilesAllUpdate == nil { + return false + } + return *c.FilesAllUpdate +} + +// GetFilesUpdate returns the FilesUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetFilesUpdate() bool { + if c == nil || c.FilesUpdate == nil { + return false + } + return *c.FilesUpdate +} + +// GetNotes returns the Notes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetNotes() bool { + if c == nil || c.Notes == nil { + return false + } + return *c.Notes +} + +// GetNotesCreate returns the NotesCreate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetNotesCreate() bool { + if c == nil || c.NotesCreate == nil { + return false + } + return *c.NotesCreate +} + +// GetNotesUpdate returns the NotesUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetNotesUpdate() bool { + if c == nil || c.NotesUpdate == nil { + return false + } + return *c.NotesUpdate +} + +// GetOfflineAccess returns the OfflineAccess field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetOfflineAccess() bool { + if c == nil || c.OfflineAccess == nil { + return false + } + return *c.OfflineAccess +} + +// GetSetUserAttributes returns the SetUserAttributes field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetSetUserAttributes() string { + if c == nil || c.SetUserAttributes == nil { + return "" + } + return *c.SetUserAttributes +} + +// GetSignin returns the Signin field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetSignin() bool { + if c == nil || c.Signin == nil { + return false + } + return *c.Signin +} + +// GetStrategyVersion returns the StrategyVersion field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetStrategyVersion() int { + if c == nil || c.StrategyVersion == nil { + return 0 + } + return *c.StrategyVersion +} + +// GetTasks returns the Tasks field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetTasks() bool { + if c == nil || c.Tasks == nil { + return false + } + return *c.Tasks +} + +// GetTasksUpdate returns the TasksUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetTasksUpdate() bool { + if c == nil || c.TasksUpdate == nil { + return false + } + return *c.TasksUpdate +} + +// GetUser returns the User field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetUser() bool { + if c == nil || c.User == nil { + return false + } + return *c.User +} + +// GetUserActivity returns the UserActivity field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetUserActivity() bool { + if c == nil || c.UserActivity == nil { + return false + } + return *c.UserActivity +} + +// GetUserUpdate returns the UserUpdate field if it's non-nil, zero value otherwise. +func (c *ConnectionOptionsWindowsLive) GetUserUpdate() bool { + if c == nil || c.UserUpdate == nil { + return false + } + return *c.UserUpdate } -// String returns a string representation of ConnectionOptionsTotp. -func (c *ConnectionOptionsTotp) String() string { +// String returns a string representation of ConnectionOptionsWindowsLive. +func (c *ConnectionOptionsWindowsLive) String() string { return Stringify(c) } diff --git a/vendor/gopkg.in/auth0.v3/management/management.go b/vendor/gopkg.in/auth0.v4/management/management.go similarity index 99% rename from vendor/gopkg.in/auth0.v3/management/management.go rename to vendor/gopkg.in/auth0.v4/management/management.go index 90cd9803..df01dd40 100644 --- a/vendor/gopkg.in/auth0.v3/management/management.go +++ b/vendor/gopkg.in/auth0.v4/management/management.go @@ -14,7 +14,7 @@ import ( "strings" "time" - "gopkg.in/auth0.v3/internal/client" + "gopkg.in/auth0.v4/internal/client" ) // Management is an Auth0 management client used to interact with the Auth0 diff --git a/vendor/gopkg.in/auth0.v3/management/prompt.go b/vendor/gopkg.in/auth0.v4/management/prompt.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/prompt.go rename to vendor/gopkg.in/auth0.v4/management/prompt.go diff --git a/vendor/gopkg.in/auth0.v3/management/resource_server.go b/vendor/gopkg.in/auth0.v4/management/resource_server.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/resource_server.go rename to vendor/gopkg.in/auth0.v4/management/resource_server.go diff --git a/vendor/gopkg.in/auth0.v3/management/role.go b/vendor/gopkg.in/auth0.v4/management/role.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/role.go rename to vendor/gopkg.in/auth0.v4/management/role.go diff --git a/vendor/gopkg.in/auth0.v3/management/rule.go b/vendor/gopkg.in/auth0.v4/management/rule.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/rule.go rename to vendor/gopkg.in/auth0.v4/management/rule.go diff --git a/vendor/gopkg.in/auth0.v3/management/rule_config.go b/vendor/gopkg.in/auth0.v4/management/rule_config.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/rule_config.go rename to vendor/gopkg.in/auth0.v4/management/rule_config.go diff --git a/vendor/gopkg.in/auth0.v3/management/stat.go b/vendor/gopkg.in/auth0.v4/management/stat.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/stat.go rename to vendor/gopkg.in/auth0.v4/management/stat.go diff --git a/vendor/gopkg.in/auth0.v3/management/tenant.go b/vendor/gopkg.in/auth0.v4/management/tenant.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/tenant.go rename to vendor/gopkg.in/auth0.v4/management/tenant.go diff --git a/vendor/gopkg.in/auth0.v3/management/ticket.go b/vendor/gopkg.in/auth0.v4/management/ticket.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/ticket.go rename to vendor/gopkg.in/auth0.v4/management/ticket.go diff --git a/vendor/gopkg.in/auth0.v3/management/user.go b/vendor/gopkg.in/auth0.v4/management/user.go similarity index 100% rename from vendor/gopkg.in/auth0.v3/management/user.go rename to vendor/gopkg.in/auth0.v4/management/user.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 8d65d660..a2554c2b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -359,7 +359,8 @@ google.golang.org/grpc/stats google.golang.org/grpc/status google.golang.org/grpc/tap google.golang.org/grpc/test/bufconn -# gopkg.in/auth0.v3 v3.3.0 -gopkg.in/auth0.v3 -gopkg.in/auth0.v3/internal/client -gopkg.in/auth0.v3/management +# gopkg.in/auth0.v4 v4.0.0 +gopkg.in/auth0.v4 +gopkg.in/auth0.v4/internal/client +gopkg.in/auth0.v4/internal/tag +gopkg.in/auth0.v4/management diff --git a/website/docs/index.html.md b/website/docs/index.html.md index d2a783a3..aa13a42d 100644 --- a/website/docs/index.html.md +++ b/website/docs/index.html.md @@ -14,34 +14,36 @@ Use the navigation to the left to read about the available resources. ## Example Usage ```hcl -# Configure the Auth0 Provider provider "auth0" { domain = "" client_id = "" client_secret = "" debug = "" } - -# Add a tenant -resource "auth0_tenant" "tenant" { - default_audience = "" - friendly_name = "Tenant Name" - picture_url = "http://mysite/logo.png" - support_email = "support@mysite" - support_url = "http://mysite/support" - allowed_logout_urls = [ - "http://mysite/logout" - ] - session_lifetime = 46000 - sandbox_version = "8" - } ``` -These variables can also be accessed via the `AUTH0_DOMAIN`, `AUTH0_CLIENT_ID`, and `AUTH0_CLIENT_SECRET` environment variables, respectively. +~> **Note**: Hard-coding credentials into any Terraform configuration is not recommended, and risks secret leakage should this file ever be committed to a public version control system. See [Environment Variables](#environment-variables) for a better alternative. ## Argument Reference -* `domain` - (Required) String. Your Auth0 domain name. -* `client_id` - (Required) String. Your Auth0 client ID. -* `client_secret` - (Required) String. Your Auth0 client secret. -* `debug` - (Optional) Boolean. Indicates whether or not to turn on debug mode. +* `domain` - (Required) Your Auth0 domain name. It can also be sourced from the `AUTH0_DOMAIN` environment variable. +* `client_id` - (Required) Your Auth0 client ID. It can also be sourced from the `AUTH0_CLIENT_ID` environment variable. +* `client_secret` - (Required) Your Auth0 client secret. It can also be sourced from the `AUTH0_CLIENT_SECRET` environment variable. +* `debug` - (Optional) Indicates whether or not to turn on debug mode. + +## Environment Variables + +You can provide your credentials via the `AUTH0_DOMAIN`, `AUTH0_CLIENT_ID` and `AUTH0_CLIENT_SECRET` environment variables, respectively. + +```hcl +provider "auth0" {} +``` + +Usage: + +```bash +$ export AUTH0_DOMAIN="" +$ export AUTH0_CLIENT_ID="" +$ export AUTH0_CLIENT_SECRET="" +$ terraform plan +``` \ No newline at end of file