auth

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToRequest

func AddToRequest(t auth.Scope, req *http.Request)

AddToRequest adds a token as a Bearer Authorization of a request

func ChallengeHeader

func ChallengeHeader(
	ref reference.Named,
	repoInfo dregistry.RepositoryInfo,
	endpoint dregistry.APIEndpoint,
	creds Credentials,
) (auth string, err error)

ChallengeHeader requests the challenge header from the auth server

Types

type Authenticator

type Authenticator interface {
	Authenticate(c *Challenge) (Token, error)
}

Authenticator produces a Bearer token to authenticate with the HTTP API

func NewAuthenticator

func NewAuthenticator(client *http.Client, credentials Credentials) Authenticator

NewAuthenticator creates a new Authenticator

type Challenge

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

Challenge from a auth server

func ParseChallengeHeader

func ParseChallengeHeader(header string) (ch *Challenge, err error)

ParseChallengeHeader parses the challenge header and extract the relevant parts

type Credentials

type Credentials interface {
	SetAuth(r *http.Request) *http.Request
}

Credentials represents a username password pair

func NewCreds

func NewCreds(username, password string) Credentials

NewCreds creates a struct that satisfies Credentials from a username and password (typically entered at the command like)

func NewDefaultCreds

func NewDefaultCreds(repoInfo *dregistry.RepositoryInfo) (Credentials, error)

NewDefaultCreds create a credentials struct from the credentials in the default conf file, typically ~/.docker/config.json. the struct is lazy, i.e. the file is only read if the username or password is accessed

type Token

type Token interface {
	String() string
	Fresh() bool
}

Token is the Bearer token to be used with API calls

func NewTokenFromResp

func NewTokenFromResp(respBody io.Reader) (t Token, err error)

NewTokenFromResp creates a new token from a http response

Jump to

Keyboard shortcuts

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