Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUserNameExists = errors.New("the username exists") ErrSendingMail = errors.New("failed sending email") ErrAccountNotActive = errors.New("account is not active") ErrTokenGeneration = errors.New("failed to generate token") ErrInvalidToken = errors.New("token is invalid") ErrAccessToken = errors.New("failed to access token") ErrInvalidUsername = errors.New("invalid username") ErrInvalidPassword = errors.New("invalid password") ErrRegistration = errors.New("failed to register ") ErrPasswordUpdate = errors.New("failed to update password") ErrTwoFactorCode = errors.New("failed to verify two factor code") ErrTwoFactorRequest = errors.New("failed to send two factor request") ErrInvalidCode = errors.New("code is invalid") ErrServer = errors.New("server error, try again later") ErrPassCode = errors.New("invalid Passcode") ErrStrongPassword = errors.New("password must be at least 8 characters and must contain special characters") ErrTOTPExists = errors.New("totp already enabled ") )
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface { LoginByUsernamePassword(username, password, ipAddress, userAgent string) (*models.AuthenticationResponse, error) PasswordlessLogin(username, sendMethod, ipAddress, userAgent string) (*models.PasswordLessAuthResponse, error) CompletePasswordLessLogin(code, requestId string) (*models.AuthenticationResponse, error) ResetPasswordRequest(username string) (bool, error) GenerateRefreshToken(oldRefreshToken, ipAddress, userAgent string) (*models.AuthenticationResponse, error) VerifyAndSetNewPassword(code string, password string) (bool, error) DeleteExpiredTokens(days int) error VerifyPassCode(userId int, passCode string) bool VerifyTOTP(userId int, passCode, ipAddress, userAgent string) (*models.AuthenticationResponse, error) ValidateTwoFactor(code, requestId string, ipAddress, userAgent string) (*models.AuthenticationResponse, error) }
func NewAuthService ¶
func NewAuthService(db *sql.DB, userService UserService, emailService EmailService) AuthService
type EmailService ¶
type EmailService interface { SendTwoFactorRequest(randomCodes string, userDetails models.User) error SendEmailLoginRequest(randomCodes string, userDetails models.User) error SendPasswordResetRequest(randomCodes string, userDetails models.User) error }
func NewEmailService ¶
func NewEmailService(secure bool) EmailService
type UserService ¶
type UserService interface { List(offset int, limit int) ([]models.User, error) Get(userId int) *models.User GetByUsername(username string) *models.User GetRoles(userId int) ([]string, error) Update(userId int, userUpdateRequest models.UserUpdateRequest) error DeleteToken(userId int, refreshToken string) (bool, error) EnableTwoFactorTOTP(userId int) (*models.EnableTOTPResponse, error) EnableTwoFactor(userId int, methodCode string) error Register(userRegistrationRequest models.UserRegistrationRequest) (bool, error) }
func NewUserService ¶
func NewUserService(db *sql.DB) UserService
Click to show internal directories.
Click to hide internal directories.