manager

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEVEmailDoesntMatch   = errors.New("email in EV doesn't match user email")
	ErrorEmailAlreadyVerified = errors.New("email already verified")

	ErrorPasswordAlreadyChanged = errors.New("password has already been changed")
)

Functions

This section is empty.

Types

type EmailVerifiable

type EmailVerifiable interface {
	UserID() string
	Email() string
	Callback() *url.URL
}

type ManagerOptions

type ManagerOptions struct {
}

type PasswordChangeable

type PasswordChangeable interface {
	UserID() string
	Password() user.Password
	Callback() *url.URL
}

type UserManager

type UserManager struct {
	Clock clockwork.Clock
	// contains filtered or unexported fields
}

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) Disable

func (m *UserManager) Disable(userID string, disabled bool) error

func (*UserManager) Get

func (m *UserManager) Get(id string) (user.User, error)

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) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL