Skip to content

Commit

Permalink
Merge pull request #54 from antifuchs/auth-strategy
Browse files Browse the repository at this point in the history
Add auth_strategy to the vendor config's password policy
  • Loading branch information
aviadmizrachi authored Oct 7, 2022
2 parents f3377af + 4876778 commit 243e864
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/resources/frontegg_workspace/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ resource "frontegg_workspace" "example" {
jwt_access_token_expiration = 86400 # 1 day
jwt_refresh_token_expiration = 2592000 # 30 days
same_site_cookie_policy = "strict"
auth_strategy = "Code"
}

mfa_policy {
Expand Down
11 changes: 11 additions & 0 deletions provider/resource_frontegg_workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type fronteggAuth struct {
ForcePermissions bool `json:"forcePermissions"`
JWTAlgorithm string `json:"jwtAlgorithm"`
PublicKey string `json:"publicKey"`
AuthStrategy string `json:"authStrategy"`
}

type fronteggMFA struct {
Expand Down Expand Up @@ -383,6 +384,14 @@ per Frontegg provider.`,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"none", "lax", "strict"}, false),
},
"auth_strategy": {
Description: `The authentication strategy to use for people logging in.
Must be one of "EmailAndPassword" or "Code"`,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"EmailAndPassword", "Code"}, false),
},
},
},
},
Expand Down Expand Up @@ -867,6 +876,7 @@ func resourceFronteggWorkspaceRead(ctx context.Context, d *schema.ResourceData,
"jwt_refresh_token_expiration": out.DefaultRefreshTokenExpiration,
"jwt_public_key": out.PublicKey,
"same_site_cookie_policy": strings.ToLower(out.CookieSameSite),
"auth_strategy": out.AuthStrategy,
}
if err := d.Set("auth_policy", []interface{}{auth_policy}); err != nil {
return diag.FromErr(err)
Expand Down Expand Up @@ -1165,6 +1175,7 @@ func resourceFronteggWorkspaceUpdate(ctx context.Context, d *schema.ResourceData
DefaultRefreshTokenExpiration: d.Get("auth_policy.0.jwt_refresh_token_expiration").(int),
PublicKey: d.Get("auth_policy.0.jwt_public_key").(string),
CookieSameSite: strings.ToUpper(d.Get("auth_policy.0.same_site_cookie_policy").(string)),
AuthStrategy: d.Get("auth_policy.0.auth_strategy").(string),
}
if err := clientHolder.ApiClient.Post(ctx, fronteggAuthURL, in, nil); err != nil {
return diag.FromErr(err)
Expand Down

0 comments on commit 243e864

Please sign in to comment.