authentication

package
v0.0.0-...-8717a1f Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventLogin          = "user.authentication.login"
	EventForgotPassword = "user.authentication.forgot_password"

	ErrUserRegistered        = errors.New("User already registered")
	ErrUserNotVerified       = errors.New("User not verified")
	ErrWrongPassword         = errors.New("Wrong password")
	ErrServiceNotImplemented = errors.New("Service not implemented")
	ErrWrongOTP              = errors.New("Wrong OTP")
	ErrWrongBackupCode       = errors.New("code doesn't match any backup codes")
	ErrOTPInvalid            = errors.New("OTP Invalid")
)
View Source
var (
	MetricKeys = []string{"method"}
)

Functions

func WithConfiguration

func WithConfiguration(cfg *config.Configuration) func(service *service)

func WithKeyValueService

func WithKeyValueService(keyValueService userland.KeyValueService) func(service *service)

func WithMailingClient

func WithMailingClient(mailingClient mailing.Client) func(service *service)

func WithUserRepository

func WithUserRepository(userRepository userland.UserRepository) func(service *service)

Types

type Service

type Service interface {
	Register(user userland.User) error
	RequestVerification(verificationType string, email string) (verificationID string, err error)
	VerifyAccount(verificationID string, email string, code string) error
	Login(email, password string) (requireTFA bool, accessToken security.AccessToken, err error)
	VerifyTFA(tfaToken string, userID int, code string) (accessToken security.AccessToken, err error)
	VerifyTFABypass(tfaToken string, userID int, code string) (accessToken security.AccessToken, err error)
	ForgotPassword(email string) (verificationID string, err error)
	ResetPassword(forgotPassToken string, newPassword string) error
}

Service provide an interface to story domain service

func NewInstrumentorService

func NewInstrumentorService(latency metrics.Histogram, s Service) Service

func NewService

func NewService(options ...func(*service)) Service

Jump to

Keyboard shortcuts

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