auth

package
v1.4.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: BSD-3-Clause Imports: 17 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExpiry = errors.New("expiry duration must be a positive number")
View Source
var ErrTokenExpired = errors.New("token expired")

Functions

func PermissionCheckHandler

func PermissionCheckHandler(auth auth) func(h http.Handler) http.Handler

Types

type Authenticator

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

func New

func New(encryptionKey, passwordHash string, logger logging.Logger) (*Authenticator, error)

func (*Authenticator) Authorize

func (a *Authenticator) Authorize(password string) bool

func (*Authenticator) Enforce

func (a *Authenticator) Enforce(apiKey, obj, act string) (bool, error)

func (*Authenticator) GenerateKey

func (a *Authenticator) GenerateKey(role string, expiryDuration int) (string, error)

func (*Authenticator) RefreshKey

func (a *Authenticator) RefreshKey(apiKey string, expiryDuration int) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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