Skip to content

Commit

Permalink
Add SelfServiceRegistrationValidation lambda type (#247)
Browse files Browse the repository at this point in the history
* Add `SelfServiceRegistrationValidation` lambda type

* Add `selfServiceRegistrationValidationId` for lambda configuration
  • Loading branch information
hamxabaig authored Nov 16, 2023
1 parent 7924250 commit 2b427d2
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/data-sources/lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ data "fusionauth_lambda" "default_google_reconcile" {
- `SteamReconcile`
- `TwitchReconcile`
- `XboxReconcile`
- `SelfServiceRegistrationValidation`
- `ClientCredentialsJWTPopulate`

## Attributes Reference
Expand Down
1 change: 1 addition & 0 deletions docs/resources/application.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ resource "fusionauth_application" "Forum" {
- `access_token_populate_id` - (Optional) The Id of the Lambda that will be invoked when an access token is generated for this application. This will be utilized during OAuth2 and OpenID Connect authentication requests as well as when an access token is generated for the Login API.
- `id_token_populate_id` - (Optional) The Id of the Lambda that will be invoked when an Id token is generated for this application during an OpenID Connect authentication request.
- `samlv2_populate_id` - (Optional) The Id of the Lambda that will be invoked when a a SAML response is generated during a SAML authentication request.
- `self_service_registration_validation_id` - (Optional) The unique Id of the lambda that will be used to perform additional validation on registration form steps.
* `login_configuration` - (Optional)
- `allow_token_refresh` - (Optional) Indicates if a JWT may be refreshed using a Refresh Token for this application. This configuration is separate from issuing new Refresh Tokens which is controlled by the generateRefreshTokens parameter. This configuration indicates specifically if an existing Refresh Token may be used to request a new JWT using the Refresh API.
- `generate_refresh_tokens` - (Optional) Indicates if a Refresh Token should be issued from the Login API
Expand Down
1 change: 1 addition & 0 deletions docs/resources/lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ function populate(jwt, user, registration) {
- `SteamReconcile`
- `TwitchReconcile`
- `XboxReconcile`
- `SelfServiceRegistrationValidation`
- `ClientCredentialsJWTPopulate`
1 change: 1 addition & 0 deletions fusionauth/datasource_fusionauth_lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func dataSourceLambda() *schema.Resource {
string(fusionauth.LambdaType_SteamReconcile),
string(fusionauth.LambdaType_TwitchReconcile),
string(fusionauth.LambdaType_XboxReconcile),
string(fusionauth.LambdaType_SelfServiceRegistrationValidation),
string(fusionauth.LambdaType_ClientCredentialsJWTPopulate),
}, false),
Description: "The Lambda type.",
Expand Down
5 changes: 5 additions & 0 deletions fusionauth/resource_fusionauth_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ func newApplication() *schema.Resource {
Optional: true,
Description: "The Id of the Lambda that will be invoked when a a SAML response is generated during a SAML authentication request.",
},
"self_service_registration_validation_id": {
Type: schema.TypeString,
Optional: true,
Description: "The unique Id of the lambda that will be used to perform additional validation on registration form steps.",
},
},
},
},
Expand Down
14 changes: 8 additions & 6 deletions fusionauth/resource_fusionauth_application_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ func buildApplication(data *schema.ResourceData) fusionauth.Application {
TimeToLiveInSeconds: data.Get("jwt_configuration.0.ttl_seconds").(int),
},
LambdaConfiguration: fusionauth.LambdaConfiguration{
AccessTokenPopulateId: data.Get("lambda_configuration.0.access_token_populate_id").(string),
IdTokenPopulateId: data.Get("lambda_configuration.0.id_token_populate_id").(string),
Samlv2PopulateId: data.Get("lambda_configuration.0.samlv2_populate_id").(string),
AccessTokenPopulateId: data.Get("lambda_configuration.0.access_token_populate_id").(string),
IdTokenPopulateId: data.Get("lambda_configuration.0.id_token_populate_id").(string),
Samlv2PopulateId: data.Get("lambda_configuration.0.samlv2_populate_id").(string),
SelfServiceRegistrationValidationId: data.Get("lambda_configuration.0.self_service_registration_validation_id").(string),
},
LoginConfiguration: fusionauth.LoginConfiguration{
AllowTokenRefresh: data.Get("login_configuration.0.allow_token_refresh").(bool),
Expand Down Expand Up @@ -237,9 +238,10 @@ func buildResourceDataFromApplication(a fusionauth.Application, data *schema.Res

err = data.Set("lambda_configuration", []map[string]interface{}{
{
"access_token_populate_id": a.LambdaConfiguration.AccessTokenPopulateId,
"id_token_populate_id": a.LambdaConfiguration.IdTokenPopulateId,
"samlv2_populate_id": a.LambdaConfiguration.Samlv2PopulateId,
"access_token_populate_id": a.LambdaConfiguration.AccessTokenPopulateId,
"id_token_populate_id": a.LambdaConfiguration.IdTokenPopulateId,
"samlv2_populate_id": a.LambdaConfiguration.Samlv2PopulateId,
"self_service_registration_validation_id": a.LambdaConfiguration.SelfServiceRegistrationValidationId,
},
})
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions fusionauth/resource_fusionauth_lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func newLambda() *schema.Resource {
string(fusionauth.LambdaType_SteamReconcile),
string(fusionauth.LambdaType_TwitchReconcile),
string(fusionauth.LambdaType_XboxReconcile),
string(fusionauth.LambdaType_SelfServiceRegistrationValidation),
string(fusionauth.LambdaType_ClientCredentialsJWTPopulate),
}, false),
Description: "The lambda type.",
Expand Down

0 comments on commit 2b427d2

Please sign in to comment.