auth

package
v0.0.0-...-c295410 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2016 License: Apache-2.0, BSD-3-Clause, CC-BY-3.0, + 3 more Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseChallengeFromResponse

func ParseChallengeFromResponse(resp *http.Response) []au.Challenge

ParseChallengeFromResponse ...

Types

type Credential

type Credential interface {
	// AddAuthorization adds authorization information to request
	AddAuthorization(req *http.Request)
}

Credential ...

func NewBasicAuthCredential

func NewBasicAuthCredential(username, password string) Credential

NewBasicAuthCredential ...

type Handler

type Handler interface {
	// Schema : basic, bearer
	Schema() string
	//AuthorizeRequest adds basic auth or token auth to the header of request
	AuthorizeRequest(req *http.Request, params map[string]string) error
}

Handler authorizes the request when encounters a 401 error

func NewStandardTokenHandler

func NewStandardTokenHandler(credential Credential) Handler

NewStandardTokenHandler returns a standard token handler. The handler will request a token from token server whose URL is specified in the "WWW-authentication" header and add it to the origin request TODO deal with https

func NewUsernameTokenHandler

func NewUsernameTokenHandler(username string) Handler

NewUsernameTokenHandler returns a handler which will generate a token according the user's privileges

Jump to

Keyboard shortcuts

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