]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW/Roles: honor "--max-session-duration" option when CREATING a role
authorOguzhan Ozmen <oozmen@bloomberg.net>
Sat, 7 Oct 2023 01:53:23 +0000 (21:53 -0400)
committerOguzhan Ozmen <oozmen@bloomberg.net>
Fri, 20 Oct 2023 20:07:13 +0000 (16:07 -0400)
Currently, this option is not honored and the default (3600s) is used
regardless of whether this option is provided when creating a role:

$ radosgw-admin role create  --role-name=myrole --max-session-duration=43200 ...
$ radosgw-admin role get --role-name=myrole | jq '.MaxSessionDuration'
3600

With this commit, the value given by the --max-session-duration is
considered when creating the role. This would reduce the need for
updating the role's max-session-duration using a separate "role update"
radosgw-admin command call after the role is created:

$ radosgw-admin role create  --role-name=myrole --max-session-duration=43200 ...
$ radosgw-admin role get --role-name=myrole | jq '.MaxSessionDuration'
43200

Signed-off-by: Oguzhan Ozmen <oozmen@bloomberg.net>
src/rgw/rgw_admin.cc

index 25955a52213c632ba34d51f6dc019910886eacd2..4b4b5977aa6cbf81bb046057f1b69c976fdbc614 100644 (file)
@@ -6712,7 +6712,8 @@ int main(int argc, const char **argv)
         cerr << "failed to parse policy: " << e.what() << std::endl;
         return -EINVAL;
       }
-      std::unique_ptr<rgw::sal::RGWRole> role = driver->get_role(role_name, tenant, path, assume_role_doc);
+      std::unique_ptr<rgw::sal::RGWRole> role = driver->get_role(role_name, tenant, path,
+                                                                 assume_role_doc, max_session_duration);
       ret = role->create(dpp(), true, "", null_yield);
       if (ret < 0) {
         return -ret;