authenticater

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2015 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 4

README

What

Authenticator interface for Go HTTP apps.

Usage

See godoc or examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapAuth

func WrapAuth(auth Authenticater, handle http.HandlerFunc) http.HandlerFunc

WrapAuth returns a http.Handlerfunc that runs the passed Handlerfunc if and only if the Authenticator can authenticate the request

Types

type AnyOrNoAuth

type AnyOrNoAuth struct{}

AnyOrNoAuth just returns true for any call to Authenticate

func (AnyOrNoAuth) Authenticate

func (fa AnyOrNoAuth) Authenticate(r *http.Request) bool

Authenticate all requests

type Authenticater

type Authenticater interface {
	Authenticate(r *http.Request) bool
}

Authenticater provides an interface for authentication of a http.Request

type BasicAuth

type BasicAuth struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

BasicAuth handles normal user/password Basic Auth requests, multiple password for the same user and is safe for concurrent use.

func NewBasicAuth

func NewBasicAuth() *BasicAuth

NewBasicAuth returns an empty BasicAuth Authenticator

func NewBasicAuthFromString

func NewBasicAuthFromString(creds string) (*BasicAuth, error)

NewBasicAuthFromString creates and populates a BasicAuth from the provided credentials, encoded as a string, in the following format: user:password|user:password|...

func (*BasicAuth) AddPrincipal

func (ba *BasicAuth) AddPrincipal(user, pass string)

AddPrincipal add's a user/password combo to the list of valid combinations

func (*BasicAuth) Authenticate

func (ba *BasicAuth) Authenticate(r *http.Request) bool

Authenticate is true if the Request has a valid BasicAuth signature and that signature encodes a known username/password combo.

type LogplexDrainToken

type LogplexDrainToken struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LogplexDrainToken ensures that the Logplex-Drain-Token header contains a known token and is safe for concurrent use

func NewLogplexDrainToken

func NewLogplexDrainToken() *LogplexDrainToken

NewLogplexDrainToken creates and returns a new LogplexDrainTokens

func NewLogplexDrainTokenFromString

func NewLogplexDrainTokenFromString(tokens string) *LogplexDrainToken

NewLogplexDrainTokenFromString creates and returns a new LogplexDrainTokens instance from the provided string containing tokens in the folloing format: token1,token2,token3,...

func (*LogplexDrainToken) AddToken

func (ldt *LogplexDrainToken) AddToken(token string)

AddToken adds a token to the list of acceptable tokens.

func (*LogplexDrainToken) Authenticate

func (ldt *LogplexDrainToken) Authenticate(r *http.Request) (exists bool)

Authenticate the request if the Logplex-Drain-Token header contains a known token

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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