auth

package
v0.0.0-...-34ab1a3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccessTokenNotExist  = errors.New("access token not exist")  // Access токен не существует
	ErrRefreshTokenNotExist = errors.New("refresh token not exist") // Refresh токен не существует
	ErrEmailNotExist        = errors.New("email not exist")         // Почта не существует
	ErrEmailAlreadyExist    = errors.New("email already exist")     // Почта уже используется
	ErrEmailNotVerified     = errors.New("email not verified")      // Почта не верефицирована
	ErrWrongPassword        = errors.New("wrong password")          // Неверный пароль
)

Functions

This section is empty.

Types

type DBUsers

type DBUsers interface {
	Create(ctx context.Context, user *models.User) (primitive.ObjectID, error)
	ReadByEmail(ctx context.Context, email string) (*models.User, error)
	ReadByAccessToken(ctx context.Context, accessToken string) (*models.User, error)
	ReadByRefreshToken(ctx context.Context, refreshToken string) (*models.User, error)
	UpdateTokensByID(ctx context.Context, id primitive.ObjectID, tokens *models.UserTokens) error
	UpdateAccessTokenByID(ctx context.Context, id primitive.ObjectID, accessToken string) error
}

type ErrorDefault

type ErrorDefault struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(dbUsers DBUsers) *Service

func (*Service) Authentication

func (s *Service) Authentication(c *gin.Context)

func (*Service) Identification

func (s *Service) Identification(c *gin.Context)

func (*Service) PasswordSaltByEmail

func (s *Service) PasswordSaltByEmail(c *gin.Context)

func (*Service) Refresh

func (s *Service) Refresh(c *gin.Context)

func (*Service) Registration

func (s *Service) Registration(c *gin.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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