Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Extended MFA api #200

Merged
merged 2 commits into from
Mar 23, 2021
Merged

Conversation

apamildner
Copy link
Contributor

Proposed Changes

We can now update MFA policy and some settings regarding what provider and message type we use.

Fixes #199

Acceptance Test Output

$ go test ./management -v -run "TestGuardian/MultiFactor/Phone"
...
$ go test ./management -v -run "TestGuardian/MultiFactor/Policy"

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Copy link
Contributor

@alexkappa alexkappa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for putting this together @apamildner! It looks pretty good apart from some minor things. Let me know when you'd like another review and I can merge this in.

@@ -11,6 +11,16 @@ type MultiFactor struct {
TrialExpired *bool `json:"trial_expired,omitempty"`
}

type MultiFactorPolicies []string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should alias []string. Do you see some advantage to this, or did you take this as an example from a different method in this package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I just felt it looked more neat since almost all other methods use a struct type, so the method pattern looks similar for most of the api calls in the file. But we can go without it if you think it's better.

Comment on lines 21 to 23
type MultiFactorMessageTypes struct {
MessageTypes *[]string `json:"message_types,omitempty"`
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is okay, but I'm wondering if we should apply the simplification we did in user blocks (see below). Do we expect any other fields to be present in the future for MultiFactorMessageTypes? If no we could return a []string from MessageType() and its siblings. WDYT?

auth0/management/user.go

Lines 225 to 232 in 40ec893

type userBlock struct {
BlockedFor []*UserBlock `json:"blocked_for,omitempty"`
}
type UserBlock struct {
Identifier *string `json:"identifier,omitempty"`
IP *string `json:"ip,omitempty"`
}

auth0/management/user.go

Lines 399 to 403 in 40ec893

func (m *UserManager) Blocks(id string, opts ...RequestOption) ([]*UserBlock, error) {
b := new(userBlock)
err := m.Request("GET", m.URI("user-blocks", id), &b, opts...)
return b.BlockedFor, err
}

Copy link
Contributor Author

@apamildner apamildner Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I'm sorry but I don't understand how this becomes a simplification. But to answer your question MultiFactorMessageTypes would not be expected to contain any other fields. I don't think it has any siblings, maybe the confusion lies in the name of the struct. I changed this in the latest commit.

@apamildner apamildner force-pushed the feature/extending-guardian branch from 225ad28 to c160c70 Compare March 4, 2021 16:10
@apamildner apamildner requested a review from alexkappa March 4, 2021 19:43
@apamildner
Copy link
Contributor Author

Hi! Any chance you can review this again? @alexkappa

@yvovandoorn
Copy link
Contributor

Thanks for your contribution @apamildner. It looks like you addressed @alexkappa's concerns.

I've double-checked that tests run w/o issue locally. Merging!

@yvovandoorn yvovandoorn merged commit bf99eef into go-auth0:master Mar 23, 2021
@apamildner apamildner deleted the feature/extending-guardian branch March 23, 2021 12:39
yvovandoorn added a commit that referenced this pull request Mar 23, 2021
yvovandoorn pushed a commit that referenced this pull request Mar 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extends the number of MFA options that are configurable through the api
3 participants