auth

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const UserContextKey contextKey = "user"

Variables

View Source
var ErrInvalidPassword = errors.New("invalid password")
View Source
var ErrUserNotFound = errors.New("user not found")

Functions

func CreatePassword

func CreatePassword(password string) (string, error)

func ParseBearerToken

func ParseBearerToken(token string) (string, error)

func RequireAuthentication

func RequireAuthentication(h http.Handler, auth *Authenticator) http.Handler

Types

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(key []byte, config config.ConfigStore) *Authenticator

func (*Authenticator) CreateJWT

func (a *Authenticator) CreateJWT(user *v1.User) (string, error)

func (*Authenticator) Login

func (a *Authenticator) Login(username, password string) (*v1.User, error)

func (*Authenticator) VerifyJWT

func (a *Authenticator) VerifyJWT(token string) (*v1.User, error)

Jump to

Keyboard shortcuts

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