1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
13 #include "rgw_auth_s3.h"
14 #include "rgw_swift_auth.h"
15 #include "rgw_rest_sts.h"
20 /* A class aggregating the knowledge about all Strategies in RadosGW. It is
21 * responsible for handling the dynamic reconfiguration on e.g. realm update. */
22 class StrategyRegistry
{
23 template <class AbstractorT
,
24 bool AllowAnonAccessT
= false>
25 using s3_strategy_t
= \
26 rgw::auth::s3::AWSAuthStrategy
<AbstractorT
, AllowAnonAccessT
>;
28 struct s3_main_strategy_t
: public Strategy
{
29 using s3_main_strategy_plain_t
= \
30 s3_strategy_t
<rgw::auth::s3::AWSGeneralAbstractor
, true>;
31 using s3_main_strategy_boto2_t
= \
32 s3_strategy_t
<rgw::auth::s3::AWSGeneralBoto2Abstractor
>;
34 s3_main_strategy_plain_t s3_main_strategy_plain
;
35 s3_main_strategy_boto2_t s3_main_strategy_boto2
;
37 s3_main_strategy_t(CephContext
* const cct
,
38 const ImplicitTenants
& implicit_tenant_context
,
39 rgw::sal::Driver
* driver
)
40 : s3_main_strategy_plain(cct
, implicit_tenant_context
, driver
),
41 s3_main_strategy_boto2(cct
, implicit_tenant_context
, driver
) {
42 add_engine(Strategy::Control::SUFFICIENT
, s3_main_strategy_plain
);
43 add_engine(Strategy::Control::FALLBACK
, s3_main_strategy_boto2
);
46 const char* get_name() const noexcept override
{
47 return "rgw::auth::StrategyRegistry::s3_main_strategy_t";
51 using s3_post_strategy_t
= \
52 s3_strategy_t
<rgw::auth::s3::AWSBrowserUploadAbstractor
>;
53 s3_post_strategy_t s3_post_strategy
;
55 rgw::auth::swift::DefaultStrategy swift_strategy
;
57 rgw::auth::sts::DefaultStrategy sts_strategy
;
60 StrategyRegistry(CephContext
* const cct
,
61 const ImplicitTenants
& implicit_tenant_context
,
62 rgw::sal::Driver
* driver
)
63 : s3_main_strategy(cct
, implicit_tenant_context
, driver
),
64 s3_post_strategy(cct
, implicit_tenant_context
, driver
),
65 swift_strategy(cct
, implicit_tenant_context
, driver
),
66 sts_strategy(cct
, implicit_tenant_context
, driver
) {
69 const s3_main_strategy_t
& get_s3_main() const {
70 return s3_main_strategy
;
73 const s3_post_strategy_t
& get_s3_post() const {
74 return s3_post_strategy
;
77 const rgw::auth::swift::DefaultStrategy
& get_swift() const {
78 return swift_strategy
;
81 const rgw::auth::sts::DefaultStrategy
& get_sts() const {
85 static std::unique_ptr
<StrategyRegistry
>
86 create(CephContext
* const cct
,
87 const ImplicitTenants
& implicit_tenant_context
,
88 rgw::sal::Driver
* driver
) {
89 return std::make_unique
<StrategyRegistry
>(cct
, implicit_tenant_context
, driver
);
93 } /* namespace auth */
96 using rgw_auth_registry_t
= rgw::auth::StrategyRegistry
;
97 using rgw_auth_registry_ptr_t
= std::unique_ptr
<rgw_auth_registry_t
>;