1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#ifndef CEPH_RGW_AUTH_REGISTRY_H
#define CEPH_RGW_AUTH_REGISTRY_H
#include <functional>
#include <memory>
#include <ostream>
#include <type_traits>
#include <utility>
#include "rgw_auth.h"
#include "rgw_auth_s3.h"
#include "rgw_swift_auth.h"
#include "rgw_rest_sts.h"
namespace rgw {
namespace auth {
/* A class aggregating the knowledge about all Strategies in RadosGW. It is
* responsible for handling the dynamic reconfiguration on e.g. realm update. */
class StrategyRegistry {
template <class AbstractorT,
bool AllowAnonAccessT = false>
using s3_strategy_t = \
rgw::auth::s3::AWSAuthStrategy<AbstractorT, AllowAnonAccessT>;
struct s3_main_strategy_t : public Strategy {
using s3_main_strategy_plain_t = \
s3_strategy_t<rgw::auth::s3::AWSGeneralAbstractor, true>;
using s3_main_strategy_boto2_t = \
s3_strategy_t<rgw::auth::s3::AWSGeneralBoto2Abstractor>;
s3_main_strategy_plain_t s3_main_strategy_plain;
s3_main_strategy_boto2_t s3_main_strategy_boto2;
s3_main_strategy_t(CephContext* const cct,
ImplicitTenants& implicit_tenant_context,
RGWRados* const store)
: s3_main_strategy_plain(cct, implicit_tenant_context, store),
s3_main_strategy_boto2(cct, implicit_tenant_context, store) {
add_engine(Strategy::Control::SUFFICIENT, s3_main_strategy_plain);
add_engine(Strategy::Control::FALLBACK, s3_main_strategy_boto2);
}
const char* get_name() const noexcept override {
return "rgw::auth::StrategyRegistry::s3_main_strategy_t";
}
} s3_main_strategy;
using s3_post_strategy_t = \
s3_strategy_t<rgw::auth::s3::AWSBrowserUploadAbstractor>;
s3_post_strategy_t s3_post_strategy;
rgw::auth::swift::DefaultStrategy swift_strategy;
rgw::auth::sts::DefaultStrategy sts_strategy;
public:
StrategyRegistry(CephContext* const cct,
ImplicitTenants& implicit_tenant_context,
RGWRados* const store)
: s3_main_strategy(cct, implicit_tenant_context, store),
s3_post_strategy(cct, implicit_tenant_context, store),
swift_strategy(cct, implicit_tenant_context, store),
sts_strategy(cct, store) {
}
const s3_main_strategy_t& get_s3_main() const {
return s3_main_strategy;
}
const s3_post_strategy_t& get_s3_post() const {
return s3_post_strategy;
}
const rgw::auth::swift::DefaultStrategy& get_swift() const {
return swift_strategy;
}
const rgw::auth::sts::DefaultStrategy& get_sts() const {
return sts_strategy;
}
static std::shared_ptr<StrategyRegistry>
create(CephContext* const cct,
ImplicitTenants& implicit_tenant_context,
RGWRados* const store) {
return std::make_shared<StrategyRegistry>(cct, implicit_tenant_context, store);
}
};
} /* namespace auth */
} /* namespace rgw */
using rgw_auth_registry_t = rgw::auth::StrategyRegistry;
using rgw_auth_registry_ptr_t = std::shared_ptr<rgw_auth_registry_t>;
#endif /* CEPH_RGW_AUTH_REGISTRY_H */
|