summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2012-10-31 11:23:28 -0700
committerYehuda Sadeh <yehuda@inktank.com>2012-10-31 11:23:28 -0700
commitf9443865ba7e3deb4621088dab83ed0962fae4a5 (patch)
tree6b3658af9e54ed23f79669a7bdd801a8f8ef79b9
parent88f482335d011af11a0d5f32528c72f16b3b30b5 (diff)
downloadceph-f9443865ba7e3deb4621088dab83ed0962fae4a5.tar.gz
rgw: map keystone tenant id to rgw user
Instead of mapping the tenant name. Keep the name as the display_name. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_swift.cc12
-rw-r--r--src/rgw/rgw_swift.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/src/rgw/rgw_swift.cc b/src/rgw/rgw_swift.cc
index 14c0b958e72..19dbe1a340e 100644
--- a/src/rgw/rgw_swift.cc
+++ b/src/rgw/rgw_swift.cc
@@ -101,6 +101,7 @@ public:
class KeystoneTokenResponseParser {
public:
string tenant_name;
+ string tenant_id;
string user_name;
string expires;
@@ -172,6 +173,12 @@ int KeystoneTokenResponseParser::parse(bufferlist& bl)
return -EINVAL;
}
+ if (!tenant->get_data("id", &tenant_id)) {
+ dout(0) << "tenant is missing id field" << dendl;
+ return -EINVAL;
+ }
+
+
if (!tenant->get_data("name", &tenant_name)) {
dout(0) << "tenant is missing name field" << dendl;
return -EINVAL;
@@ -215,7 +222,8 @@ static int rgw_parse_keystone_token_response(bufferlist& bl, struct rgw_swift_au
dout(0) << "validated token: " << p.tenant_name << ":" << p.user_name << " expires: " << p.expires << dendl;
- info->user = p.tenant_name;
+ info->user = p.tenant_id;
+ info->display_name = p.tenant_name;
info->status = 200;
return 0;
@@ -248,7 +256,7 @@ static int rgw_swift_validate_keystone_token(RGWRados *store, const char *token,
if (rgw_get_user_info_by_uid(store, info->user, rgw_user) < 0) {
dout(0) << "NOTICE: couldn't map swift user" << dendl;
rgw_user.user_id = info->user;
- rgw_user.display_name = info->user; /* no display name available */
+ rgw_user.display_name = info->display_name;
ret = rgw_store_user_info(store, rgw_user, true);
if (ret < 0) {
diff --git a/src/rgw/rgw_swift.h b/src/rgw/rgw_swift.h
index 9cc289e1c34..f8a64d34460 100644
--- a/src/rgw/rgw_swift.h
+++ b/src/rgw/rgw_swift.h
@@ -10,6 +10,7 @@ struct rgw_swift_auth_info {
int status;
string auth_groups;
string user;
+ string display_name;
long long ttl;
rgw_swift_auth_info() : status(0), ttl(0) {}