authenticator

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

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

func NewAuthService

func NewAuthService(
	logger logger.Logger,
	userService user.CRUD,
	validator validator.Auth,
	tokenizer tokenizer.Tokenizer,
) *AuthService

func (*AuthService) Auth

func (s *AuthService) Auth(reqDTO dto.AuthRequest) (token string, err error)

Auth will check raw credentials and generate a new access token for given user.

func (*AuthService) IsAuthed

func (s *AuthService) IsAuthed(r *http.Request) (userID vo.ID, err error)

IsAuthed with check that token is valid and extract userID from it.

type Authenticator

type Authenticator interface {
	// Auth will check raw credentials and generate a new access token for given user.
	Auth(reqDTO dto.AuthRequest) (token string, err error)
	// IsAuthed with check that token is valid and extract userID from it.
	IsAuthed(r *http.Request) (userID vo.ID, err error)
}

Jump to

Keyboard shortcuts

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