auth

package
v0.0.0-...-1fe4918 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2014 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "auth"

Variables

This section is empty.

Functions

func CliFlags

func CliFlags() []cli.Flag

CliFlags will be used by Vulcand construct help and CLI command for the vctl command

func FromCli

func FromCli(c *cli.Context) (plugin.Middleware, error)

FromCli constructs the middleware from the command line

func FromOther

func FromOther(c AuthMiddleware) (plugin.Middleware, error)

FromOther Will be called by Vulcand when engine or API will read the middleware from the serialized format. It's important that the signature of the function will be exactly the same, otherwise Vulcand will fail to register this middleware. The first and the only parameter should be the struct itself, no pointers and other variables. Function should return middleware interface and error in case if the parameters are wrong.

func GetSpec

func GetSpec() *plugin.MiddlewareSpec

Types

type AuthHandler

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

Auth middleware handler

func (*AuthHandler) ServeHTTP

func (a *AuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

This function will be called each time the request hits the location with this middleware activated

type AuthMiddleware

type AuthMiddleware struct {
	Password string
	Username string
}

AuthMiiddleware struct holds configuration parameters and is used to serialize/deserialize the configuration from storage engines.

func New

func New(user, pass string) (*AuthMiddleware, error)

This function is optional but handy, used to check input parameters when creating new middlewares

func (*AuthMiddleware) NewHandler

func (c *AuthMiddleware) NewHandler(next http.Handler) (http.Handler, error)

This function is important, it's called by vulcand to create a new handler from the middleware config and put it into the middleware chain. Note that we need to remember 'next' handler to call

func (*AuthMiddleware) String

func (c *AuthMiddleware) String() string

String() will be called by loggers inside Vulcand and command line tool.

Jump to

Keyboard shortcuts

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