From: Radoslaw Zarzynski Date: Sat, 18 Mar 2017 15:16:02 +0000 (+0100) Subject: rgw: the S3's local v2 auth engine becomes a fallback conditionally. X-Git-Tag: v12.0.2~305^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d3b04dfed7accc7af7bb79ec4faa911e37dee15f;p=ceph-ci.git rgw: the S3's local v2 auth engine becomes a fallback conditionally. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_auth.h b/src/rgw/rgw_auth.h index fb72c5c5351..b7346f65f5b 100644 --- a/src/rgw/rgw_auth.h +++ b/src/rgw/rgw_auth.h @@ -305,6 +305,10 @@ public: Engine::result_t authenticate(const req_state* s) const override final; + bool is_empty() const { + return auth_stack.empty(); + } + private: /* Using the reference wrapper here to explicitly point out we are not * interested in storing nulls while preserving the dynamic polymorphism. */ diff --git a/src/rgw/rgw_auth_s3.h b/src/rgw/rgw_auth_s3.h index 4e0fa6fb0ae..cbc0bee69af 100644 --- a/src/rgw/rgw_auth_s3.h +++ b/src/rgw/rgw_auth_s3.h @@ -105,10 +105,18 @@ public: external_engines(cct, store, &extractor), local_engine(cct, store, extractor, static_cast(this)) { - add_engine(Control::SUFFICIENT, external_engines); + + Control local_engine_mode; + if (! external_engines.is_empty()) { + add_engine(Control::SUFFICIENT, external_engines); + + local_engine_mode = Control::FALLBACK; + } else { + local_engine_mode = Control::SUFFICIENT; + } if (cct->_conf->rgw_s3_auth_use_rados) { - add_engine(Control::FALLBACK, local_engine); + add_engine(local_engine_mode, local_engine); } }