From c7288bf24d666874e3d75eae8354e54ee5bdb529 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 11 Jan 2017 16:14:11 +0100 Subject: [PATCH] rgw: replace RGWDummyIdentityApplier with rgw::auth::DummyIdentityApplier. Signed-off-by: Radoslaw Zarzynski --- src/rgw/librgw.cc | 8 ++++---- src/rgw/rgw_auth.cc | 32 +++++++++++++++++++------------- src/rgw/rgw_auth.h | 6 +++--- src/rgw/rgw_process.cc | 4 ++-- src/rgw/rgw_rest_s3.cc | 2 +- 5 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/rgw/librgw.cc b/src/rgw/librgw.cc index 4150a6f9dc6..9a0d3f33751 100644 --- a/src/rgw/librgw.cc +++ b/src/rgw/librgw.cc @@ -250,8 +250,8 @@ namespace rgw { /* FIXME: remove this after switching all handlers to the new authentication * infrastructure. */ - if (! s->auth_identity) { - s->auth_identity = rgw_auth_transform_old_authinfo(s); + if (! s->auth.identity) { + s->auth.identity = rgw::auth::transform_old_authinfo(s); } req->log(s, "reading op permissions"); @@ -365,8 +365,8 @@ namespace rgw { /* FIXME: remove this after switching all handlers to the new authentication * infrastructure. */ - if (! s->auth_identity) { - s->auth_identity = rgw_auth_transform_old_authinfo(s); + if (! s->auth.identity) { + s->auth.identity = rgw::auth::transform_old_authinfo(s); } req->log(s, "reading op permissions"); diff --git a/src/rgw/rgw_auth.cc b/src/rgw/rgw_auth.cc index 27840f28490..c9a1893913c 100644 --- a/src/rgw/rgw_auth.cc +++ b/src/rgw/rgw_auth.cc @@ -15,14 +15,17 @@ #define dout_subsys ceph_subsys_rgw -std::unique_ptr -rgw_auth_transform_old_authinfo(req_state * const s) +namespace rgw { +namespace auth { + +std::unique_ptr +transform_old_authinfo(const req_state* const s) { /* This class is not intended for public use. Should be removed altogether * with this function after moving all our APIs to the new authentication * infrastructure. */ - class RGWDummyIdentityApplier : public RGWIdentityApplier { - CephContext * const cct; + class DummyIdentityApplier : public rgw::auth::Identity { + CephContext* const cct; /* For this particular case it's OK to use rgw_user structure to convey * the identity info as this was the policy for doing that before the @@ -31,10 +34,10 @@ rgw_auth_transform_old_authinfo(req_state * const s) const int perm_mask; const bool is_admin; public: - RGWDummyIdentityApplier(CephContext * const cct, - const rgw_user& auth_id, - const int perm_mask, - const bool is_admin) + DummyIdentityApplier(CephContext* const cct, + const rgw_user& auth_id, + const int perm_mask, + const bool is_admin) : cct(cct), id(auth_id), perm_mask(perm_mask), @@ -64,15 +67,18 @@ rgw_auth_transform_old_authinfo(req_state * const s) } }; - return std::unique_ptr( - new RGWDummyIdentityApplier(s->cct, - s->user->user_id, - s->perm_mask, + return std::unique_ptr( + new DummyIdentityApplier(s->cct, + s->user->user_id, + s->perm_mask, /* System user has admin permissions by default - it's supposed to pass * through any security check. */ - s->system_request)); + s->system_request)); } +} /* namespace auth */ +} /* namespace rgw */ + uint32_t rgw_perms_from_aclspec_default_strategy( const rgw_user& uid, diff --git a/src/rgw/rgw_auth.h b/src/rgw/rgw_auth.h index 6755c8812b0..53d6b9e506d 100644 --- a/src/rgw/rgw_auth.h +++ b/src/rgw/rgw_auth.h @@ -62,9 +62,6 @@ inline std::ostream& operator<<(std::ostream& out, return out; } -std::unique_ptr -rgw_auth_transform_old_authinfo(req_state * const s); - uint32_t rgw_perms_from_aclspec_default_strategy( const rgw_user& uid, const RGWIdentityApplier::aclspec_t& aclspec); @@ -409,6 +406,9 @@ inline std::ostream& operator<<(std::ostream& out, } +std::unique_ptr transform_old_authinfo(const req_state* const s); + + /* Interface for classes applying changes to request state/RADOS store * imposed by a particular rgw::auth::Engine. * diff --git a/src/rgw/rgw_process.cc b/src/rgw/rgw_process.cc index 6b2c79d5939..c4d2c8dfbc6 100644 --- a/src/rgw/rgw_process.cc +++ b/src/rgw/rgw_process.cc @@ -178,8 +178,8 @@ int process_request(RGWRados* const store, /* FIXME: remove this after switching all handlers to the new authentication * infrastructure. */ - if (nullptr == s->auth_identity) { - s->auth_identity = rgw_auth_transform_old_authinfo(s); + if (nullptr == s->auth.identity) { + s->auth.identity = rgw::auth::transform_old_authinfo(s); } req->log(s, "normalizing buckets and tenants"); diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index a902c614029..fbd988eba92 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -1927,7 +1927,7 @@ int RGWPostObj_ObjStore_S3::get_policy() /* FIXME: remove this after switching S3 to the new authentication * infrastructure. */ - s->auth_identity = rgw_auth_transform_old_authinfo(s); + s->auth.identity = rgw::auth::transform_old_authinfo(s); } else { ldout(s->cct, 0) << "No attached policy found!" << dendl; } -- 2.39.5