rgw: Fix for incorrect access key id reworked ldap auth code.

The reworked ldap code does not use the correct access key id in get_policy.

Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
This commit is contained in:
Pritha Srivastava 2016-08-05 21:43:33 +05:30
parent 8865846f27
commit c7dae89016
2 changed files with 13 additions and 1 deletions

View File

@ -1714,7 +1714,7 @@ int RGWPostObj_ObjStore_S3::get_policy()
op_ret = rgw_get_user_info_by_access_key(store, s3_access_key, user_info);
if (op_ret < 0) {
S3AuthFactory aplfact(store, s->account_name);
RGWLDAPTokenExtractor token_extr(s);
RGWGetPolicyLDAPTokenExtractor token_extr(s3_access_key);
RGWLDAPAuthEngine ldap(s->cct, store, token_extr, &aplfact);
// try external authenticators
if (store->ctx()->_conf->rgw_s3_auth_use_keystone &&

View File

@ -689,6 +689,18 @@ public:
std::string get_token() const override;
};
class RGWGetPolicyLDAPTokenExtractor : public RGWTokenBasedAuthEngine::Extractor {
std::string access_key_id;
public:
RGWGetPolicyLDAPTokenExtractor(std::string access_key_id) {
access_key_id = std::move(access_key_id);
}
std::string get_token() const {
return access_key_id;
}
};
class S3AuthFactory : public RGWRemoteAuthApplier::Factory {
typedef RGWAuthApplier::aplptr_t aplptr_t;
RGWRados * const store;