}
}
-int RGWSwift::get_keystone_url(CephContext * const cct,
- std::string& url)
+int KeystoneService::get_keystone_url(CephContext * const cct,
+ std::string& url)
{
- // FIXME: it seems we don't need RGWGetRevokedToken here
- bufferlist bl;
- RGWGetRevokedTokens req(cct, &bl);
-
url = cct->_conf->rgw_keystone_url;
if (url.empty()) {
ldout(cct, 0) << "ERROR: keystone url is not configured" << dendl;
return -EINVAL;
}
- if (url[url.size() - 1] != '/')
+
+ if (url[url.size() - 1] != '/') {
url.append("/");
+ }
+
return 0;
}
-int RGWSwift::get_keystone_admin_token(CephContext * const cct,
- std::string& token)
+int KeystoneService::get_keystone_admin_token(CephContext * const cct,
+ std::string& token)
{
std::string token_url;
};
class KeystoneService {
+ class RGWKeystoneHTTPTransceiver : public RGWHTTPTransceiver {
+ public:
+ RGWKeystoneHTTPTransceiver(CephContext * const cct,
+ bufferlist * const token_body_bl)
+ : RGWHTTPTransceiver(cct, token_body_bl,
+ cct->_conf->rgw_keystone_verify_ssl,
+ { "X-Subject-Token" }) {
+ }
+
+ std::string get_subject_token() const {
+ try {
+ return get_header_value("X-Subject-Token");
+ } catch (std::out_of_range&) {
+ return header_value_t();
+ }
+ }
+ };
+
+ typedef RGWKeystoneHTTPTransceiver RGWValidateKeystoneToken;
+ typedef RGWKeystoneHTTPTransceiver RGWGetKeystoneAdminToken;
+ typedef RGWKeystoneHTTPTransceiver RGWGetRevokedTokens;
+
public:
static KeystoneApiVersion get_api_version();
+
+ static int get_keystone_url(CephContext * const cct,
+ std::string& url);
+ static int get_keystone_admin_token(CephContext * const cct,
+ std::string& token);
};
class KeystoneToken {