Need clarification on V3 Password Authentication using XML Interface

Asked by Harika Vakadi on 2013-05-10

While trying to generate an auth token using V3 Keystone API, I was able to do using JSON Interface, but I am unable do the same request using XMl Interface.

Example using JSON Interface:

curl -i http://IP:35357/v3/auth/tokens -X POST -H "User-Agent: python-keystoneclient" -H "Content-Type: application/json" -H "X-Auth-Token: <token>" -d'{"auth": {"identity": {"methods": ["password"],"password": {"user": {"id": "475ebc2782434f479d413d1792cbf8c1","password": "v3-token"}}}}}'

HTTP/1.1 201 Created
X-Subject-Token: MIICPQYJKoZIhvcNAQcCoIICLjCCAioCAQExCTAHBgUrDgMCGjCCARYGCSqGSIb3DQEHAaCCAQcEggEDeyJ0b2tlbiI6IHsiaXNzdWVkX2F0IjogIjIwMTMtMDUtMTBUMTU6MDY6NTguOTY3NTU2WiIsICJleHRyYXMiOiB7fSwgIm1ldGhvZHMiOiBbInBhc3N3b3JkIl0sICJleHBpcmVzX2F0IjogIjIwMTMtMDUtMTFUMTU6MDY6NTguOTY3NTAwWiIsICJ1c2VyIjogeyJkb21haW4iOiB7ImlkIjogImRlZmF1bHQiLCAibmFtZSI6ICJEZWZhdWx0In0sICJpZCI6ICI0NzVlYmMyNzgyNDM0ZjQ3OWQ0MTNkMTc5MmNiZjhjMSIsICJuYW1lIjogIlYzLXRva2VuIn19fTGB-zCB-AIBATBcMFcxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIEwVVbnNldDEOMAwGA1UEBxMFVW5zZXQxDjAMBgNVBAoTBVVuc2V0MRgwFgYDVQQDEw93d3cuZXhhbXBsZS5jb20CAQEwBwYFKw4DAhowDQYJKoZIhvcNAQEBBQAEgYAXtUJ0UAK-GAfxF6vVc5w84bQCLALp71yYM48MKN7uHzJU-KLgCSb2g4mMzvEQyDKco-H4wIT6t9-A5RqF5zuYIBIN1hl48j5koo3zYbpAKAtdsn7yrAo8mnAhnDj42W0r5709ACGM+pgmsMVZdiECvZUHsCStNp3OpmrVPhmeRg==
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 259
Date: Fri, 10 May 2013 15:06:59 GMT

{"token": {"issued_at": "2013-05-10T15:06:58.967556Z", "extras": {}, "methods": ["password"], "expires_at": "2013-05-11T15:06:58.967500Z", "user": {"domain": {"id": "default", "name": "Default"}, "id": "475ebc2782434f479d413d1792cbf8c1", "name": "V3-token"}}}

Request using XMl Interface:

curl -i http://IP:35357/v3/auth/tokens -X POST -H "User-Agent: python-keystoneclient" -H "Content-Type: application/xml" -H "X-Auth-Token: <Token>" -d'<?xml version="1.0" encoding="UTF-8"?><auth ><identity methods="password"><password ><user password="v3-token" id="475ebc2782434f479d413d1792cbf8c1"/></password></identity></auth>'
HTTP/1.1 401 Not Authorized
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 234
Date: Fri, 10 May 2013 14:40:23 GMT

{"error": {"message": "Expecting to find p in identity. The server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error.", "code": 401, "title": "Not Authorized"}}

I believe that the problem is a raised with the XMl Post Body at "methods" sub element

Can anyone correct me if I am wrong, ASAP.

Thanks in advance,
Harika

Question information

Best xingzhou (xingzhou) said : #1

Hi Hrika, I consider the XML format you are using may not be valid, here is the format I'm using and I can get the token responsed:

 curl -i -X POST -H "X-Autplication/xml" http://9.119.148.18:35357/v3/auth/tokens -d '<?xml version="1.0" encoding="UTF-8"?><auth><identity><methods><method>password</method></methods><password><user password="xxxxxx" name="admin"><domain id="default" name="default"/></user></password></identity></auth>'

Harika Vakadi (harika-vakadi) said : #2

Thanks xingzhou, that solved my question.