auth

package
v0.0.0-...-0b5d736 Latest Latest
Warning

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

Go to latest
Published: May 19, 2016 License: Apache-2.0, BSD-3-Clause, CC-BY-3.0, + 3 more Imports: 12 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 {
	// Scheme : basic, bearer
	Scheme() string
	//AuthorizeRequest adds basic auth or token auth to the header of request
	AuthorizeRequest(req *http.Request, params map[string]string) error
}

Handler authorizes requests according to the schema

func NewStandardTokenHandler

func NewStandardTokenHandler(credential Credential, scopeType, scopeName string, scopeActions ...string) Handler

NewStandardTokenHandler returns a standard token handler. The handler will request a token from token server and add it to the origin request TODO deal with https

func NewUsernameTokenHandler

func NewUsernameTokenHandler(username string, scopeType, scopeName string, scopeActions ...string) Handler

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

type RequestAuthorizer

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

RequestAuthorizer holds a handler list, which will authorize request. Implements interface RequestModifier

func NewRequestAuthorizer

func NewRequestAuthorizer(handlers []Handler, challenges []au.Challenge) *RequestAuthorizer

NewRequestAuthorizer ...

func (*RequestAuthorizer) ModifyRequest

func (r *RequestAuthorizer) ModifyRequest(req *http.Request) error

ModifyRequest adds authorization to the request

Jump to

Keyboard shortcuts

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