auth

package
v0.0.0-...-aa03a8f Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: Apache-2.0, BSD-3-Clause, CC-BY-3.0, + 3 more Imports: 15 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 Authorizer

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

Authorizer authorizes requests according to the schema

func NewStandardTokenAuthorizer

func NewStandardTokenAuthorizer(credential Credential, insecure bool, scopeType, scopeName string, scopeActions ...string) Authorizer

NewStandardTokenAuthorizer returns a standard token authorizer. The authorizer will request a token from token server and add it to the origin request

func NewUsernameTokenAuthorizer

func NewUsernameTokenAuthorizer(username string, scopeType, scopeName string, scopeActions ...string) Authorizer

NewUsernameTokenAuthorizer returns a authorizer which will generate a token according to the user's privileges

type AuthorizerStore

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

AuthorizerStore holds a authorizer list, which will authorize request. And it implements interface Modifier

func NewAuthorizerStore

func NewAuthorizerStore(endpoint string, insecure bool, authorizers ...Authorizer) (*AuthorizerStore, error)

NewAuthorizerStore ...

func (*AuthorizerStore) Modify

func (a *AuthorizerStore) Modify(req *http.Request) error

Modify adds authorization to the request

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 ...

func NewCookieCredential

func NewCookieCredential(c *http.Cookie) Credential

NewCookieCredential initialize a cookie based crendential handler, the cookie in parameter will be added to request to registry if this crendential is attached to a registry client.

Jump to

Keyboard shortcuts

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