]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix generate keystone token from credentials
authorMouad Benchchaoui <m.benchchaoui@x-ion.de>
Thu, 20 Feb 2014 16:06:33 +0000 (17:06 +0100)
committerYehuda Sadeh <yehuda@inktank.com>
Thu, 20 Feb 2014 16:59:48 +0000 (08:59 -0800)
Request to v2.0/tokens must be a POST request and the request
should specify JSON in the content-type header and fix request
body JSON generation to have the right JSON format.

Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Signed-off-by: Mouad Benchchaoui <m.benchchaoui@x-ion.de>
src/rgw/rgw_swift.cc

index 1ae8f94d7f5892291f8b7e5ea8971aa615cb1eba..c7e707a65f99d89a860e4d53c589de0d3e93fb84 100644 (file)
@@ -252,18 +252,21 @@ int       RGWSwift::get_keystone_admin_token(std::string& token)
     KeystoneToken t;
     bufferlist token_bl;
     RGWGetKeystoneAdminToken token_req(cct, &token_bl);
+    token_req.append_header("Content-Type", "application/json");
     JSONFormatter jf;
     jf.open_object_section("auth");
+    jf.open_object_section("auth"); // XXX: Workaround to have right Json object.
     jf.open_object_section("passwordCredentials");
     encode_json("username", cct->_conf->rgw_keystone_admin_user, &jf);
     encode_json("password", cct->_conf->rgw_keystone_admin_password, &jf);
     jf.close_section();
     encode_json("tenantName", cct->_conf->rgw_keystone_admin_tenant, &jf);
     jf.close_section();
+    jf.close_section();
     std::stringstream ss;
     jf.flush(ss);
     token_req.set_post_data(ss.str());
-    int ret = token_req.process(token_url.c_str());
+    int ret = token_req.process("POST", token_url.c_str());
     if (ret < 0)
       return ret;
     if (t.parse(cct, token_bl) != 0)