authn

package
v1.0.5-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: AGPL-3.0 Imports: 9 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.

func X509Certs

func X509Certs(ctx context.Context) []*x509.Certificate

X509Certs returns the cert stored in the context, if it exists.

Types

type API

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

API describe the token authenticate.

func NewAPI

func NewAPI(tokens *accesstoken.CredentialStore) *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
y or Y : Canonical URL