service

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthLogin

type AuthLogin struct {
	Login    string
	Password string
	DeviceID int
}

type AuthLogout

type AuthLogout struct {
	Token string
}

type AuthRefresh

type AuthRefresh struct {
	Token    string
	DeviceID int
}

type AuthService

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

func NewAuthService

func NewAuthService(
	userRepository repository.IUserRepository,
	tokenRepository repository.ITokenRepository,
	tokenCache cache.ITokenCache,
	userCache cache.IUserCache,
	hasher secret.Hasher,
	accessExpire time.Duration,
	refreshExpire time.Duration,
	accessSecret string,
) AuthService

func (AuthService) Account

func (s AuthService) Account(ctx context.Context) (*model.User, error)

func (AuthService) Login

func (s AuthService) Login(ctx context.Context, input AuthLogin) (*model.AuthToken, error)

func (AuthService) Logout

func (s AuthService) Logout(ctx context.Context, input AuthLogout) error

func (AuthService) Refresh

func (s AuthService) Refresh(ctx context.Context, input AuthRefresh) (*model.AuthToken, error)

func (AuthService) Trx

func (s AuthService) Trx(db *gorm.DB) IAuthService

type IAuthService

type IAuthService interface {
	Trx(db *gorm.DB) IAuthService
	Login(ctx context.Context, input AuthLogin) (*model.AuthToken, error)
	Refresh(ctx context.Context, input AuthRefresh) (*model.AuthToken, error)
	Logout(ctx context.Context, input AuthLogout) error
	Account(ctx context.Context) (*model.User, error)
}

Jump to

Keyboard shortcuts

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