Skip to content

Commit

Permalink
Expose authenticators endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Serjlee committed Oct 28, 2020
1 parent d55ac58 commit 58363e5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions management/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ type UserEnrollment struct {
Type *string `json:"type,omitempty"`
}

// UserAuthenticator contains information about an Authenticator
type UserAuthenticator struct {
// ID of this authenticator.
ID *string `json:"id,omitempty"`
// Type of authenticator
Type *string `json:"type,omitempty"`
// Status of the enrollment for this authenticator
Confirmed *bool `json:"confirmed,omitempty"`
// Start date and time of this enrollment.
CreatedAt *time.Time `json:"created_at,omitempty"`
}

// UserManager manages Auth0 User resources.
type UserManager struct {
*Management
Expand Down Expand Up @@ -385,3 +397,11 @@ func (m *UserManager) ListEnrollments(id string) (enrols []*UserEnrollment, err
err = m.get(m.uri("users", id, "enrollments"), &enrols)
return enrols, err
}

// ListAuthenticators retrieves all authenticators for a user.
//
// It's an undocumented API ¯\_(ツ)_/¯
func (m *UserManager) ListAuthenticators(id string) (enrols []*UserAuthenticator, err error) {
err = m.get(m.uri("users", id, "authenticators"), &enrols)
return enrols, err
}

0 comments on commit 58363e5

Please sign in to comment.