forked from TrueCloudLab/distribution
Rename the basic access controller to htpasswd
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
ffd3662982
commit
0f654c25ac
5 changed files with 9 additions and 9 deletions
|
@ -18,7 +18,7 @@ import (
|
||||||
"github.com/docker/distribution/configuration"
|
"github.com/docker/distribution/configuration"
|
||||||
"github.com/docker/distribution/context"
|
"github.com/docker/distribution/context"
|
||||||
_ "github.com/docker/distribution/health"
|
_ "github.com/docker/distribution/health"
|
||||||
_ "github.com/docker/distribution/registry/auth/basic"
|
_ "github.com/docker/distribution/registry/auth/htpasswd"
|
||||||
_ "github.com/docker/distribution/registry/auth/silly"
|
_ "github.com/docker/distribution/registry/auth/silly"
|
||||||
_ "github.com/docker/distribution/registry/auth/token"
|
_ "github.com/docker/distribution/registry/auth/token"
|
||||||
"github.com/docker/distribution/registry/handlers"
|
"github.com/docker/distribution/registry/handlers"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
// Package basic provides a simple authentication scheme that checks for the
|
// Package htpasswd provides a simple authentication scheme that checks for the
|
||||||
// user credential hash in an htpasswd formatted file in a configuration-determined
|
// user credential hash in an htpasswd formatted file in a configuration-determined
|
||||||
// location.
|
// location.
|
||||||
//
|
//
|
||||||
// This authentication method MUST be used under TLS, as simple token-replay attack is possible.
|
// This authentication method MUST be used under TLS, as simple token-replay attack is possible.
|
||||||
package basic
|
package htpasswd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -34,12 +34,12 @@ var _ auth.AccessController = &accessController{}
|
||||||
func newAccessController(options map[string]interface{}) (auth.AccessController, error) {
|
func newAccessController(options map[string]interface{}) (auth.AccessController, error) {
|
||||||
realm, present := options["realm"]
|
realm, present := options["realm"]
|
||||||
if _, ok := realm.(string); !present || !ok {
|
if _, ok := realm.(string); !present || !ok {
|
||||||
return nil, fmt.Errorf(`"realm" must be set for basic access controller`)
|
return nil, fmt.Errorf(`"realm" must be set for htpasswd access controller`)
|
||||||
}
|
}
|
||||||
|
|
||||||
path, present := options["path"]
|
path, present := options["path"]
|
||||||
if _, ok := path.(string); !present || !ok {
|
if _, ok := path.(string); !present || !ok {
|
||||||
return nil, fmt.Errorf(`"path" must be set for basic access controller`)
|
return nil, fmt.Errorf(`"path" must be set for htpasswd access controller`)
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.Open(path.(string))
|
f, err := os.Open(path.(string))
|
||||||
|
@ -98,5 +98,5 @@ func (ch *challenge) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
auth.Register("basic", auth.InitFunc(newAccessController))
|
auth.Register("htpasswd", auth.InitFunc(newAccessController))
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package basic
|
package htpasswd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
|
@ -1,4 +1,4 @@
|
||||||
package basic
|
package htpasswd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
|
@ -1,4 +1,4 @@
|
||||||
package basic
|
package htpasswd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
Loading…
Reference in a new issue