authentication

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRequest    = errors.New("invalid_request")
	ErrInvalidToken      = errors.New("invalid_token")
	ErrInsufficientScope = errors.New("insufficient_scope")
	ErrNoAuthToken       = errors.New("no_auth")
)

Exported Errors

Functions

This section is empty.

Types

type Middleware

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

Middleware enforces authentication on protected routes.

func NewMiddleware

func NewMiddleware(root string, config *Options) (*Middleware, error)

NewMiddleware returns a middlware suitable for authentication.

func (*Middleware) LoginHandler

func (m *Middleware) LoginHandler() http.Handler

LoginHandler returns a router that handles the login and logout routes.

func (*Middleware) ServeHTTP

func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, n http.HandlerFunc)

type Options

type Options struct {
	Realm       string
	Seeder      common.Seeder
	PublicRoots []string
	OAuth       *oauth.Handler
	Insecure    bool
}

Options provides configuration options to the AuthenticationMiddleware.

Jump to

Keyboard shortcuts

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