Documentation ¶
Index ¶
- Constants
- Variables
- func IsLoginError(err generic_error.Error) bool
- func Phash(password string, salt string) string
- type LoginDelay
- type LoginHandler
- func (l *LoginHandler) Config() interface{}
- func (l *LoginHandler) ErrorDescriptions() map[string]string
- func (l *LoginHandler) ErrorProtocolCodes() map[string]int
- func (l *LoginHandler) Handle(ctx auth.AuthContext) (bool, error)
- func (l *LoginHandler) Init(cfg config.Config, log logger.Logger, vld validator.Validator, ...) error
- type LoginHandlerConfig
- type User
- type UserBase
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", }
View Source
var ErrorProtocolCodes = map[string]int{ ErrorCodeLoginFailed: http.StatusUnauthorized, ErrorCodeCredentialsRequired: http.StatusUnauthorized, ErrorCodeWaitRetry: http.StatusTooManyRequests, }
Functions ¶
func IsLoginError ¶
func IsLoginError(err generic_error.Error) bool
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 New ¶
func New(users auth_session.WithAuthUserManager) *LoginHandler
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)
type LoginHandlerConfig ¶
type LoginHandlerConfig struct {
THROTTLE_DELAY_SECONDS int `default:"2" validate:"gt=0"`
}
type UserBase ¶
func (*UserBase) CheckPasswordHash ¶
func (*UserBase) PasswordHash ¶
func (*UserBase) PasswordSalt ¶
func (*UserBase) SetPassword ¶
Click to show internal directories.
Click to hide internal directories.