token

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBearerTokenExtract = errors.New("bearer token extract error")

	TokenExpirationTime = 60
)
View Source
var (
	ErrInvalidUsernameOrPassword = errors.New("invalid username or password")
	ErrGeneratingToken           = errors.New("error generating token")
)

Functions

func ExtractToken

func ExtractToken(headerValue string) (string, error)

func GeneratePrivateKey

func GeneratePrivateKey() *rsa.PrivateKey

func GenerateSigner

func GenerateSigner(key *rsa.PrivateKey) jwt.Signer

func GenerateVerifier

func GenerateVerifier(key *rsa.PrivateKey) jwt.Verifier

Types

type GenerateJwtToken

type GenerateJwtToken interface {
	Execute(user *entity.User, authorities []string) (string, error)
}

func NewGenerateJwtToken

func NewGenerateJwtToken(key *rsa.PrivateKey) GenerateJwtToken

type GenerateToken

type GenerateToken interface {
	Execute(ctx context.Context, username string, password string) (*entity.Token, error)
}

func NewGenerateToken

func NewGenerateToken(repoFactory factory.RepositoryFactory, jwtToken GenerateJwtToken) GenerateToken

type ValidateToken

type ValidateToken interface {
	Execute(token string) error
}

func NewValidateToken

func NewValidateToken(key *rsa.PrivateKey) ValidateToken

Jump to

Keyboard shortcuts

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