diff options
-rw-r--r-- | src/rgw/rgw_swift.cc | 14 | ||||
-rw-r--r-- | src/rgw/rgw_swift.h | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/rgw/rgw_swift.cc b/src/rgw/rgw_swift.cc index 9eda1eda071..9bb7cecad82 100644 --- a/src/rgw/rgw_swift.cc +++ b/src/rgw/rgw_swift.cc @@ -644,7 +644,7 @@ bool RGWSwift::verify_swift_token(RGWRados *store, req_state *s) int ret; - if (!cct->_conf->rgw_keystone_url.empty()) { + if (supports_keystone()) { ret = validate_keystone_token(store, s->os_auth_token, &info, s->user); return (ret >= 0); } @@ -678,7 +678,13 @@ bool RGWSwift::verify_swift_token(RGWRados *store, req_state *s) void RGWSwift::init() { get_str_list(cct->_conf->rgw_keystone_accepted_roles, roles_list); + if (supports_keystone()) + init_keystone(); +} + +void RGWSwift::init_keystone() +{ keystone_token_cache = new RGWKeystoneTokenCache(cct, cct->_conf->rgw_keystone_token_cache_size); keystone_revoke_thread = new KeystoneRevokeThread(cct, this); @@ -688,6 +694,12 @@ void RGWSwift::init() void RGWSwift::finalize() { + if (supports_keystone()) + finalize_keystone(); +} + +void RGWSwift::finalize_keystone() +{ delete keystone_token_cache; keystone_token_cache = NULL; diff --git a/src/rgw/rgw_swift.h b/src/rgw/rgw_swift.h index 6c5024e1a54..febc2675c27 100644 --- a/src/rgw/rgw_swift.h +++ b/src/rgw/rgw_swift.h @@ -64,11 +64,16 @@ class RGWSwift { void init(); void finalize(); + void init_keystone(); + void finalize_keystone(); + bool supports_keystone() { + return !cct->_conf->rgw_keystone_url.empty(); + } protected: int check_revoked(); public: - RGWSwift(CephContext *_cct) : cct(_cct) { + RGWSwift(CephContext *_cct) : cct(_cct), keystone_revoke_thread(NULL) { init(); } ~RGWSwift() { |