auth

package
v0.0.0-...-58e3b6f Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenExpired = time.Hour * 24
	SecretKey    = "bu7HBJD&873HVHJdh*Jbhsfdfs8622Dsf"
)

Variables

View Source
var ErrAlreadyRegistered error = errors.New("customer already registered")
View Source
var ErrInvalidAuthorization = errors.New("отсутствует UID сессии пользователя")
View Source
var ErrInvalidScenarioRegistered error = errors.New("customer already registered")
View Source
var ErrNeedAuthorization = errors.New("требуется авторизация")

Functions

This section is empty.

Types

type Auth

type Auth struct {
	TokenExpired time.Duration
	SecretKey    string
	Logger       *alog.Alog
	Storage      models.Storable
	Cache        models.Cachable
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(sk string, store models.Storable, cache models.Cachable) *Auth

func (Auth) IdentityByCookie

func (a Auth) IdentityByCookie(cookie *http.Cookie) (string, error)

func (Auth) Init

func (a Auth) Init() error

func (Auth) Login

func (a Auth) Login(ctx context.Context, r *models.RequestLogin)

func (*Auth) NotifyRegistered

func (a *Auth) NotifyRegistered(
	ctx context.Context,
	customer *customer.Customer,
	scenario *models.RequestRegister,
) error

NotifyRegistered отправка уведомления о регистрации, в зависимости от сценария регистрации будут использованы разные методы отправки

func (Auth) Register

func (a Auth) Register(ctx context.Context, rm *models.RequestRegister) (*customer.Customer, error)

type Claims

type Claims struct {
	jwt.RegisteredClaims
	SessionUID string
}

Jump to

Keyboard shortcuts

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