func useDigestAuthOrNot(digestAuth auth.DigestAuth, handler http.HandlerFunc) http.HandlerFunc {
	if settings.DigestPath == "" {
		return handler
	} else {
		return digestAuth.JustCheck(handler)
	}
}
Exemple #2
0
// Register http handlers
func RegisterHandlersDigest(mux httpmux.Mux, containerManager manager.Manager, authenticator *auth.DigestAuth) error {
	// Register the handler for the containers page.
	if authenticator != nil {
		mux.HandleFunc(ContainersPage, authenticator.Wrap(containerHandler(containerManager)))
		mux.HandleFunc(DockerPage, authenticator.Wrap(dockerHandler(containerManager)))
	} else {
		mux.HandleFunc(ContainersPage, containerHandlerNoAuth(containerManager))
		mux.HandleFunc(DockerPage, dockerHandlerNoAuth(containerManager))
	}
	return nil
}