Revert "Enable POST method support for token fetch"

This reverts commit d2fcf67ded6d27b4ce6257bbd8b431720ba0120d.

Reverting due to https://bugs.launchpad.net/starlingx/+bug/1859686

Change-Id: If30034c4011162361c469072bd08c8e3b4975c33
This commit is contained in:
Don Penney 2020-01-14 20:38:34 +00:00
parent d2fcf67ded
commit fac9fa17ac
2 changed files with 12 additions and 30 deletions

View File

@ -73,25 +73,6 @@ func (ac *accessController) Authorized(ctx context.Context, accessRecords ...aut
return auth.WithUser(ctx, auth.UserInfo{Name: username}), nil return auth.WithUser(ctx, auth.UserInfo{Name: username}), nil
} }
// AuthenticateUser checks a given user:password credential by keystone.
// If the check passes, nil is returned.
func (ac *accessController) AuthenticateUser(username string, password string) error {
opts := gophercloud.AuthOptions{
IdentityEndpoint: ac.endpoint,
Username: username,
Password: password,
DomainID: "default",
}
if _, err := openstack.AuthenticatedClient(opts); err != nil {
context.GetLogger(context.Background()).Errorf("error authenticating user %q: %v", username, err)
return auth.ErrAuthenticationFailure
}
return nil
}
// challenge implements the auth.Challenge interface. // challenge implements the auth.Challenge interface.
type challenge struct { type challenge struct {
realm string realm string
@ -112,3 +93,4 @@ func (ch challenge) Error() string {
func init() { func init() {
auth.Register("keystone", auth.InitFunc(newAccessController)) auth.Register("keystone", auth.InitFunc(newAccessController))
} }

View File

@ -20,9 +20,9 @@ import (
"github.com/docker/distribution/context" "github.com/docker/distribution/context"
"github.com/docker/distribution/registry/api/errcode" "github.com/docker/distribution/registry/api/errcode"
"github.com/docker/distribution/registry/auth" "github.com/docker/distribution/registry/auth"
_ "registry-token-server/keystone"
"github.com/docker/libtrust" "github.com/docker/libtrust"
"github.com/gorilla/mux" "github.com/gorilla/mux"
_ "registry-token-server/keystone"
) )
var ( var (