/* check if we have a valid role */
bool found = false;
- list<string>::iterator iter;
- for (iter = roles_list.begin(); iter != roles_list.end(); ++iter) {
- if ((found=response.has_role(*iter))==true)
+ for (const auto role : accepted_roles) {
+ if (response.has_role(role) == true) {
+ found = true;
break;
+ }
}
if (!found) {
bufferlist rx_buffer;
bufferlist tx_buffer;
bufferlist::iterator tx_buffer_it;
- list<string> roles_list;
+ vector<string> accepted_roles;
public:
KeystoneToken response;
public:
explicit RGW_Auth_S3_Keystone_ValidateToken(CephContext *_cct)
: RGWHTTPClient(_cct) {
- get_str_list(cct->_conf->rgw_keystone_accepted_roles, roles_list);
+ get_str_vec(cct->_conf->rgw_keystone_accepted_roles, accepted_roles);
}
int receive_header(void *ptr, size_t len) {
#define dout_subsys ceph_subsys_rgw
-static list<string> roles_list;
+static vector<string> accepted_roles;
+static vector<string> accepted_admin_roles;
class RGWValidateSwiftToken : public RGWHTTPClient {
struct rgw_swift_auth_info *info;
}
bool found = false;
- list<string>::iterator iter;
- for (iter = roles_list.begin(); iter != roles_list.end(); ++iter) {
- const string& role = *iter;
- if ((found=t.has_role(role))==true)
+ for (const auto role : accepted_roles) {
+ if (t.has_role(role) == true) {
+ found = true;
break;
}
void RGWSwift::init()
{
- get_str_list(cct->_conf->rgw_keystone_accepted_roles, roles_list);
- if (supports_keystone())
- init_keystone();
+ get_str_vec(cct->_conf->rgw_keystone_accepted_roles, accepted_roles);
+ get_str_vec(cct->_conf->rgw_keystone_accepted_admin_roles,
+ accepted_admin_roles);
+
+ accepted_roles.insert(accepted_roles.end(), accepted_admin_roles.begin(),
+ accepted_admin_roles.end());
+
+ if (supports_keystone()) {
+ init_keystone();
+ }
}