Skip to content

Commit

Permalink
Add test and update documentation formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnellis committed Dec 11, 2024
1 parent aca2cb6 commit 9de3712
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 9 deletions.
20 changes: 11 additions & 9 deletions docs/resources/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ resource "auth0_connection" "my_connection" {
max = 40
}
}
authentication_methods {
passkey {
enabled = true
}
password {
enabled = true
}
}
mfa {
active = true
Expand Down Expand Up @@ -635,15 +644,6 @@ resource "auth0_connection" "okta" {
"family_name" : "$${context.tokenset.family_name}"
})
}
authentication_methods {
passkey {
enabled = true
}
password {
enabled = true
}
}
}
}
```
Expand Down Expand Up @@ -781,13 +781,15 @@ Optional:
- `userinfo_scope` (String) This property defines the scopes that Auth0 sends to the IdP’s UserInfo endpoint when requested.

<a id="nestedblock--authentication-methods"></a>
### Nested Schema for `options.authentication_methods`
Required:

- `password` (Map) Enables or disables password authentication (see [below for nested schema](#nestedblock--authentication-method))
- `passkey` (Map) Enables or disables passkey authentication (see [below for nested schema](#nestedblock--authentication-method))


<a id="nestedblock--authentication-method"></a>
### Nested Schema for `options.authentication_methods.*`
Required:

- `enabled` (Boolean) Enables the authentication method
Expand Down
100 changes: 100 additions & 0 deletions internal/auth0/connection/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2611,3 +2611,103 @@ EOF
}
}
`

const testConnectionAuthenticationMethods = `
resource "auth0_connection" "my_connection" {
name = "Example-Connection"
is_domain_connection = true
strategy = "auth0"
metadata = {
key1 = "foo"
key2 = "bar"
}
options {
password_policy = "excellent"
brute_force_protection = true
strategy_version = 2
enabled_database_customization = true
import_mode = false
requires_username = true
disable_signup = false
custom_scripts = {
get_user = <<EOF
function getByEmail(email, callback) {
return callback(new Error("Whoops!"));
}
EOF
}
configuration = {
foo = "bar"
bar = "baz"
}
upstream_params = jsonencode({
"screen_name" : {
"alias" : "login_hint"
}
})
password_history {
enable = true
size = 3
}
password_no_personal_info {
enable = true
}
password_dictionary {
enable = true
dictionary = ["password", "admin", "1234"]
}
password_complexity_options {
min_length = 12
}
validation {
username {
min = 10
max = 40
}
}
authentication_methods {
passkey {
enabled = true
}
password {
enabled = true
}
}
mfa {
active = true
return_enroll_settings = true
}
}
}
`

func TestAuthenticationMethods(t *testing.T) {
acctest.Test(t, resource.TestCase{
Steps: []resource.TestStep{
{
Config: acctest.ParseTestName(testConnectionPingFederateConfigCreate, t.Name()),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.#", "1"),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.authentication_methods.passkey.enabled", true),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.authentication_methods.password.enabled", true),
),
},
{
Config: acctest.ParseTestName(testConnectionPingFederateConfigUpdate, t.Name()),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.#", "1"),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.authentication_methods.passkey.enabled", true),
resource.TestCheckResourceAttr("auth0_connection.my_connection", "options.0.authentication_methods.password.enabled", true),
),
},
},
})
}

0 comments on commit 9de3712

Please sign in to comment.