service

package
v0.0.0-...-20a5a9c Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Services

type Services struct {
	Users  *UsersService
	Tokens *TokensService
}

type TokenPair

type TokenPair struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type TokensService

type TokensService struct {
	AccessTokenTTL  time.Duration
	RefreshTokenTTL time.Duration
	// contains filtered or unexported fields
}

func NewTokensService

func NewTokensService(repo repository.TokensRepository, jwtTm jwt.TokenManager, accessTokenTTL, refreshTokenTTL time.Duration) *TokensService

func (*TokensService) InvalidateRefreshToken

func (s *TokensService) InvalidateRefreshToken(ctx context.Context, tokenID uuid.UUID) error

func (*TokensService) InvalidateUser

func (s *TokensService) InvalidateUser(ctx context.Context, userID uuid.UUID) error

func (*TokensService) NewTokenPair

func (s *TokensService) NewTokenPair(userID uuid.UUID) (TokenPair, error)

func (*TokensService) ParseAccessToken

func (s *TokensService) ParseAccessToken(token string) (domain.Token, error)

func (*TokensService) ParseRefreshToken

func (s *TokensService) ParseRefreshToken(token string) (domain.Token, error)

func (*TokensService) SaveRefreshToken

func (s *TokensService) SaveRefreshToken(ctx context.Context, token *domain.Token) error

func (*TokensService) SaveRefreshTokenFromString

func (s *TokensService) SaveRefreshTokenFromString(ctx context.Context, token string) error

func (*TokensService) ValidateAccessToken

func (s *TokensService) ValidateAccessToken(token string) (jwt5.MapClaims, error)

func (*TokensService) ValidateRefreshToken

func (s *TokensService) ValidateRefreshToken(token string) (jwt5.MapClaims, error)

type UsersService

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

func NewUsersService

func NewUsersService(repo repository.UsersRepository, hasher hash.Hasher, validator *validator.CredentialsValidator) *UsersService

func (*UsersService) ComparePasswordAndHash

func (s *UsersService) ComparePasswordAndHash(password, hashed string) bool

func (*UsersService) Delete

func (s *UsersService) Delete(ctx context.Context, id uuid.UUID) error

func (*UsersService) Get

func (s *UsersService) Get(ctx context.Context, id uuid.UUID) (domain.User, error)

func (*UsersService) GetByCredentials

func (s *UsersService) GetByCredentials(ctx context.Context, email, password string) (domain.User, error)

func (*UsersService) Save

func (s *UsersService) Save(ctx context.Context, user *domain.User) error

func (*UsersService) Update

func (s *UsersService) Update(ctx context.Context, user *domain.User) error

func (*UsersService) ValidateEmail

func (s *UsersService) ValidateEmail(email string) error

func (*UsersService) ValidateName

func (s *UsersService) ValidateName(name string) error

func (*UsersService) ValidatePassword

func (s *UsersService) ValidatePassword(password string) error

Jump to

Keyboard shortcuts

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