auth_login_phash

package
v0.0.0-...-8122643 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DelayCacheKey = "login-delay"
View Source
const ErrorCodeCredentialsRequired = "login_credentials_required"
View Source
const ErrorCodeLoginFailed = "login_failed"
View Source
const ErrorCodeWaitRetry = "wait_retry"
View Source
const LoginName = "login"
View Source
const LoginProtocol = "login_phash"
View Source
const PasswordHashName = "login-phash"
View Source
const SaltName = "login-salt"

Variables

View Source
var ErrorDescriptions = map[string]string{
	ErrorCodeLoginFailed:         "Invalid login or password",
	ErrorCodeCredentialsRequired: "Credentials hash must be provided in request",
	ErrorCodeWaitRetry:           "Retry later",
}

Functions

func IsLoginError

func IsLoginError(err generic_error.Error) bool

func Phash

func Phash(password string, salt string) string

Types

type LoginDelay

type LoginDelay struct {
	common.CreatedAtBase
}

type LoginHandler

type LoginHandler struct {
	LoginHandlerConfig
	auth.AuthHandlerBase
	// contains filtered or unexported fields
}

Auth handler for login processing. The AuthTokenHandler MUST ALWAYS follow this handler in session scheme with AND conjunction.

func (*LoginHandler) Config

func (l *LoginHandler) Config() interface{}

func (*LoginHandler) ErrorDescriptions

func (l *LoginHandler) ErrorDescriptions() map[string]string

func (*LoginHandler) ErrorProtocolCodes

func (l *LoginHandler) ErrorProtocolCodes() map[string]int

func (*LoginHandler) Handle

func (l *LoginHandler) Handle(ctx auth.AuthContext) (bool, error)

func (*LoginHandler) Init

func (l *LoginHandler) Init(cfg config.Config, log logger.Logger, vld validator.Validator, configPath ...string) error

type LoginHandlerConfig

type LoginHandlerConfig struct {
	THROTTLE_DELAY_SECONDS int `default:"2" validate:"gt=0"`
}

type User

type User interface {
	PasswordHash() string
	PasswordSalt() string
	SetPassword(password string)
	CheckPasswordHash(phash string) bool
}

type UserBase

type UserBase struct {
	PASSWORD_HASH string `json:"-"`
	PASSWORD_SALT string `json:"-"`
}

func (*UserBase) CheckPasswordHash

func (u *UserBase) CheckPasswordHash(phash string) bool

func (*UserBase) PasswordHash

func (u *UserBase) PasswordHash() string

func (*UserBase) PasswordSalt

func (u *UserBase) PasswordSalt() string

func (*UserBase) SetPassword

func (u *UserBase) SetPassword(password string)

Jump to

Keyboard shortcuts

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