services

package
v0.0.0-...-bf79d3d Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UsernameMaxLength              = 40
	UsernameOptimalGeneratedLength = 20
)
View Source
const TOKEN_ISSUER = "example.com"

Variables

This section is empty.

Functions

func Wire

func Wire()

Types

type AuthService

type AuthService interface {
	Login(ctx context.Context, username, password string) (null.String, null.String, error)
	Logout(ctx context.Context, refreshToken string) error
	RefreshToken(ctx context.Context, refreshToken string) (null.String, null.String, error)
}

type AuthServiceImpl

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

func NewAuthServiceImpl

func NewAuthServiceImpl(usersRepository models.UsersRepository, refreshTokensRepository models.RefreshTokensRepository, tokensService TokensService) *AuthServiceImpl

func (*AuthServiceImpl) Login

func (s *AuthServiceImpl) Login(ctx context.Context, username, password string) (null.String, null.String, error)

func (*AuthServiceImpl) Logout

func (s *AuthServiceImpl) Logout(ctx context.Context, refreshToken string) error

func (*AuthServiceImpl) RefreshToken

func (s *AuthServiceImpl) RefreshToken(ctx context.Context, refreshToken string) (null.String, null.String, error)

type BooksService

type BooksService interface {
	CreateBook(ctx context.Context, title, author string) (*models.Book, error)
	GetBookById(ctx context.Context, id string) (*models.Book, error)
	DeleteBookById(ctx context.Context, id string) error
}

type BooksServiceImpl

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

func NewBooksServiceImpl

func NewBooksServiceImpl(booksRepository models.BooksRepository) *BooksServiceImpl

func (*BooksServiceImpl) CreateBook

func (s *BooksServiceImpl) CreateBook(ctx context.Context, title, author string) (*models.Book, error)

func (*BooksServiceImpl) DeleteBookById

func (s *BooksServiceImpl) DeleteBookById(ctx context.Context, id string) error

func (*BooksServiceImpl) GetBookById

func (s *BooksServiceImpl) GetBookById(ctx context.Context, id string) (*models.Book, error)

type TokenHeader

type TokenHeader struct {
	Alg string `json:"alg"`
	Typ string `json:"typ"`
}

type TokensService

type TokensService interface {
	CreateNewTokens(ctx context.Context, userId uuid.UUID) (null.String, null.String, error)
	CheckToken(ctx context.Context, tokenString string) (uuid.UUID, bool, error)
}

type TokensServiceImpl

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

func NewTokensServiceImpl

func NewTokensServiceImpl(encodedPrivateKey, encodedPublicKey string, tokensRepository models.RefreshTokensRepository, usersRepository models.UsersRepository) *TokensServiceImpl

func (*TokensServiceImpl) CheckToken

func (s *TokensServiceImpl) CheckToken(ctx context.Context, tokenString string) (uuid.UUID, bool, error)

func (*TokensServiceImpl) CreateNewTokens

func (s *TokensServiceImpl) CreateNewTokens(ctx context.Context, userId uuid.UUID) (null.String, null.String, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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