]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: auth: api to create auth identity without req_state
authorYehuda Sadeh <yehuda@redhat.com>
Sat, 23 Nov 2019 00:48:27 +0000 (16:48 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:39 +0000 (10:20 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_auth.cc
src/rgw/rgw_auth.h

index cc2f822350c22b6e3b80f08646b3780cb01bf3d1..b18d91832c3b9ed5d470a099f35da53346fb6643 100644 (file)
@@ -21,7 +21,11 @@ namespace rgw {
 namespace auth {
 
 std::unique_ptr<rgw::auth::Identity>
-transform_old_authinfo(const req_state* const s)
+transform_old_authinfo(CephContext* const cct,
+                       const rgw_user& auth_id,
+                       const int perm_mask,
+                       const bool is_admin,
+                       const uint32_t type)
 {
   /* This class is not intended for public use. Should be removed altogether
    * with this function after moving all our APIs to the new authentication
@@ -38,14 +42,15 @@ transform_old_authinfo(const req_state* const s)
     const uint32_t type;
   public:
     DummyIdentityApplier(CephContext* const cct,
-                         const sal::RGWUser* user,
+                         const rgw_user& auth_id,
                          const int perm_mask,
-                         const bool is_admin)
+                         const bool is_admin,
+                         const uint32_t type)
       : cct(cct),
-        id(user->get_id()),
+        id(auth_id),
         perm_mask(perm_mask),
         is_admin(is_admin),
-        type(user->get_type()) {
+        type(type) {
     }
 
     uint32_t get_perms_from_aclspec(const DoutPrefixProvider* dpp, const aclspec_t& aclspec) const override {
@@ -95,12 +100,23 @@ transform_old_authinfo(const req_state* const s)
   };
 
   return std::unique_ptr<rgw::auth::Identity>(
-        new DummyIdentityApplier(s->cct,
-                                 s->user,
-                                 s->perm_mask,
+        new DummyIdentityApplier(cct,
+                                 auth_id,
+                                 perm_mask,
+                                 is_admin,
+                                 type));
+}
+
+std::unique_ptr<rgw::auth::Identity>
+transform_old_authinfo(const req_state* const s)
+{
+  return transform_old_authinfo(s->cct,
+                                s->user->get_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,
+                                s->user->get_type());
 }
 
 } /* namespace auth */
index 37513f272a751c335d3192442464106c21b7e49e..38f51b790a8f88c0cb388732d86b4e4a4718704d 100644 (file)
@@ -85,6 +85,12 @@ inline std::ostream& operator<<(std::ostream& out,
 }
 
 
+std::unique_ptr<rgw::auth::Identity>
+transform_old_authinfo(CephContext* const cct,
+                       const rgw_user& auth_id,
+                       const int perm_mask,
+                       const bool is_admin,
+                       const uint32_t type);
 std::unique_ptr<Identity> transform_old_authinfo(const req_state* const s);