Skip to content

Commit

Permalink
Feature: add support for verification strategy (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjauld authored Dec 1, 2022
1 parent 0256a94 commit 7320fd5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/resources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ resource "fusionauth_application" "Forum" {
- `xml_signature_canonicalization_method` - (Optional) The XML signature canonicalization method used when digesting and signing the SAML response. Unfortunately, many service providers do not correctly implement the XML signature specifications and force a specific canonicalization method. This setting allows you to change the canonicalization method to match the service provider. Often, service providers don’t even document their required method. You might need to contact enterprise support at the service provider to figure out what method they use.
- `xml_signature_location` - (Optional) The location to place the XML signature when signing a successful SAML response.
* `theme_id` - (Optional) The unique Id of the theme to be used to style the login page and other end user templates.
* `verification_strategy` - (Optional) The process by which the user will verify their email address. Possible values are `ClickableLink` or `FormField`
* `verification_email_template_id` - (Optional) The Id of the Email Template that is used to send the Registration Verification emails to users. If the verifyRegistration field is true this field is required.
* `verify_registration` - (Optional) Whether or not registrations to this Application may be verified. When this is set to true the verificationEmailTemplateId parameter is also required.
* `email_configuration` - (Optional)
Expand Down
3 changes: 2 additions & 1 deletion docs/resources/tenant.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ resource "fusionauth_tenant" "example" {
- `set_password_email_template_id` - (Optional) The Id of the Email Template that is used when a user had their account created for them and they must set their password manually and they are sent an email to set their password.
- `username` - (Optional) An optional username FusionAuth will to authenticate with the SMTP server.
- `verification_email_template_id` - (Optional) The Id of the Email Template that is used to send the verification emails to users. These emails are used to verify that a user’s email address ivalid. If either the verifyEmail or verifyEmailWhenChanged fields are true this field is required.
- `verification_strategy` - (Optional) The process by which the user will verify their email address. Possible values are `ClickableLink` or `FormField`.
- `verify_email` - (Optional) Whether the user’s email addresses are verified when the registers with your application.
- `verify_email_when_changed` - (Optional) Whether the user’s email addresses are verified when the user changes them.
- `two_factor_method_add_email_template_id` - (Optional) The Id of the Email Template used to send emails to users when a MFA method has been added to their account.
Expand Down Expand Up @@ -412,4 +413,4 @@ resource "fusionauth_tenant" "example" {
* `strategy` - (Optional) When enabled the user’s password will be validated during login. If the password does not meet the currently configured validation rules the user will be required to change their password.
* `user_delete_policy` - (Optional)
- `unverified_enabled` - (Optional) Indicates that users without a verified email address will be permanently deleted after tenant.userDeletePolicy.unverified.numberOfDaysToRetain days.
- `unverified_number_of_days_to_retain` - (Optional)
- `unverified_number_of_days_to_retain` - (Optional)
7 changes: 7 additions & 0 deletions fusionauth/resource_fusionauth_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ func newApplication() *schema.Resource {
Optional: true,
Description: "The Id of the Email Template that is used to send the Registration Verification emails to users. If the verifyRegistration field is true this field is required.",
},
"verification_strategy": {
Type: schema.TypeString,
Optional: true,
Default: "ClickableLink",
Description: "The process by which the user will verify their email address.",
ValidateFunc: validation.StringInSlice([]string{"ClickableLink", "FormField"}, false),
},
"verify_registration": {
Type: schema.TypeBool,
Optional: true,
Expand Down
4 changes: 4 additions & 0 deletions fusionauth/resource_fusionauth_application_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func buildApplication(data *schema.ResourceData) fusionauth.Application {
},
ThemeId: data.Get("theme_id").(string),
VerificationEmailTemplateId: data.Get("verification_email_template_id").(string),
VerificationStrategy: fusionauth.VerificationStrategy(data.Get("verification_strategy").(string)),
VerifyRegistration: data.Get("verify_registration").(bool),
EmailConfiguration: fusionauth.ApplicationEmailConfiguration{
EmailVerificationEmailTemplateId: data.Get("email_configuration.0.email_verification_template_id").(string),
Expand Down Expand Up @@ -390,6 +391,9 @@ func buildResourceDataFromApplication(a fusionauth.Application, data *schema.Res
if err := data.Set("verification_email_template_id", a.VerificationEmailTemplateId); err != nil {
return diag.Errorf("application.verification_email_template_id: %s", err.Error())
}
if err := data.Set("verification_strategy", a.VerificationStrategy); err != nil {
return diag.Errorf("application.verification_strategy: %s", err.Error())
}
if err := data.Set("theme_id", a.ThemeId); err != nil {
return diag.Errorf("application.theme_id: %s", err.Error())
}
Expand Down
7 changes: 7 additions & 0 deletions fusionauth/resource_fusionauth_tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,13 @@ func newEmailConfiguration() *schema.Resource {
Description: "The Id of the Email Template that is used to send the verification emails to users. These emails are used to verify that a user’s email address is valid. If either the verifyEmail or verifyEmailWhenChanged fields are true this field is required.",
ValidateFunc: validation.IsUUID,
},
"verification_strategy": {
Type: schema.TypeString,
Optional: true,
Default: "ClickableLink",
Description: "The process by which the user will verify their email address.",
ValidateFunc: validation.StringInSlice([]string{"ClickableLink", "FormField"}, false),
},
"verify_email": {
Type: schema.TypeBool,
Optional: true,
Expand Down
2 changes: 2 additions & 0 deletions fusionauth/resource_fusionauth_tenant_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func buildTenant(data *schema.ResourceData) (fusionauth.Tenant, diag.Diagnostics
VerificationEmailTemplateId: data.Get("email_configuration.0.verification_email_template_id").(string),
VerifyEmail: data.Get("email_configuration.0.verify_email").(bool),
VerifyEmailWhenChanged: data.Get("email_configuration.0.verify_email_when_changed").(bool),
VerificationStrategy: fusionauth.VerificationStrategy(data.Get("email_configuration.0.verification_strategy").(string)),
DefaultFromEmail: data.Get("email_configuration.0.default_from_email").(string),
DefaultFromName: data.Get("email_configuration.0.default_from_name").(string),
Unverified: fusionauth.EmailUnverifiedOptions{
Expand Down Expand Up @@ -365,6 +366,7 @@ func buildResourceDataFromTenant(t fusionauth.Tenant, data *schema.ResourceData)
"two_factor_method_remove_email_template_id": t.EmailConfiguration.TwoFactorMethodRemoveEmailTemplateId,
"username": t.EmailConfiguration.Username,
"verification_email_template_id": t.EmailConfiguration.VerificationEmailTemplateId,
"verification_strategy": t.EmailConfiguration.VerificationStrategy,
"verify_email": t.EmailConfiguration.VerifyEmail,
"verify_email_when_changed": t.EmailConfiguration.VerifyEmailWhenChanged,
"default_from_email": t.EmailConfiguration.DefaultFromEmail,
Expand Down

0 comments on commit 7320fd5

Please sign in to comment.