Cleanup and minor fix for digest
This commit is contained in:
parent
6798f193fd
commit
f9b1546367
@ -93,6 +93,7 @@ func main() {
|
||||
http.Handle("/", http.RedirectHandler(pages.ContainersPage, http.StatusTemporaryRedirect))
|
||||
|
||||
var authenticated bool = false
|
||||
|
||||
// Setup the authenticator object
|
||||
if *httpAuthFile!="" {
|
||||
secrets := auth.HtpasswdFileProvider(*httpAuthFile)
|
||||
|
@ -81,42 +81,28 @@ func dockerHandler(containerManager manager.Manager) auth.AuthenticatedHandlerFu
|
||||
}
|
||||
}
|
||||
|
||||
// Register http handlers for pages.
|
||||
// Register http handlers
|
||||
func RegisterHandlersDigest(containerManager manager.Manager,authenticator *auth.DigestAuth) error {
|
||||
|
||||
// Register the handler for the containers page.
|
||||
if authenticator!=nil {
|
||||
http.HandleFunc(ContainersPage, authenticator.Wrap(containerHandler(containerManager)))
|
||||
http.HandleFunc(DockerPage, authenticator.Wrap(dockerHandler(containerManager)))
|
||||
} else {
|
||||
http.HandleFunc(ContainersPage, containerHandlerNoAuth(containerManager))
|
||||
http.HandleFunc(DockerPage, dockerHandlerNoAuth(containerManager))
|
||||
}
|
||||
|
||||
// Register the handler for the docker page.
|
||||
if authenticator!=nil {
|
||||
http.HandleFunc(DockerPage, authenticator.Wrap(dockerHandler(containerManager)))
|
||||
} else {
|
||||
http.HandleFunc(ContainersPage, dockerHandlerNoAuth(containerManager))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func RegisterHandlersBasic(containerManager manager.Manager,authenticator *auth.BasicAuth) error {
|
||||
|
||||
// Register the handler for the containers page.
|
||||
// Register the handler for the containers and docker age.
|
||||
if authenticator!=nil {
|
||||
http.HandleFunc(ContainersPage, authenticator.Wrap(containerHandler(containerManager)))
|
||||
} else {
|
||||
http.HandleFunc(ContainersPage, containerHandlerNoAuth(containerManager))
|
||||
}
|
||||
|
||||
// Register the handler for the docker page.
|
||||
if authenticator!=nil {
|
||||
http.HandleFunc(DockerPage, authenticator.Wrap(dockerHandler(containerManager)))
|
||||
} else {
|
||||
http.HandleFunc(ContainersPage, containerHandlerNoAuth(containerManager))
|
||||
http.HandleFunc(DockerPage, dockerHandlerNoAuth(containerManager))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user