Documentation ¶
Index ¶
- Constants
- Variables
- func TestRepo(ctx context.Context, t *testing.T, newRepo func() ReadWriter)
- type ActivateTOTPGuard
- type ActivateTOTPInput
- type ActivateUserInput
- type ActivateUsersGuard
- type Activated
- type AlreadySignedUp
- type ApproveTOTPResetRequestInput
- type ChangePasswordGuard
- type ChangePasswordInput
- type ChangeRolesGuard
- type ChangeRolesInput
- type ChangeTOTPTelGuard
- type ChangeTOTPTelInput
- type ChoosePasswordGuard
- type ChoosePasswordInput
- type CreateRoleGuard
- type CreateRoleInput
- type DeleteRoleGuard
- type DeleteRoleInput
- type DenyTOTPResetRequestInput
- type DisableTOTPGuard
- type DisableTOTPInput
- type Email
- type FacebookSignInBehavior
- type GoogleSignInBehavior
- type Hasher
- type InitialUserSignedUp
- type InviteUserGuard
- type InviteUserInput
- type Invited
- type MagicLinkSignInBehavior
- type Password
- type PasswordChanged
- type PasswordChosen
- type PasswordReset
- type Permission
- type ReadWriter
- type Reader
- type RecoveryCode
- type RecoveryCodesRegenerated
- type RegenerateRecoveryCodesGuard
- type RegenerateRecoveryCodesInput
- type RequestTOTPResetInput
- type ResetPasswordGuard
- type ResetPasswordInput
- type ResetTOTPGuard
- type ResetTOTPInput
- type Role
- type RoleDesc
- type RoleFilter
- type RoleName
- type RolesChanged
- type Service
- func (s *Service) ActivateTOTP(ctx context.Context, guard ActivateTOTPGuard, userID int) (*User, error)
- func (s *Service) ActivateTOTPValidate(guard ActivateTOTPGuard, userID int) (ActivateTOTPInput, error)
- func (s *Service) ActivateUser(ctx context.Context, guard ActivateUsersGuard, userID int) (*User, error)
- func (s *Service) ActivateUserValidate(guard ActivateUsersGuard, userID int) (ActivateUserInput, error)
- func (s *Service) ApproveTOTPResetRequest(ctx context.Context, userID int) (*User, error)
- func (s *Service) ApproveTOTPResetRequestValidate(userID int) (ApproveTOTPResetRequestInput, error)
- func (s *Service) ChangePassword(ctx context.Context, guard ChangePasswordGuard, userID int, ...) (*User, error)
- func (s *Service) ChangePasswordValidate(guard ChangePasswordGuard, userID int, ...) (ChangePasswordInput, error)
- func (s *Service) ChangeRoles(ctx context.Context, guard ChangeRolesGuard, userID int, roleIDs []int, ...) (*User, error)
- func (s *Service) ChangeRolesValidate(guard ChangeRolesGuard, userID int, roleIDs []int, grants, denials []string) (ChangeRolesInput, error)
- func (s *Service) ChangeTOTPTel(ctx context.Context, guard ChangeTOTPTelGuard, userID int, newTel string) (*User, error)
- func (s *Service) ChangeTOTPTelValidate(guard ChangeTOTPTelGuard, userID int, newTel string) (ChangeTOTPTelInput, error)
- func (s *Service) CheckSignInThrottle(attempts int, lastAttemptAt time.Time) error
- func (s *Service) ChoosePassword(ctx context.Context, guard ChoosePasswordGuard, userID int, ...) (*User, error)
- func (s *Service) ChoosePasswordValidate(guard ChoosePasswordGuard, userID int, newPassword, newPasswordCheck string) (ChoosePasswordInput, error)
- func (s *Service) CreateRole(ctx context.Context, guard CreateRoleGuard, name, description string, ...) (*Role, error)
- func (s *Service) CreateRoleValidate(guard CreateRoleGuard, name, description string, permissions []string) (CreateRoleInput, error)
- func (s *Service) DeleteRole(ctx context.Context, guard DeleteRoleGuard, roleID int) (*Role, error)
- func (s *Service) DeleteRoleValidate(guard DeleteRoleGuard, roleID int) (DeleteRoleInput, error)
- func (s *Service) DenyTOTPResetRequest(ctx context.Context, userID int) (*User, error)
- func (s *Service) DenyTOTPResetRequestValidate(userID int) (DenyTOTPResetRequestInput, error)
- func (s *Service) DisableTOTP(ctx context.Context, guard DisableTOTPGuard, userID int, password string) (*User, error)
- func (s *Service) DisableTOTPValidate(guard DisableTOTPGuard, userID int, password string) (DisableTOTPInput, error)
- func (s *Service) InviteUser(ctx context.Context, guard InviteUserGuard, email string) (*User, error)
- func (s *Service) InviteUserValidate(guard InviteUserGuard, email string) (InviteUserInput, error)
- func (s *Service) RegenerateRecoveryCodes(ctx context.Context, guard RegenerateRecoveryCodesGuard, userID int, ...) (*User, []string, error)
- func (s *Service) RegenerateRecoveryCodesValidate(guard RegenerateRecoveryCodesGuard, userID int, totp string) (RegenerateRecoveryCodesInput, error)
- func (s *Service) RequestTOTPReset(ctx context.Context, email string) (*User, error)
- func (s *Service) RequestTOTPResetValidate(email string) (RequestTOTPResetInput, error)
- func (s *Service) ResetPassword(ctx context.Context, guard ResetPasswordGuard, userID int, ...) (*User, error)
- func (s *Service) ResetPasswordValidate(guard ResetPasswordGuard, userID int, newPassword, newPasswordCheck string) (ResetPasswordInput, error)
- func (s *Service) ResetTOTP(ctx context.Context, guard ResetTOTPGuard, userID int, password string) (*User, error)
- func (s *Service) ResetTOTPValidate(guard ResetTOTPGuard, userID int, password string) (ResetTOTPInput, error)
- func (s *Service) SetupTOTP(ctx context.Context, guard SetupTOTPGuard, userID int) (*User, error)
- func (s *Service) SetupTOTPValidate(guard SetupTOTPGuard, userID int) (SetupTOTPInput, error)
- func (s *Service) SignInWithFacebook(ctx context.Context, email string, behavior FacebookSignInBehavior) (*User, bool, error)
- func (s *Service) SignInWithFacebookValidate(email string) (SignInWithFacebookInput, error)
- func (s *Service) SignInWithGoogle(ctx context.Context, email string, behavior GoogleSignInBehavior) (*User, bool, error)
- func (s *Service) SignInWithGoogleValidate(email string) (SignInWithGoogleInput, error)
- func (s *Service) SignInWithMagicLink(ctx context.Context, email string, behavior MagicLinkSignInBehavior) (*User, bool, error)
- func (s *Service) SignInWithMagicLinkValidate(email string) (SignInWithMagicLinkInput, error)
- func (s *Service) SignInWithPassword(ctx context.Context, email, password string) (*User, error)
- func (s *Service) SignInWithPasswordValidate(email, password string) (SignInWithPasswordInput, error)
- func (s *Service) SignInWithRecoveryCode(ctx context.Context, userID int, recoveryCode string) (*User, error)
- func (s *Service) SignInWithRecoveryCodeValidate(userID int, recoveryCode string) (SignInWithRecoveryCodeInput, error)
- func (s *Service) SignInWithTOTP(ctx context.Context, userID int, totp string) (*User, error)
- func (s *Service) SignInWithTOTPValidate(userID int, totp string) (SignInWithTOTPInput, error)
- func (s *Service) SignUp(ctx context.Context, email string) (*User, error)
- func (s *Service) SignUpInitialUser(ctx context.Context, email, password, passwordCheck string, roleIDs []int) (*User, error)
- func (s *Service) SignUpInitialUserValidate(email, password, passwordCheck string, roleIDs []int) (SignUpInitialUserInput, error)
- func (s *Service) SignUpValidate(email string) (SignUpInput, error)
- func (s *Service) SuspendUser(ctx context.Context, guard SuspendUsersGuard, userID int, ...) (*User, error)
- func (s *Service) SuspendUserValidate(guard SuspendUsersGuard, userID int, suspendedReason string) (SuspendUserInput, error)
- func (s *Service) UnsuspendUser(ctx context.Context, guard UnsuspendUsersGuard, userID int) (*User, error)
- func (s *Service) UnsuspendUserValidate(guard UnsuspendUsersGuard, userID int) (UnsuspendUserInput, error)
- func (s *Service) UpdateRole(ctx context.Context, guard UpdateRoleGuard, roleID int, ...) (*Role, error)
- func (s *Service) UpdateRoleValidate(guard UpdateRoleGuard, roleID int, name, description string, ...) (UpdateRoleInput, error)
- func (s *Service) VerifyTOTP(ctx context.Context, guard VerifyTOTPGuard, userID int, ...) (*User, []string, error)
- func (s *Service) VerifyTOTPValidate(guard VerifyTOTPGuard, userID int, totp, totpMethod string) (VerifyTOTPInput, error)
- func (s *Service) VerifyUser(ctx context.Context, email, password, passwordCheck string, ...) (*User, error)
- func (s *Service) VerifyUserValidate(email, password, passwordCheck string) (VerifyUserInput, error)
- type SetupTOTPGuard
- type SetupTOTPInput
- type SignInAttemptLog
- type SignInThrottleError
- type SignInWithFacebookInput
- type SignInWithGoogleInput
- type SignInWithMagicLinkInput
- type SignInWithPasswordInput
- type SignInWithRecoveryCodeInput
- type SignInWithTOTPInput
- type SignUpInitialUserInput
- type SignUpInput
- type SignedIn
- type SignedUp
- type SuspendUserInput
- type SuspendUsersGuard
- type Suspended
- type SuspendedReason
- type SuspendedReasonChanged
- type TOTP
- type TOTPDisabled
- type TOTPKey
- type TOTPMethod
- type TOTPReset
- type TOTPResetRequestApproved
- type TOTPResetRequestDenied
- type TOTPResetRequested
- type TOTPTelChanged
- type Tel
- type UnsuspendUserInput
- type UnsuspendUsersGuard
- type Unsuspended
- type UpdateRoleGuard
- type UpdateRoleInput
- type User
- func (u *User) Activate() error
- func (u *User) ActivateTOTP() error
- func (u *User) ApproveTOTPResetRequest() error
- func (u *User) ChangePassword(oldPassword, newPassword Password, hasher Hasher) error
- func (u *User) ChangeRoles(roles []*Role, grants, denials []Permission)
- func (u *User) ChangeTOTPTel(newTel Tel) error
- func (u *User) ChoosePassword(newPassword Password, hasher Hasher) error
- func (u *User) DenyTOTPResetRequest() error
- func (u *User) DisableTOTP(password Password, hasher Hasher) error
- func (u *User) GenerateTOTP() (string, error)
- func (u *User) HasActivatedTOTP() bool
- func (u *User) HasSetupTOTP() bool
- func (u *User) HasSignedIn() bool
- func (u *User) HasVerifiedTOTP() bool
- func (u *User) Invite(system string) error
- func (u *User) IsActivated() bool
- func (u *User) IsSuspended() bool
- func (u *User) IsVerified() bool
- func (u *User) Permissions() []string
- func (u *User) RegenerateRecoveryCodes(totp TOTP) ([]string, error)
- func (u *User) RequestTOTPReset() error
- func (u *User) ResetPassword(newPassword Password, hasher Hasher) error
- func (u *User) ResetTOTP(password Password, hasher Hasher) error
- func (u *User) SetupTOTP() error
- func (u *User) SignInWithFacebook(system string) error
- func (u *User) SignInWithGoogle(system string) error
- func (u *User) SignInWithMagicLink(system string) error
- func (u *User) SignInWithPassword(system string, password Password, hasher Hasher) (bool, error)
- func (u *User) SignInWithRecoveryCode(system string, code RecoveryCode) error
- func (u *User) SignInWithTOTP(system string, totp TOTP) error
- func (u *User) SignUp(system string)
- func (u *User) SignUpAsInitialUser(system string, roles []*Role, password Password, hasher Hasher) error
- func (u *User) SignUpWithFacebook(system string)
- func (u *User) SignUpWithGoogle(system string)
- func (u *User) SignUpWithMagicLink(system string)
- func (u *User) Suspend(reason SuspendedReason)
- func (u *User) Unsuspend()
- func (u *User) Verify(password Password, hasher Hasher) error
- func (u *User) VerifyTOTP(totp TOTP, method TOTPMethod) ([]string, error)
- type UserFilter
- type Verified
- type VerifyTOTPGuard
- type VerifyTOTPInput
- type VerifyUserBehavior
- type VerifyUserInput
- type Writer
Constants ¶
View Source
const ( MaxFreeSignInAttempts = 3 MaxSignInThrottleDelay = app.SignInThrottleTTL / 2 )
View Source
const ( SignInMethodNone = "" SignInMethodPassword = "account.user.sign_in_method.password" SignInMethodMagicLink = "account.user.sign_in_method.magic_link" SignInMethodGoogle = "account.user.sign_in_method.google" SignInMethodFacebook = "account.user.sign_in_method.facebook" )
View Source
const ( SignUpMethodNone = "" SignUpMethodSystemSetup = "account.user.sign_up_method.system_setup" SignUpMethodWebForm = "account.user.sign_up_method.web_form" SignUpMethodMagicLink = "account.user.sign_up_method.magic_link" SignUpMethodGoogle = "account.user.sign_up_method.google" SignUpMethodFacebook = "account.user.sign_up_method.facebook" SignUpMethodInvite = "account.user.sign_up_method.invite" )
Variables ¶
View Source
var ( ErrNotVerified = i18n.M("account.user.error.not_verified") ErrAlreadyVerified = i18n.M("account.user.error.already_verified") ErrNotActivated = i18n.M("account.user.error.not_activated") ErrAlreadyActivated = i18n.M("account.user.error.already_activated") ErrSuspended = i18n.M("account.user.error.is_suspended") ErrInvalidPassword = i18n.M("account.user.error.invalid_password") )
View Source
var ErrAuth = errors.New("auth")
View Source
var ErrFacebookSignUpDisabled = errors.New("Facebook sign up disabled")
View Source
var ErrGoogleSignUpDisabled = errors.New("Google sign up disabled")
View Source
var ErrMagicLinkSignUpDisabled = errors.New("magic link sign up disabled")
View Source
var ErrSignInThrottled = errors.New("sign in throttled")
Functions ¶
Types ¶
type ActivateTOTPGuard ¶
type ActivateTOTPInput ¶
type ActivateTOTPInput struct {
UserID int
}
type ActivateUserInput ¶
type ActivateUserInput struct {
UserID int
}
type ActivateUsersGuard ¶
type ActivateUsersGuard interface {
CanActivateUsers() bool
}
type AlreadySignedUp ¶
type ApproveTOTPResetRequestInput ¶
type ApproveTOTPResetRequestInput struct {
UserID int
}
type ChangePasswordGuard ¶
type ChangePasswordInput ¶
type ChangeRolesGuard ¶
type ChangeRolesInput ¶
type ChangeRolesInput struct { UserID int RoleIDs []int Grants []Permission Denials []Permission }
type ChangeTOTPTelGuard ¶
type ChangeTOTPTelInput ¶
type ChoosePasswordGuard ¶
type ChoosePasswordInput ¶
type CreateRoleGuard ¶
type CreateRoleGuard interface {
CanCreateRoles() bool
}
type CreateRoleInput ¶
type CreateRoleInput struct { Name RoleName Description RoleDesc Permissions []Permission }
type DeleteRoleGuard ¶
type DeleteRoleGuard interface {
CanDeleteRoles() bool
}
type DeleteRoleInput ¶
type DeleteRoleInput struct {
RoleID int
}
type DenyTOTPResetRequestInput ¶
type DenyTOTPResetRequestInput struct {
UserID int
}
type DisableTOTPGuard ¶
type DisableTOTPInput ¶
type FacebookSignInBehavior ¶
type FacebookSignInBehavior byte
const ( FacebookSignInOnly FacebookSignInBehavior = iota FacebookAllowSignUp FacebookAllowSignUpActivate )
type GoogleSignInBehavior ¶
type GoogleSignInBehavior byte
const ( GoogleSignInOnly GoogleSignInBehavior = iota GoogleAllowSignUp GoogleAllowSignUpActivate )
type InitialUserSignedUp ¶
type InviteUserGuard ¶
type InviteUserGuard interface {
CanInviteUsers() bool
}
type InviteUserInput ¶
type InviteUserInput struct {
Email Email
}
type MagicLinkSignInBehavior ¶
type MagicLinkSignInBehavior byte
const ( MagicLinkSignInOnly MagicLinkSignInBehavior = iota MagicLinkAllowSignUp MagicLinkAllowSignUpActivate )
type Password ¶
type Password struct {
// contains filtered or unexported fields
}
func NewPassword ¶
type PasswordChanged ¶
type PasswordChanged struct {
Email string
}
type PasswordChosen ¶
type PasswordChosen struct {
Email string
}
type PasswordReset ¶
type PasswordReset struct {
Email string
}
type Permission ¶
type Permission string
func NewPermission ¶
func NewPermission(name string) (Permission, error)
func (Permission) String ¶
func (n Permission) String() string
type ReadWriter ¶
type Reader ¶
type Reader interface { FindRoleByID(ctx context.Context, id int) (*Role, error) CountUsers(ctx context.Context) (int, error) FindUserByID(ctx context.Context, id int) (*User, error) FindUserByEmail(ctx context.Context, email string) (*User, error) FindSignInAttemptLogByEmail(ctx context.Context, email string) (*SignInAttemptLog, error) }
type RecoveryCode ¶
type RecoveryCode string
func NewRandomRecoveryCode ¶
func NewRandomRecoveryCode() (RecoveryCode, error)
func NewRecoveryCode ¶
func NewRecoveryCode(code string) (RecoveryCode, error)
func (RecoveryCode) EqualHash ¶
func (c RecoveryCode) EqualHash(rhs []byte) bool
func (RecoveryCode) String ¶
func (c RecoveryCode) String() string
type RecoveryCodesRegenerated ¶
type RecoveryCodesRegenerated struct {
Email string
}
type RequestTOTPResetInput ¶
type RequestTOTPResetInput struct {
Email Email
}
type ResetPasswordGuard ¶
type ResetPasswordInput ¶
type ResetTOTPGuard ¶
type ResetTOTPInput ¶
type RoleFilter ¶
type RolesChanged ¶
type RolesChanged struct {
Email string
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ActivateTOTP ¶
func (*Service) ActivateTOTPValidate ¶
func (s *Service) ActivateTOTPValidate(guard ActivateTOTPGuard, userID int) (ActivateTOTPInput, error)
func (*Service) ActivateUser ¶
func (*Service) ActivateUserValidate ¶
func (s *Service) ActivateUserValidate(guard ActivateUsersGuard, userID int) (ActivateUserInput, error)
func (*Service) ApproveTOTPResetRequest ¶
func (*Service) ApproveTOTPResetRequestValidate ¶
func (s *Service) ApproveTOTPResetRequestValidate(userID int) (ApproveTOTPResetRequestInput, error)
func (*Service) ChangePassword ¶
func (*Service) ChangePasswordValidate ¶
func (s *Service) ChangePasswordValidate(guard ChangePasswordGuard, userID int, oldPassword, newPassword, newPasswordCheck string) (ChangePasswordInput, error)
func (*Service) ChangeRoles ¶
func (*Service) ChangeRolesValidate ¶
func (s *Service) ChangeRolesValidate(guard ChangeRolesGuard, userID int, roleIDs []int, grants, denials []string) (ChangeRolesInput, error)
func (*Service) ChangeTOTPTel ¶
func (*Service) ChangeTOTPTelValidate ¶
func (s *Service) ChangeTOTPTelValidate(guard ChangeTOTPTelGuard, userID int, newTel string) (ChangeTOTPTelInput, error)
func (*Service) CheckSignInThrottle ¶
func (*Service) ChoosePassword ¶
func (*Service) ChoosePasswordValidate ¶
func (s *Service) ChoosePasswordValidate(guard ChoosePasswordGuard, userID int, newPassword, newPasswordCheck string) (ChoosePasswordInput, error)
func (*Service) CreateRole ¶
func (*Service) CreateRoleValidate ¶
func (s *Service) CreateRoleValidate(guard CreateRoleGuard, name, description string, permissions []string) (CreateRoleInput, error)
func (*Service) DeleteRole ¶
func (*Service) DeleteRoleValidate ¶
func (s *Service) DeleteRoleValidate(guard DeleteRoleGuard, roleID int) (DeleteRoleInput, error)
func (*Service) DenyTOTPResetRequest ¶
func (*Service) DenyTOTPResetRequestValidate ¶
func (s *Service) DenyTOTPResetRequestValidate(userID int) (DenyTOTPResetRequestInput, error)
func (*Service) DisableTOTP ¶
func (*Service) DisableTOTPValidate ¶
func (s *Service) DisableTOTPValidate(guard DisableTOTPGuard, userID int, password string) (DisableTOTPInput, error)
func (*Service) InviteUser ¶
func (*Service) InviteUserValidate ¶
func (s *Service) InviteUserValidate(guard InviteUserGuard, email string) (InviteUserInput, error)
func (*Service) RegenerateRecoveryCodes ¶
func (*Service) RegenerateRecoveryCodesValidate ¶
func (s *Service) RegenerateRecoveryCodesValidate(guard RegenerateRecoveryCodesGuard, userID int, totp string) (RegenerateRecoveryCodesInput, error)
func (*Service) RequestTOTPReset ¶
func (*Service) RequestTOTPResetValidate ¶
func (s *Service) RequestTOTPResetValidate(email string) (RequestTOTPResetInput, error)
func (*Service) ResetPassword ¶
func (*Service) ResetPasswordValidate ¶
func (s *Service) ResetPasswordValidate(guard ResetPasswordGuard, userID int, newPassword, newPasswordCheck string) (ResetPasswordInput, error)
func (*Service) ResetTOTPValidate ¶
func (s *Service) ResetTOTPValidate(guard ResetTOTPGuard, userID int, password string) (ResetTOTPInput, error)
func (*Service) SetupTOTPValidate ¶
func (s *Service) SetupTOTPValidate(guard SetupTOTPGuard, userID int) (SetupTOTPInput, error)
func (*Service) SignInWithFacebook ¶
func (*Service) SignInWithFacebookValidate ¶
func (s *Service) SignInWithFacebookValidate(email string) (SignInWithFacebookInput, error)
func (*Service) SignInWithGoogle ¶
func (*Service) SignInWithGoogleValidate ¶
func (s *Service) SignInWithGoogleValidate(email string) (SignInWithGoogleInput, error)
func (*Service) SignInWithMagicLink ¶
func (*Service) SignInWithMagicLinkValidate ¶
func (s *Service) SignInWithMagicLinkValidate(email string) (SignInWithMagicLinkInput, error)
func (*Service) SignInWithPassword ¶
func (*Service) SignInWithPasswordValidate ¶
func (s *Service) SignInWithPasswordValidate(email, password string) (SignInWithPasswordInput, error)
func (*Service) SignInWithRecoveryCode ¶
func (*Service) SignInWithRecoveryCodeValidate ¶
func (s *Service) SignInWithRecoveryCodeValidate(userID int, recoveryCode string) (SignInWithRecoveryCodeInput, error)
func (*Service) SignInWithTOTP ¶
func (*Service) SignInWithTOTPValidate ¶
func (s *Service) SignInWithTOTPValidate(userID int, totp string) (SignInWithTOTPInput, error)
func (*Service) SignUpInitialUser ¶
func (*Service) SignUpInitialUserValidate ¶
func (s *Service) SignUpInitialUserValidate(email, password, passwordCheck string, roleIDs []int) (SignUpInitialUserInput, error)
func (*Service) SignUpValidate ¶
func (s *Service) SignUpValidate(email string) (SignUpInput, error)
func (*Service) SuspendUser ¶
func (*Service) SuspendUserValidate ¶
func (s *Service) SuspendUserValidate(guard SuspendUsersGuard, userID int, suspendedReason string) (SuspendUserInput, error)
func (*Service) UnsuspendUser ¶
func (*Service) UnsuspendUserValidate ¶
func (s *Service) UnsuspendUserValidate(guard UnsuspendUsersGuard, userID int) (UnsuspendUserInput, error)
func (*Service) UpdateRole ¶
func (*Service) UpdateRoleValidate ¶
func (s *Service) UpdateRoleValidate(guard UpdateRoleGuard, roleID int, name, description string, permissions []string) (UpdateRoleInput, error)
func (*Service) VerifyTOTP ¶
func (*Service) VerifyTOTPValidate ¶
func (s *Service) VerifyTOTPValidate(guard VerifyTOTPGuard, userID int, totp, totpMethod string) (VerifyTOTPInput, error)
func (*Service) VerifyUser ¶
func (*Service) VerifyUserValidate ¶
func (s *Service) VerifyUserValidate(email, password, passwordCheck string) (VerifyUserInput, error)
type SetupTOTPGuard ¶
type SetupTOTPInput ¶
type SetupTOTPInput struct {
UserID int
}
type SignInAttemptLog ¶
type SignInThrottleError ¶
type SignInThrottleError struct { InLast time.Duration Delay time.Duration UnlockAt time.Time UnlockIn time.Duration }
func (SignInThrottleError) Error ¶
func (t SignInThrottleError) Error() string
type SignInWithFacebookInput ¶
type SignInWithFacebookInput struct {
Email Email
}
type SignInWithGoogleInput ¶
type SignInWithGoogleInput struct {
Email Email
}
type SignInWithMagicLinkInput ¶
type SignInWithMagicLinkInput struct {
Email Email
}
type SignInWithPasswordInput ¶
type SignInWithRecoveryCodeInput ¶
type SignInWithRecoveryCodeInput struct { UserID int RecoveryCode RecoveryCode }
type SignInWithTOTPInput ¶
type SignUpInitialUserInput ¶
type SignUpInput ¶
type SignUpInput struct {
Email Email
}
type SuspendUserInput ¶
type SuspendUserInput struct { UserID int SuspendedReason SuspendedReason }
type SuspendUsersGuard ¶
type SuspendUsersGuard interface {
CanSuspendUsers() bool
}
type SuspendedReason ¶
type SuspendedReason string
func NewSuspendedReason ¶
func NewSuspendedReason(reason string) (SuspendedReason, error)
func (SuspendedReason) String ¶
func (s SuspendedReason) String() string
type SuspendedReasonChanged ¶
type TOTPDisabled ¶
type TOTPDisabled struct {
Email string
}
type TOTPMethod ¶
type TOTPMethod string
const ( TOTPMethodNone TOTPMethod = "" TOTPMethodApp TOTPMethod = "app" TOTPMethodSMS TOTPMethod = "sms" )
func NewTOTPMethod ¶
func NewTOTPMethod(method string) (TOTPMethod, error)
func (TOTPMethod) String ¶
func (t TOTPMethod) String() string
type TOTPResetRequestApproved ¶
type TOTPResetRequestApproved struct {
Email string
}
type TOTPResetRequestDenied ¶
type TOTPResetRequestDenied struct {
Email string
}
type TOTPResetRequested ¶
type TOTPResetRequested struct {
Email string
}
type TOTPTelChanged ¶
type UnsuspendUserInput ¶
type UnsuspendUserInput struct {
UserID int
}
type UnsuspendUsersGuard ¶
type UnsuspendUsersGuard interface {
CanUnsuspendUsers() bool
}
type Unsuspended ¶
type Unsuspended struct {
Email string
}
type UpdateRoleGuard ¶
type UpdateRoleGuard interface {
CanUpdateRoles() bool
}
type UpdateRoleInput ¶
type UpdateRoleInput struct { RoleID int Name RoleName Description RoleDesc Permissions []Permission }
type User ¶
type User struct { aggregate.Root ID int Email string HashedPassword []byte TOTPMethod string TOTPTel string TOTPKey []byte TOTPAlgorithm string TOTPDigits int TOTPPeriod time.Duration TOTPVerifiedAt time.Time TOTPActivatedAt time.Time TOTPResetRequestedAt time.Time TOTPResetApprovedAt time.Time InvitedAt time.Time SignedUpAt time.Time SignedUpSystem string SignedUpMethod string VerifiedAt time.Time ActivatedAt time.Time LastSignInAttemptAt time.Time LastSignInAttemptSystem string LastSignInAttemptMethod string LastSignedInAt time.Time LastSignedInSystem string LastSignedInMethod string SuspendedAt time.Time SuspendedReason string HashedRecoveryCodes [][]byte Roles []*Role Grants []string Denials []string }
func (*User) ActivateTOTP ¶
func (*User) ApproveTOTPResetRequest ¶
func (*User) ChangePassword ¶
func (*User) ChangeRoles ¶
func (u *User) ChangeRoles(roles []*Role, grants, denials []Permission)
func (*User) ChangeTOTPTel ¶
func (*User) ChoosePassword ¶
func (*User) DenyTOTPResetRequest ¶
func (*User) GenerateTOTP ¶
func (*User) HasActivatedTOTP ¶
func (*User) HasSetupTOTP ¶
func (*User) HasSignedIn ¶
func (*User) HasVerifiedTOTP ¶
func (*User) IsActivated ¶
func (*User) IsSuspended ¶
func (*User) IsVerified ¶
func (*User) Permissions ¶
func (*User) RegenerateRecoveryCodes ¶
func (*User) RequestTOTPReset ¶
func (*User) ResetPassword ¶
func (*User) SignInWithFacebook ¶
func (*User) SignInWithGoogle ¶
func (*User) SignInWithMagicLink ¶
func (*User) SignInWithPassword ¶
func (*User) SignInWithRecoveryCode ¶
func (u *User) SignInWithRecoveryCode(system string, code RecoveryCode) error
func (*User) SignUpAsInitialUser ¶
func (*User) SignUpWithFacebook ¶
func (*User) SignUpWithGoogle ¶
func (*User) SignUpWithMagicLink ¶
func (*User) Suspend ¶
func (u *User) Suspend(reason SuspendedReason)
func (*User) VerifyTOTP ¶
func (u *User) VerifyTOTP(totp TOTP, method TOTPMethod) ([]string, error)
type UserFilter ¶
type VerifyTOTPGuard ¶
type VerifyTOTPInput ¶
type VerifyTOTPInput struct { UserID int TOTP TOTP TOTPMethod TOTPMethod }
type VerifyUserBehavior ¶
type VerifyUserBehavior byte
const ( VerifyUserOnly VerifyUserBehavior = iota VerifyUserActivate )
type VerifyUserInput ¶
type Writer ¶
type Writer interface { AddRole(ctx context.Context, role *Role) error SaveRole(ctx context.Context, role *Role) error RemoveRole(ctx context.Context, roleID int) error AddUser(ctx context.Context, user *User) error SaveUser(ctx context.Context, user *User) error SaveSignInAttemptLog(ctx context.Context, log *SignInAttemptLog) error }
Source Files ¶
- activate_totp.go
- activate_user.go
- approve_totp_reset_request.go
- change_password.go
- change_roles.go
- change_totp_telephone.go
- choose_password.go
- create_role.go
- delete_role.go
- deny_totp_reset_request.go
- disable_totp.go
- email.go
- events.go
- invite_user.go
- password.go
- permission.go
- recovery_code.go
- regen_recovery_codes.go
- repo.go
- request_totp_reset.go
- reset_password.go
- reset_totp.go
- role.go
- role_desc.go
- role_name.go
- service.go
- setup_totp.go
- sign_in_attempt_log.go
- sign_in_facebook.go
- sign_in_google.go
- sign_in_magic_link.go
- sign_in_password.go
- sign_in_recovery_code.go
- sign_in_totp.go
- sign_up.go
- sign_up_initial_user.go
- suspend.go
- suspend_reason.go
- tel.go
- totp.go
- totp_key.go
- totp_method.go
- unsuspend.go
- update_role.go
- user.go
- verify_totp.go
- verify_user.go
Click to show internal directories.
Click to hide internal directories.