Skip to content

Commit

Permalink
feature(application): adds support for `form_configuration.self_servi…
Browse files Browse the repository at this point in the history
…ce_form_id`.
  • Loading branch information
matthewhartstonge authored and MCBrandenburg committed May 27, 2022
1 parent 7245ba6 commit 843e73f
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 65 deletions.
132 changes: 67 additions & 65 deletions docs/resources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,77 @@
## Example Usage

```hcl
resource "fusionauth_application" "Forum"{
tenant_id = fusionauth_tenant.portal.id
authentication_token_configuration_enabled = false
form_configuration {
admin_registration_form_id = "e37dff97-9a94-48af-a0a6-c0bdfdd62c48"
resource "fusionauth_application" "Forum" {
tenant_id = fusionauth_tenant.portal.id
authentication_token_configuration_enabled = false
form_configuration {
admin_registration_form_id = fusionauth_form.admin_registration.id
self_service_form_id = fusionauth_form.self_service.id
}
jwt_configuration {
access_token_id = fusionauth_key.access_token.id
enabled = true
id_token_key_id = fusionauth_key.id_token.id
refresh_token_ttl_minutes = 43200
ttl_seconds = 3600
}
lambda_configuration {
access_token_populate_id = fusionauth_lambda.token_populate.id
id_token_populate_id = fusionauth_lambda.id_token_populate.id
}
login_configuration {
allow_token_refresh = false
generate_refresh_tokens = false
require_authentication = true
}
name = "Forum"
oauth_configuration {
authorized_origin_urls = [
"http://www.example.com/oauth-callback"
]
enabled_grants = [
"authorization_code", "implicit"
]
generate_refresh_tokens = false
logout_behavior = "AllApplications"
logout_url = "http://www.example.com/logout"
require_client_authentication = false
}
registration_configuration {
birth_date {
enabled = false
required = false
}
jwt_configuration {
access_token_id =
enabled= true
id_token_key_id = fusionauth_key.gpsiidtoken.id
refresh_token_ttl_minutes= 43200
ttl_seconds=3600
confirm_password = false
enabled = false
first_name {
enabled = false
required = false
}
lambda_configuration {
access_token_populate_id=
id_token_populate_id=
full_name {
enabled = false
required = false
}
login_configuration{
allow_token_refresh = false
generate_refresh_tokens = false
require_authentication = true
last_name {
enabled = false
required = false
}
name = "Forum"
oauth_configuration {
authorized_origin_urls =[
"http://www.example.com/oauth-callback"
]
enabled_grants = [
"authorization_code","implicit"
]
generate_refresh_tokens = false
logout_behavior = "AllApplications"
logout_url= "http://www.example.com/logout"
require_client_authentication = false
login_id_type = ""
middle_name {
enabled = false
required = false
}
registration_configuration {
birth_date {
enabled = false
required = false
}
confirm_password = false
enabled = false
first_name {
enabled = false
required = false
}
full_name {
enabled = false
required = false
}
last_name {
enabled = false
required = false
}
login_id_type = ""
middle_name {
enabled = false
required = false
}
mobile_phone {
enabled = false
required = false
}
type = ""
}
passwordless_configuration_enabled = false
registration_delete_policy {
unverified_enabled = true
unverified_number_of_days_to_retain = 30
mobile_phone {
enabled = false
required = false
}
type = ""
}
passwordless_configuration_enabled = false
registration_delete_policy {
unverified_enabled = true
unverified_number_of_days_to_retain = 30
}
}
```

Expand All @@ -92,7 +93,8 @@ resource "fusionauth_application" "Forum"{
* `application_id` - (Optional) The Id of the CleanSpeak application that usernames are sent to for moderation.
* `data` - (Optional) An object that can hold any information about the Application that should be persisted.
* `form_configuration` - (Optional)
- `admin_registration_form_id` - (Optional) The unique Id of the form to use for the Add and Edit User Registration form when used in the FusionAuth admin UI."
- `admin_registration_form_id` - (Optional) The unique Id of the form to use for the Add and Edit User Registration form when used in the FusionAuth admin UI.
- `self_service_form_id` - (Optional) The unique Id of the form to to enable authenticated users to manage their profile on the account page.
* `jwt_configuration` - (Optional)
- `access_token_id` - (Optional) The Id of the signing key used to sign the access token.
- `enabled` - (Optional) Indicates if this application is using the JWT configuration defined here or the global JWT configuration defined by the System Configuration. If this is false the signing algorithm configured in the System Configuration will be used. If true the signing algorithm defined in this application will be used.
Expand Down
6 changes: 6 additions & 0 deletions fusionauth/resource_fusionauth_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func newApplication() *schema.Resource {
ValidateFunc: validation.IsUUID,
Description: "The unique Id of the form to use for the Add and Edit User Registration form when used in the FusionAuth admin UI.",
},
"self_service_form_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
Description: "The unique Id of the form to to enable authenticated users to manage their profile on the account page.",
},
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions fusionauth/resource_fusionauth_application_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func buildApplication(data *schema.ResourceData) fusionauth.Application {
Data: data.Get("data").(map[string]interface{}),
FormConfiguration: fusionauth.ApplicationFormConfiguration{
AdminRegistrationFormId: data.Get("form_configuration.0.admin_registration_form_id").(string),
SelfServiceFormId: data.Get("form_configuration.0.self_service_form_id").(string),
},
JwtConfiguration: fusionauth.JWTConfiguration{
Enableable: buildEnableable("jwt_configuration.0.enabled", data),
Expand Down Expand Up @@ -209,6 +210,7 @@ func buildResourceDataFromApplication(a fusionauth.Application, data *schema.Res
err = data.Set("form_configuration", []map[string]interface{}{
{
"admin_registration_form_id": a.FormConfiguration.AdminRegistrationFormId,
"self_service_form_id": a.FormConfiguration.SelfServiceFormId,
},
})
if err != nil {
Expand Down

0 comments on commit 843e73f

Please sign in to comment.