1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
5 #ifndef CEPH_RGW_AUTH_REGISTRY_H
6 #define CEPH_RGW_AUTH_REGISTRY_H
11 #include <type_traits>
15 #include "rgw_auth_s3.h"
16 #include "rgw_swift_auth.h"
21 /* A class aggregating the knowledge about all Strategies in RadosGW. It is
22 * responsible for handling the dynamic reconfiguration on e.g. realm update. */
23 class StrategyRegistry
{
24 template <class AbstractorT
,
25 bool AllowAnonAccessT
= false>
26 using s3_strategy_t
= \
27 rgw::auth::s3::AWSAuthStrategy
<AbstractorT
, AllowAnonAccessT
>;
29 struct s3_main_strategy_t
: public Strategy
{
30 using s3_main_strategy_plain_t
= \
31 s3_strategy_t
<rgw::auth::s3::AWSGeneralAbstractor
, true>;
32 using s3_main_strategy_boto2_t
= \
33 s3_strategy_t
<rgw::auth::s3::AWSGeneralBoto2Abstractor
, true>;
35 s3_main_strategy_plain_t s3_main_strategy_plain
;
36 s3_main_strategy_boto2_t s3_main_strategy_boto2
;
38 s3_main_strategy_t(CephContext
* const cct
, RGWRados
* const store
)
39 : s3_main_strategy_plain(cct
, store
),
40 s3_main_strategy_boto2(cct
, store
) {
41 add_engine(Strategy::Control::SUFFICIENT
, s3_main_strategy_plain
);
42 add_engine(Strategy::Control::FALLBACK
, s3_main_strategy_boto2
);
45 const char* get_name() const noexcept override
{
46 return "rgw::auth::StrategyRegistry::s3_main_strategy_t";
50 using s3_post_strategy_t
= \
51 s3_strategy_t
<rgw::auth::s3::AWSBrowserUploadAbstractor
>;
52 s3_post_strategy_t s3_post_strategy
;
54 rgw::auth::swift::DefaultStrategy swift_strategy
;
57 StrategyRegistry(CephContext
* const cct
,
58 RGWRados
* const store
)
59 : s3_main_strategy(cct
, store
),
60 s3_post_strategy(cct
, store
),
61 swift_strategy(cct
, store
) {
64 const s3_main_strategy_t
& get_s3_main() const {
65 return s3_main_strategy
;
68 const s3_post_strategy_t
& get_s3_post() const {
69 return s3_post_strategy
;
72 const rgw::auth::swift::DefaultStrategy
& get_swift() const {
73 return swift_strategy
;
76 static std::shared_ptr
<StrategyRegistry
>
77 create(CephContext
* const cct
,
78 RGWRados
* const store
) {
79 return std::make_shared
<StrategyRegistry
>(cct
, store
);
83 } /* namespace auth */
86 using rgw_auth_registry_t
= rgw::auth::StrategyRegistry
;
87 using rgw_auth_registry_ptr_t
= std::shared_ptr
<rgw_auth_registry_t
>;
89 #endif /* CEPH_RGW_AUTH_REGISTRY_H */