Help us shape the future of Go! Take the 2026 Go Developer Survey

docker_registry_auth

module
v0.0.0-...-8763c94 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: Apache-2.0

README

docker_registry_auth

It is a http.Handler to implementing Token Authentication Specification. This intended use-case is you are deploying your own registry:2 and you want to use REGISTRY_AUTH=token

Usage

import (
	"github.com/skygeario/docker_registry_auth/pkg/httphandler"
)

// None of the option fields has default value.
// You must specify every field.
options, err := httphandler.NewOptions(httphandler.Options{
	// It must match REGISTRY_AUTH_TOKEN_ISSUER
	Issuer: "issuer",
	// How long the token is valid after it is issued, in seconds.
	Expiration: 60,
	// Arguments to https://golang.org/pkg/crypto/tls/#LoadX509KeyPair
	// Particularly, CertFile should have the same content as REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE
	CertFile: "/path/my.crt",
	KeyFile: "/path/my.key",
})
// A type implementing "github.com/skygeario/docker_registry_auth/pkg/auth".Auth
// The handler itself delegates authentication and authorization
// to this interface. Authenticate and authorization in any way you want.
myauth := ...
handler := httphandler.NewHandler(options, myauth)
// Mount the handler in any way you want.
// If you mount it at https://auth.example.com/docker
// then REGISTRY_AUTH_TOKEN_REALM=https://auth.example.com/docker

Directories

Path Synopsis
cmd
server command
pkg

Jump to

Keyboard shortcuts

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