Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #164 from austinylin/master
Browse files Browse the repository at this point in the history
Enable support for MFA in Sign On Policy Rules
  • Loading branch information
quantumew committed May 8, 2019
2 parents 7f9f019 + 1e4b42e commit ff96331
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions okta/resource_policy_rule_sign_on.go
Expand Up @@ -208,30 +208,14 @@ func buildSignOnPolicyRule(d *schema.ResourceData, m interface{}) (articulateOkt
People: getUsers(d),
}

// Hardcoded since MFA is not implemented.
template.Actions.SignOn.RequireFactor = false
template.Actions.SignOn.RequireFactor = d.Get("mfa_required").(bool)
template.Actions.SignOn.FactorPromptMode = d.Get("mfa_prompt").(string)
template.Actions.SignOn.RememberDeviceByDefault = d.Get("mfa_remember_device").(bool)
template.Actions.SignOn.FactorLifetime = d.Get("mfa_lifetime").(int)
template.Actions.SignOn.Session.MaxSessionIdleMinutes = d.Get("session_idle").(int)
template.Actions.SignOn.Session.MaxSessionLifetimeMinutes = d.Get("session_lifetime").(int)
template.Actions.SignOn.Session.UsePersistentCookie = d.Get("session_persistent").(bool)
template.Actions.SignOn.Access = d.Get("access").(string)

// Preserving existing errors here, looks like the MFA rule needs to be there in order for these to work.
//if required, ok := d.GetOk("mfa_required"); ok {
if _, ok := d.GetOk("mfa_required"); ok {
return template, fmt.Errorf("[ERROR] mfa signon actions not supported in this terraform provider at this time")
}
//if prompt, ok := d.GetOk("mfa_prompt"); ok {
if _, ok := d.GetOk("mfa_prompt"); ok {
return template, fmt.Errorf("[ERROR] mfa signon actions not supported in this terraform provider at this time")
}
//if remember, ok := d.GetOk("mfa_remember_device"); ok {
if _, ok := d.GetOk("mfa_remember_device"); ok {
return template, fmt.Errorf("[ERROR] mfa signon actions not supported in this terraform provider at this time")
}
//if lifetime, ok := d.GetOk("mfa_lifetime"); ok {
if _, ok := d.GetOk("mfa_lifetime"); ok {
return template, fmt.Errorf("[ERROR] mfa signon actions not supported in this terraform provider at this time")
}

return template, nil
}

0 comments on commit ff96331

Please sign in to comment.