Documentation ¶
Index ¶
- Variables
- type EmailVerifiable
- type ManagerOptions
- type PasswordChangeable
- type UserManager
- func (m *UserManager) ChangePassword(pwr PasswordChangeable, plaintext string) (*url.URL, error)
- func (m *UserManager) CreateUser(usr user.User, hashedPassword user.Password, connID string) (string, error)
- func (m *UserManager) Disable(userID string, disabled bool) error
- func (m *UserManager) Get(id string) (user.User, error)
- func (m *UserManager) List(filter user.UserFilter, maxResults int, nextPageToken string) ([]user.User, string, error)
- func (m *UserManager) RegisterWithPassword(email, plaintext, connID string) (string, error)
- func (m *UserManager) RegisterWithRemoteIdentity(email string, emailVerified bool, rid user.RemoteIdentity) (string, error)
- func (m *UserManager) SetDisplayName(usr user.User, displayName string) error
- func (m *UserManager) VerifyEmail(ev EmailVerifiable) (*url.URL, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrorEmailAlreadyVerified = errors.New("email already verified") ErrorPasswordAlreadyChanged = errors.New("password has already been changed") )
Functions ¶
This section is empty.
Types ¶
type EmailVerifiable ¶
type ManagerOptions ¶
type ManagerOptions struct { }
type PasswordChangeable ¶
type UserManager ¶
Manager performs user-related "business-logic" functions on user and related objects. This is in contrast to the Repos which perform little more than CRUD operations.
func NewUserManager ¶
func NewUserManager(userRepo user.UserRepo, pwRepo user.PasswordInfoRepo, connCfgRepo connector.ConnectorConfigRepo, txnFactory repo.TransactionFactory, options ManagerOptions) *UserManager
func (*UserManager) ChangePassword ¶
func (m *UserManager) ChangePassword(pwr PasswordChangeable, plaintext string) (*url.URL, error)
func (*UserManager) CreateUser ¶
func (m *UserManager) CreateUser(usr user.User, hashedPassword user.Password, connID string) (string, error)
CreateUser creates a new user with the given hashedPassword; the connID should be the ID of the local connector. The userID of the created user is returned as the first argument.
func (*UserManager) List ¶
func (m *UserManager) List(filter user.UserFilter, maxResults int, nextPageToken string) ([]user.User, string, error)
func (*UserManager) RegisterWithPassword ¶
func (m *UserManager) RegisterWithPassword(email, plaintext, connID string) (string, error)
RegisterWithPassword creates a new user with the given name and password. connID is the connector ID of the ConnectorLocal connector.
func (*UserManager) RegisterWithRemoteIdentity ¶
func (m *UserManager) RegisterWithRemoteIdentity(email string, emailVerified bool, rid user.RemoteIdentity) (string, error)
RegisterWithRemoteIdentity creates new user and attaches the given remote identity.
func (*UserManager) SetDisplayName ¶ added in v0.6.0
func (m *UserManager) SetDisplayName(usr user.User, displayName string) error
func (*UserManager) VerifyEmail ¶
func (m *UserManager) VerifyEmail(ev EmailVerifiable) (*url.URL, error)
VerifyEmail sets EmailVerified to true for the user for the given EmailVerification. The email in the EmailVerification must match the User's email in the repository, and it must not already be verified. This function expects that ParseAndVerifyEmailVerificationToken was used to create it, ensuring that the token was signed and that the JWT was not expired. The callback url (i.e. where to send the user after the verification) is returned.