authn

package
Version: v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrInvalidToken is returned when authenticate is called with invalid token.
	ErrInvalidToken = errors.New("invalid token")
	//ErrNoToken is returned when authenticate is called with no token.
	ErrNoToken = errors.New("no token")
)

Functions

func Localhost

func Localhost(ctx context.Context) bool

Localhost returns true if the localhost flag has been set.

func Token

func Token(ctx context.Context) string

Token returns the token stored in the context, if there is one.

Types

type API

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

API describe the token authenticate.

func NewAPI

func NewAPI(tokens *accesstoken.CredentialStore, disable bool) *API

NewAPI create a token authenticate object.

func (*API) Authenticate

func (a *API) Authenticate(req *http.Request) (*http.Request, error)

Authenticate returns the request, with added tokens and/or localhost flags in the context, as appropriate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL