yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #00930
[Bug 1133148] Re: Keystone return different-length keys while creating request body manually and when creating request by json.dumps
Sorry, my bad. Wrong formatting of auth_dict (tenantId should not be a
key for the value of passwordCredentials
** Changed in: keystone
Status: New => Invalid
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1133148
Title:
Keystone return different-length keys while creating request body
manually and when creating request by json.dumps
Status in OpenStack Identity (Keystone):
Invalid
Bug description:
The gettoken() function is given at the last. While calling the
function, I just changed params = authstring to params = authstring2
for the two executions given below
root@ubuntu:~# python -i gettoken.py
>>> gettoken()
{"auth": {"passwordCredentials": {"username": "demo", "password": "nova", "tenantId": "44a4a190db80429985528e24ca811a28"}}}
u'MIIKkgYJKoZIhvcNAQcCoIIKgzCCCn8CAQExCTAHBgUrDgMCGjCCCWsGCSqGSIb3DQEHAaCCCVwEgglYeyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxMy0wMi0yNlQwNjo0OToyNC40MTY3NzIiLCAiZXhwaXJlcyI6ICIyMDEzLTAyLTI3VDA2OjQ5OjI0WiIsICJpZCI6ICJwbGFjZWhvbGRlciIsICJ0ZW5hbnQiOiB7ImVuYWJsZWQiOiB0cnVlLCAiZGVzY3JpcHRpb24iOiBudWxsLCAibmFtZSI6ICJkZW1vIiwgImlkIjogIjQ0YTRhMTkwZGI4MDQyOTk4NTUyOGUyNGNhODExYTI4In19LCAic2VydmljZUNhdGFsb2ciOiBbeyJlbmRwb2ludHMiOiBbeyJhZG1pblVSTCI6ICJodHRwOi8vMTAuNjMuMTY1LjIyOjg3NzQvdjIvNDRhNGExOTBkYjgwNDI5OTg1NTI4ZTI0Y2E4MTFhMjgiLCAicmVnaW9uIjogIlJlZ2lvbk9uZSIsICJpbnRlcm5hbFVSTCI6ICJodHRwOi8vMTAuNjMuMTY1LjIyOjg3NzQvdjIvNDRhNG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wMDAvdjIuMCJ9XSwgImVuZHBvaW50c19saW5rcyI6IFtdLCAidHlwZSI6ICJpZGVudGl0eSIsICJuYW1lIjogImtleXN0b25lIn1dLCAidXNlciI6IHsidXNlcm5hbWUiOiAiZGVtbyIsICJyb2xlc19saW5rcyI6IFtdLCAiaWQiOiAiNzg3YzRlZDRlNmQ0NDhhZTkyYmE1MGM4MTI5YjVhMTYiLCAicm9sZXMiOiBbeyJuYW1lIjogImFub3RoZXJyb2xlIn0sIHsibmFtZSI6ICJNZW1iZXIifV0sICJuYW1lIjogImRlbW8ifSwgIm1ldGFkYXRhIjogeyJpc19hZG1pbiI6IDAsICJyb2xlcyI6IFsiZWVmYWYwNDcxNDhjNDA0OGJhYWY3OTRmYzBmYTUxN2MiLCAiMTEzZWY4YzY5YjZiNGMxYzliMDUzZWZkY2U0ZThhMzUiXX19fTGB-zCB-AIBATBcMFcxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIEwVVbnNldDEOMAwGA1UEBxMFVW5zZXQxDjAMBgNVBAoTBVVuc2V0MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20CAQEwBwYFKw4DAhowDQYJKoZIhvcNAQEBBQAEgYBjOvtn8VK77k-JFVBxvv-7mYeDw+Zx3BO8pMZ3SoZ-93t7RqO9I5gJ8oyE8pRRzzncJ2+NikRbehjbUcpwS9Fx4hooZz-QBrQHYkJBNaVLPX2WrD6-GpRiVNZQXaK1ai6Jf4zREuFcMR7cJHWrdj4icZqMHd0N+52lJgjZkHorEQ=='
>>>
root@ubuntu:~# python -i gettoken.py
>>> gettoken()
{"auth": {"passwordCredentials": {"username": "demo", "password": "nova", "tenantId": "44a4a190db80429985528e24ca811a28"}}}
u'MIICbAYJKoZIhvcNAQcCoIICXTCCAlkCAQExCTAHBgUrDgMCGjCCAUUGCSqGSIb3DQEHAaCCATYEggEyeyJhY2Nlc3MiOiB7InRva2VuIjogeyJpc3N1ZWRfYXQiOiAiMjAxMy0wMi0yNlQwNjo0OTo1Mi41Njk0MDQiLCAiZXhwaXJlcyI6ICIyMDEzLTAyLTI3VDA2OjQ5OjUyWiIsICJpZCI6ICJwbGFjZWhvbGRlciJ9LCAic2VydmljZUNhdGFsb2ciOiBbXSwgInVzZXIiOiB7InVzZXJuYW1lIjogImRlbW8iLCAicm9sZXNfbGlua3MiOiBbXSwgImlkIjogIjc4N2M0ZWQ0ZTZkNDQ4YWU5MmJhNTBjODEyOWI1YTE2IiwgInJvbGVzIjogW10sICJuYW1lIjogImRlbW8ifSwgIm1ldGFkYXRhIjogeyJpc19hZG1pbiI6IDAsICJyb2xlcyI6IFtdfX19MYH-MIH8AgEBMFwwVzELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBVVuc2V0MQ4wDAYDVQQHEwVVbnNldDEOMAwGA1UEChMFVW5zZXQxGDAWBgNVBAMTD3d3dy5leGFtcGxlLmNvbQIBATAHBgUrDgMCGjANBgkqhkiG9w0BAQEFAASBgNgU3DzesRo8gaFJgM+wsfR3XxgmHc5C9rP1Idnoyk-nzXfztLzMUOqPm5k4LquhZtpOttOmKUqABiio1e9EZjSJi1q4OjFck0gKWf12KMY40CCXbxCOyKiajM0PPzA3fxxjp4Ov9jYPBxtH41WjDn7w2OyipArTR2DQ72YVkkE6'
>>>
The gettoken function is here
def gettoken():
url = "x.x.x.x:5000"
osuser = "demo"
ospassword = "nova"
tenant_id = "44a4a190db80429985528e24ca811a28"
auth_string2 = ('{"auth":{"passwordCredentials":{"username": "%(osuser)s", '
'"password":"%(ospassword)s"}, "tenantId":"%(tenant_id)s"}}')
auth_dict = {"auth":
{"passwordCredentials":
{
"username": osuser,
"password": ospassword,
"tenantId": tenant_id
}
}
}
auth_string = json.dumps(auth_dict)
print auth_string
params = auth_string % locals()
headers = {"Content-Type": "application/json"}
conn = httplib.HTTPConnection(url)
conn.request("POST", "/v2.0/tokens", params, headers)
# HTTP response
response = conn.getresponse()
data = response.read()
datadict = json.loads(data)
conn.close()
# print '\ndatadict:', datadict
token = datadict['access']['token']['id']
return token
To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1133148/+subscriptions