Documentation
¶
Index ¶
- Constants
- Variables
- func Authenticate(opts *ProxyOpts, res http.ResponseWriter, req *http.Request)
- func GetFullRepositoryFromPath(path string, base string) string
- func GetImageFromPath(path string) string
- func GetPathWithBase(path, base string) string
- func GetRepositoryFromPath(path string) string
- func GetRepositoryFromScope(scope string) string
- func GetScope(req *http.Request, upstreamPath string) string
- func MakeBasicAuth(username string, password string) string
- func NewProxy(req *http.Request, opts *ProxyOpts) (*httputil.ReverseProxy, error)
- func NewRedirectFollower(wrappedRoundTripper http.RoundTripper) http.RoundTripper
- func ProxyHandler(opts *ProxyOpts) func(http.ResponseWriter, *http.Request)
- func RegistryAuthResolveGRPC(client dockerregistryproxyv1.AuthenticationProviderAPIClient) (authn.Authenticator, error)
- func UnauthenticatedResponse(res http.ResponseWriter, req *http.Request, upstreamPath string)
- type Claims
- type ProxyOpts
- type RedirectFollower
Constants ¶
const (
CtxPath ctxKey = 0
)
context keys
Variables ¶
var (
ErrUpstreamCouldNotParseHost = errors.New("could not parse upstream host")
)
These are the errors returned by this file of the pkg
Functions ¶
func Authenticate ¶
func Authenticate(opts *ProxyOpts, res http.ResponseWriter, req *http.Request)
Authenticate handles authentication
func GetFullRepositoryFromPath ¶
GetFullRepositoryFromPath returns the upstream Docker registry repository
func GetImageFromPath ¶
GetImageFromPath returns the Docker image
func GetPathWithBase ¶
GetPathWithBase returns the path to send to the upstream registry
func GetRepositoryFromPath ¶
GetRepositoryFromPath returns the Docker registry repository
func GetRepositoryFromScope ¶
GetRepositoryFromScope returns the repository from a scope
func MakeBasicAuth ¶
MakeBasicAuth returns a basic auth string from a ProvideResponse
func NewProxy ¶
NewProxy returns a httputil.ReverseProxy for a request. This proxy should be used for subsequent requests of the same session.
func NewRedirectFollower ¶
func NewRedirectFollower(wrappedRoundTripper http.RoundTripper) http.RoundTripper
NewRedirectFollower wraps another http.RoundTripper following redirect response codes
func ProxyHandler ¶
func ProxyHandler(opts *ProxyOpts) func(http.ResponseWriter, *http.Request)
ProxyHandler returns a http.HandlerFunc
func RegistryAuthResolveGRPC ¶
func RegistryAuthResolveGRPC(client dockerregistryproxyv1.AuthenticationProviderAPIClient) (authn.Authenticator, error)
RegistryAuthResolveGRPC resolves the registry authentication from via GRPC
func UnauthenticatedResponse ¶
func UnauthenticatedResponse(res http.ResponseWriter, req *http.Request, upstreamPath string)
UnauthenticatedResponse writes the unauthenticated response
Types ¶
type Claims ¶
type Claims struct { jwt.StandardClaims DockerRepository string `json:"dockerRepository"` }
Claims represents the claims for the generated token
func GetAuthentication ¶
GetAuthentication returns the authentication for a request
type ProxyOpts ¶
type ProxyOpts struct { Upstream *url.URL Registry name.Registry Auth authn.Authenticator Transport http.RoundTripper AuthVerifiers map[string]dockerregistryproxyv1.AuthenticationVerifierAPIClient TokenHMAC []byte }
ProxyOpts represents the options available for the ProxyHandler
func GetProxyOpts ¶
func GetProxyOpts( upstreamAddr string, upstreamAuthClient dockerregistryproxyv1.AuthenticationProviderAPIClient, authVerifiers map[string]dockerregistryproxyv1.AuthenticationVerifierAPIClient, ) (*ProxyOpts, error)
GetProxyOpts validates and returns the given proxy handler options
type RedirectFollower ¶
type RedirectFollower struct {
http.RoundTripper
}
RedirectFollower represents a Transport RoundTripper that follows redirects