remove user_id as you shouldn't auth using it
This commit is contained in:
@@ -38,12 +38,10 @@ class HTTPClient(httplib2.Http):
|
|||||||
|
|
||||||
USER_AGENT = 'python-keystoneclient'
|
USER_AGENT = 'python-keystoneclient'
|
||||||
|
|
||||||
def __init__(self, user_name=None, user_id=None,
|
def __init__(self, user_name=None, tenant_id=None, tenant_name=None,
|
||||||
tenant_id=None, tenant_name=None, password=None,
|
password=None, project_id=None, auth_url=None,
|
||||||
project_id=None, auth_url=None, region_name=None,
|
region_name=None, timeout=None, endpoint=None, token=None):
|
||||||
timeout=None, endpoint=None, token=None):
|
|
||||||
super(HTTPClient, self).__init__(timeout=timeout)
|
super(HTTPClient, self).__init__(timeout=timeout)
|
||||||
self.user_id = user_id
|
|
||||||
self.user_name = user_name
|
self.user_name = user_name
|
||||||
self.tenant_id = tenant_id
|
self.tenant_id = tenant_id
|
||||||
self.tenant_name = tenant_name
|
self.tenant_name = tenant_name
|
||||||
|
@@ -59,10 +59,6 @@ class OpenStackIdentityShell(object):
|
|||||||
default=env('OS_USER_NAME'),
|
default=env('OS_USER_NAME'),
|
||||||
help='Defaults to env[OS_USER_NAME].')
|
help='Defaults to env[OS_USER_NAME].')
|
||||||
|
|
||||||
parser.add_argument('--user_id',
|
|
||||||
default=env('OS_USER_ID'),
|
|
||||||
help='Defaults to env[OS_USER_ID].')
|
|
||||||
|
|
||||||
parser.add_argument('--password',
|
parser.add_argument('--password',
|
||||||
default=env('OS_PASSWORD'),
|
default=env('OS_PASSWORD'),
|
||||||
help='Defaults to env[OS_PASSWORD].')
|
help='Defaults to env[OS_PASSWORD].')
|
||||||
@@ -155,10 +151,9 @@ class OpenStackIdentityShell(object):
|
|||||||
#FIXME(usrleon): Here should be restrict for project id same as
|
#FIXME(usrleon): Here should be restrict for project id same as
|
||||||
# for username or apikey but for compatibility it is not.
|
# for username or apikey but for compatibility it is not.
|
||||||
|
|
||||||
if not args.user_id and not args.user_name:
|
if not args.user_name:
|
||||||
raise exc.CommandError("You must provide a user name or id:"
|
raise exc.CommandError("You must provide a user name:"
|
||||||
"via --user_name or env[OS_USER_NAME]"
|
"via --user_name or env[OS_USER_NAME]")
|
||||||
"via --user_id or env[OS_USER_ID])")
|
|
||||||
if not args.password:
|
if not args.password:
|
||||||
raise exc.CommandError("You must provide a password, either"
|
raise exc.CommandError("You must provide a password, either"
|
||||||
"via --password or env[OS_PASSWORD]")
|
"via --password or env[OS_PASSWORD]")
|
||||||
@@ -169,7 +164,6 @@ class OpenStackIdentityShell(object):
|
|||||||
"env[OS_AUTH_URL")
|
"env[OS_AUTH_URL")
|
||||||
|
|
||||||
self.cs = self.get_api_class(options.version)(user_name=args.user_name,
|
self.cs = self.get_api_class(options.version)(user_name=args.user_name,
|
||||||
user_id=args.user_id,
|
|
||||||
tenant_name=args.tenant_name,
|
tenant_name=args.tenant_name,
|
||||||
tenant_id=args.tenant_id,
|
tenant_id=args.tenant_id,
|
||||||
password=args.password,
|
password=args.password,
|
||||||
|
@@ -87,7 +87,6 @@ class Client(client.HTTPClient):
|
|||||||
self.management_url = self.auth_url
|
self.management_url = self.auth_url
|
||||||
# try:
|
# try:
|
||||||
raw_token = self.tokens.authenticate(user_name=self.user_name,
|
raw_token = self.tokens.authenticate(user_name=self.user_name,
|
||||||
user_id=self.user_id,
|
|
||||||
tenant_id=self.tenant_id,
|
tenant_id=self.tenant_id,
|
||||||
tenant_name=self.tenant_name,
|
tenant_name=self.tenant_name,
|
||||||
password=self.password,
|
password=self.password,
|
||||||
|
@@ -21,16 +21,13 @@ class Token(base.Resource):
|
|||||||
class TokenManager(base.ManagerWithFind):
|
class TokenManager(base.ManagerWithFind):
|
||||||
resource_class = Token
|
resource_class = Token
|
||||||
|
|
||||||
def authenticate(self, user_name=None, user_id=None, tenant_id=None,
|
def authenticate(self, user_name=None, tenant_id=None, tenant_name=None,
|
||||||
tenant_name=None, password=None, token=None, return_raw=False):
|
password=None, token=None, return_raw=False):
|
||||||
if token and token != password:
|
if token and token != password:
|
||||||
params = {"auth": {"token": {"id": token}}}
|
params = {"auth": {"token": {"id": token}}}
|
||||||
elif user_name and password:
|
elif user_name and password:
|
||||||
params = {"auth": {"passwordCredentials": {"username": user_name,
|
params = {"auth": {"passwordCredentials": {"username": user_name,
|
||||||
"password": password}}}
|
"password": password}}}
|
||||||
elif user_id and password:
|
|
||||||
params = {"auth": {"passwordCredentials": {"userId": user_id,
|
|
||||||
"password": password}}}
|
|
||||||
else:
|
else:
|
||||||
raise ValueError('A username and password or token is required.')
|
raise ValueError('A username and password or token is required.')
|
||||||
if tenant_id:
|
if tenant_id:
|
||||||
|
Reference in New Issue
Block a user