From 58363e579ee3285c20829be7e313a47638f8d28f Mon Sep 17 00:00:00 2001 From: Luca Osti Date: Wed, 28 Oct 2020 10:52:18 +0100 Subject: [PATCH] Expose authenticators endpoint --- management/user.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/management/user.go b/management/user.go index 13208ad..72c34ec 100644 --- a/management/user.go +++ b/management/user.go @@ -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 @@ -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 +}