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