From 3f650c21c4a9160b1079309b06f65e00029f7e60 Mon Sep 17 00:00:00 2001 From: Christopher Nellis Date: Tue, 10 Dec 2024 22:23:49 -0500 Subject: [PATCH] Update documentation. Fix schema --- docs/resources/connection.md | 21 +++++++++++++++++ internal/auth0/connection/schema.go | 36 ++++++++--------------------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/docs/resources/connection.md b/docs/resources/connection.md index 0c64da8a..2fbca7cf 100644 --- a/docs/resources/connection.md +++ b/docs/resources/connection.md @@ -635,6 +635,15 @@ resource "auth0_connection" "okta" { "family_name" : "$${context.tokenset.family_name}" }) } + + authentication_methods { + passkey { + enabled = true + } + password { + enabled = true + } + } } } ``` @@ -680,6 +689,7 @@ Optional: - `configuration` (Map of String, Sensitive) A case-sensitive map of key value pairs used as configuration variables for the `custom_script`. - `connection_settings` (Block List, Max: 1) Proof Key for Code Exchange (PKCE) configuration settings for an OIDC or Okta Workforce connection. (see [below for nested schema](#nestedblock--options--connection_settings)) - `custom_scripts` (Map of String) A map of scripts used to integrate with a custom database. +- `authentication_methods` (Block List, Max: 1) Enables and disables authentication methods including passwords and passkeys (see [below for nested schema](#nestedblock--authentication-methods)) - `debug` (Boolean) When enabled, additional debug information will be generated. - `decryption_key` (Block List, Max: 1) The key used to decrypt encrypted responses from the connection. Uses the `key` and `cert` properties to provide the private key and certificate respectively. (see [below for nested schema](#nestedblock--options--decryption_key)) - `digest_algorithm` (String) Sign Request Algorithm Digest. @@ -770,6 +780,17 @@ Optional: - `attributes` (String) This property is an object containing mapping information that allows Auth0 to interpret incoming claims from the IdP. Mapping information must be provided as key/value pairs. - `userinfo_scope` (String) This property defines the scopes that Auth0 sends to the IdP’s UserInfo endpoint when requested. + +Required: + +- `password` (Block List, Max: 1) Enables or disables password authentication (see [below for nested schema](#nestedblock--authentication-method)) +- `passkey` (Block List, Max: 1) Enables or disables passkey authentication (see [below for nested schema](#nestedblock--authentication-method)) + + + +Required: + +- `enabled` (Boolean) Enables the authentication method ### Nested Schema for `options.attributes` diff --git a/internal/auth0/connection/schema.go b/internal/auth0/connection/schema.go index 481c4694..0daf0e2c 100644 --- a/internal/auth0/connection/schema.go +++ b/internal/auth0/connection/schema.go @@ -74,28 +74,6 @@ var resourceSchema = map[string]*schema.Schema{ "options": optionsSchema, } -var authMethodEnabled = map[string]*schema.Schema{ - "enabled": { - Type: schema.TypeBool, - Optional: false, - Description: "Whether the authentication method is enabled or not" - } -} - -var authMethods = map[string]*schema.Schema{ - "password": { - Type: schema.authMethodEnabled, - Optional: false, - Description: "Controls if password authentication is enabled for this connection" - }, - "passkey": { - Type: schema.authMethodEnabled, - Optional: false, - Description: "Controls if passkey authentication is enabled for this connection. See" - } -} - - var optionsSchema = &schema.Schema{ Type: schema.TypeList, Computed: true, @@ -275,9 +253,16 @@ var optionsSchema = &schema.Schema{ Description: "A map of scripts used to integrate with a custom database.", }, "authentication_methods": { - Type: schema.authMethods, - Optional: true, - Description: "Enables and disables authentication methods for this database", + Type: schema.TypeMap, + Required: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Required: true, + }, + }, + }, }, "scripts": { Type: schema.TypeMap, @@ -1129,4 +1114,3 @@ var optionsSchema = &schema.Schema{ }, }, } -