auth_sms

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CodeName = "sms-code"
View Source
const DelayName = "sms-delay"
View Source
const ErrorCodeContentMismatch = "sms_content_mismatch"
View Source
const ErrorCodeInvalidPhone = "sms_invalid_phone"
View Source
const ErrorCodeInvalidSmsCode = "sms_code_invalid"
View Source
const ErrorCodeInvalidToken = "sms_token_invalid"
View Source
const ErrorCodeSmsConfirmationRequired = "sms_confirmation_required"
View Source
const ErrorCodeSmsTokenRequired = "sms_token_required"
View Source
const ErrorCodeTokenExpired = "sms_token_expired"
View Source
const ErrorCodeTooManyTries = "sms_too_many_tries"
View Source
const ErrorCodeWaitDelay = "sms_wait_delay"
View Source
const PhoneName = "sms-phone"
View Source
const SmsDelayCacheKey = "sms-delay"
View Source
const SmsProtocol = "sms"
View Source
const SmsTokenCacheKey = "sms-token"
View Source
const TokenName = "sms-token"

Variables

View Source
var LastSmsCode = ""

Functions

This section is empty.

Types

type AuthSms

type AuthSms struct {
	auth.AuthHandlerBase
	AuthSmsConfig
	Encryption auth.AuthParameterEncryption
	// contains filtered or unexported fields
}

func New

func New(smsManager sms.SmsManager) *AuthSms

func (*AuthSms) Config

func (a *AuthSms) Config() interface{}

func (*AuthSms) ErrorDescriptions

func (a *AuthSms) ErrorDescriptions() map[string]string

func (*AuthSms) ErrorProtocolCodes

func (a *AuthSms) ErrorProtocolCodes() map[string]int

func (*AuthSms) Handle

func (a *AuthSms) Handle(ctx auth.AuthContext) (bool, error)

func (*AuthSms) Init

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

func (*AuthSms) SetAuthManager

func (a *AuthSms) SetAuthManager(manager auth.AuthManager)

func (*AuthSms) SetSmsManager

func (a *AuthSms) SetSmsManager(smsManager sms.SmsManager)

type AuthSmsConfig

type AuthSmsConfig struct {
	TOKEN_TTL_SECONDS int    `default:"300" validate:"gt=0"`
	SMS_DELAY_SECONDS int    `default:"30" validate:"gt=0"`
	SECRET            string `validate:"required" mask:"true"`
	MAX_TRIES         int    `default:"3" validate:"gt=1"`
	CODE_LENGTH       int    `default:"5" validate:"gte=4"`
	TESTING           bool
}

type SmsCacheToken

type SmsCacheToken struct {
	Try      int    `json:"try"`
	Code     string `json:"code"`
	Checksum string `json:"checksum"`
	SmsId    string `json:"sms_id"`
}

type SmsDelay

type SmsDelay struct {
	common.CreatedAtBase
}

type SmsToken

type SmsToken struct {
	auth.ExpireToken
	common.IDBase
}

type UserWithPhone

type UserWithPhone interface {
	Phone() string
}

Jump to

Keyboard shortcuts

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