Versions in this module Expand all Collapse all v0 v0.1.0 Sep 3, 2015 Changes in this version + const ClaimEmailVerificationCallback + const ClaimEmailVerificationEmail + const ClaimPasswordResetCallback + const ClaimPasswordResetPassword + const MaxEmailLength + var ErrorDuplicateEmail = errors.New("email not available") + var ErrorDuplicateID = errors.New("ID not available") + var ErrorDuplicateRemoteIdentity = errors.New("remote identity already in use for another user") + var ErrorEVEmailDoesntMatch = errors.New("email in EV doesn't match user email") + var ErrorEmailAlreadyVerified = errors.New("email already verified") + var ErrorInvalidEmail = errors.New("invalid Email") + var ErrorInvalidID = errors.New("invalid ID") + var ErrorInvalidPassword = errors.New("invalid Password") + var ErrorNotFound = errors.New("user not found in repository") + var ErrorPasswordAlreadyChanged = errors.New("password has already been changed") + var ErrorPasswordExpired = errors.New("password has expired") + var ErrorPasswordHashNoMatch = errors.New("password and hash don't match") + var PasswordHasher = DefaultPasswordHasher + func DefaultPasswordHasher(s string) ([]byte, error) + func DefaultUserIDGenerator() (string, error) + func EncodeNextPageToken(filter UserFilter, maxResults int, offset int) (string, error) + func LoadPasswordInfos(repo PasswordInfoRepo, pws []PasswordInfo) error + func ValidEmail(email string) bool + func ValidPassword(plaintext string) bool + type EmailVerification struct + func NewEmailVerification(user User, clientID string, issuer url.URL, callback url.URL, ...) EmailVerification + func ParseAndVerifyEmailVerificationToken(token string, issuer url.URL, keys []key.PublicKey) (EmailVerification, error) + func (e EmailVerification) Callback() *url.URL + func (e EmailVerification) Email() string + func (e EmailVerification) Token(signer jose.Signer) (string, error) + func (e EmailVerification) UserID() string + type Hasher func(string) ([]byte, error) + type Manager struct + Clock clockwork.Clock + func NewManager(userRepo UserRepo, pwRepo PasswordInfoRepo, txnFactory repo.TransactionFactory, ...) *Manager + func (m *Manager) ChangePassword(pwr PasswordReset, plaintext string) (*url.URL, error) + func (m *Manager) CreateUser(user User, hashedPassword Password, connID string) (string, error) + func (m *Manager) Get(id string) (User, error) + func (m *Manager) List(filter UserFilter, maxResults int, nextPageToken string) ([]User, string, error) + func (m *Manager) RegisterWithPassword(email, plaintext, connID string) (string, error) + func (m *Manager) RegisterWithRemoteIdentity(email string, emailVerified bool, rid RemoteIdentity) (string, error) + func (m *Manager) VerifyEmail(ev EmailVerification) (*url.URL, error) + type ManagerOptions struct + type Password []byte + func NewPasswordFromPlaintext(plaintext string) (Password, error) + type PasswordInfo struct + Password Password + PasswordExpires time.Time + UserID string + func (p PasswordInfo) Authenticate(plaintext string) (*oidc.Identity, error) + func (p PasswordInfo) Identity() oidc.Identity + func (u *PasswordInfo) UnmarshalJSON(data []byte) error + type PasswordInfoRepo interface + Create func(repo.Transaction, PasswordInfo) error + Get func(tx repo.Transaction, id string) (PasswordInfo, error) + Update func(repo.Transaction, PasswordInfo) error + func NewPasswordInfoRepo() PasswordInfoRepo + func NewPasswordInfoRepoFromFile(loc string) (PasswordInfoRepo, error) + func NewPasswordInfoRepoFromPasswordInfos(pws []PasswordInfo) PasswordInfoRepo + type PasswordReset struct + func NewPasswordReset(user User, password Password, issuer url.URL, clientID string, ...) PasswordReset + func ParseAndVerifyPasswordResetToken(token string, issuer url.URL, keys []key.PublicKey) (PasswordReset, error) + func (e PasswordReset) Callback() *url.URL + func (e PasswordReset) Password() Password + func (e PasswordReset) Token(signer jose.Signer) (string, error) + func (e PasswordReset) UserID() string + type RemoteIdentity struct + ConnectorID string + ID string + func (u *RemoteIdentity) UnmarshalJSON(data []byte) error + type User struct + Admin bool + CreatedAt time.Time + DisplayName string + Email string + EmailVerified bool + ID string + func (u *User) AddToClaims(claims jose.Claims) + func (u *User) UnmarshalJSON(data []byte) error + type UserFilter struct + func DecodeNextPageToken(tok string) (UserFilter, int, int, error) + type UserIDGenerator func() (string, error) + type UserRepo interface + AddRemoteIdentity func(tx repo.Transaction, userID string, remoteID RemoteIdentity) error + Create func(repo.Transaction, User) error + Get func(tx repo.Transaction, id string) (User, error) + GetAdminCount func(repo.Transaction) (int, error) + GetByEmail func(tx repo.Transaction, email string) (User, error) + GetByRemoteIdentity func(repo.Transaction, RemoteIdentity) (User, error) + GetRemoteIdentities func(tx repo.Transaction, userID string) ([]RemoteIdentity, error) + List func(tx repo.Transaction, filter UserFilter, maxResults int, nextPageToken string) ([]User, string, error) + RemoveRemoteIdentity func(tx repo.Transaction, userID string, remoteID RemoteIdentity) error + Update func(repo.Transaction, User) error + func NewUserRepo() UserRepo + func NewUserRepoFromFile(loc string) (UserRepo, error) + func NewUserRepoFromUsers(us []UserWithRemoteIdentities) UserRepo + type UserWithRemoteIdentities struct + RemoteIdentities []RemoteIdentity + User User