auth

package
v0.0.0-...-92a07c5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthDB

type AuthDB interface {
	InsertToken(token *core.Token) error
	RefreshToken(token *core.Token) error
	GetToken(tokenHash string) (*core.Token, error)
	DeleteToken(token string) error
	ClearTokens(userID int) error
}

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(authDB AuthDB) *Authenticator

func (*Authenticator) AuthenticateToken

func (auth *Authenticator) AuthenticateToken(r *http.Request) (*core.Token, error)

func (*Authenticator) CreateToken

func (auth *Authenticator) CreateToken(userID uuid.UUID, timeToLife time.Duration) (*core.Token, error)

func (*Authenticator) DeleteToken

func (auth *Authenticator) DeleteToken(token string) error

func (*Authenticator) RefreshToken

func (auth *Authenticator) RefreshToken(token *core.Token) error

Jump to

Keyboard shortcuts

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