1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
10 #include <system_error>
13 #include "rgw_common.h"
14 #include "rgw_web_idp.h"
16 #define RGW_USER_ANON_ID "anonymous"
25 using Exception
= std::system_error
;
28 /* Load information about identity that will be used by RGWOp to authorize
29 * any operation that comes from an authenticated user. */
32 typedef std::map
<std::string
, int> aclspec_t
;
33 using idset_t
= boost::container::flat_set
<Principal
>;
35 virtual ~Identity() = default;
37 /* Translate the ACL provided in @aclspec into concrete permission set that
38 * can be used during the authorization phase (RGWOp::verify_permission).
39 * On error throws rgw::auth::Exception storing the reason.
41 * NOTE: an implementation is responsible for giving the real semantic to
42 * the items in @aclspec. That is, their meaning may depend on particular
43 * applier that is being used. */
44 virtual uint32_t get_perms_from_aclspec(const DoutPrefixProvider
* dpp
, const aclspec_t
& aclspec
) const = 0;
46 /* Verify whether a given identity *can be treated as* an admin of rgw_user
47 * (account in Swift's terminology) specified in @uid. On error throws
48 * rgw::auth::Exception storing the reason. */
49 virtual bool is_admin_of(const rgw_user
& uid
) const = 0;
51 /* Verify whether a given identity *is* the owner of the rgw_user (account
52 * in the Swift's terminology) specified in @uid. On internal error throws
53 * rgw::auth::Exception storing the reason. */
54 virtual bool is_owner_of(const rgw_user
& uid
) const = 0;
56 /* Return the permission mask that is used to narrow down the set of
57 * operations allowed for a given identity. This method reflects the idea
58 * of subuser tied to RGWUserInfo. On error throws rgw::auth::Exception
60 virtual uint32_t get_perm_mask() const = 0;
62 virtual bool is_anonymous() const {
63 /* If the identity owns the anonymous account (rgw_user), it's considered
64 * the anonymous identity. On error throws rgw::auth::Exception storing
66 return is_owner_of(rgw_user(RGW_USER_ANON_ID
));
69 virtual void to_str(std::ostream
& out
) const = 0;
71 /* Verify whether a given identity corresponds to an identity in the
73 virtual bool is_identity(const idset_t
& ids
) const = 0;
75 /* Identity Type: RGW/ LDAP/ Keystone */
76 virtual uint32_t get_identity_type() const = 0;
79 virtual std::string
get_acct_name() const = 0;
81 /* Subuser of Account */
82 virtual std::string
get_subuser() const = 0;
84 virtual std::string
get_role_tenant() const { return ""; }
86 /* write any auth-specific fields that are safe to expose in the ops log */
87 virtual void write_ops_log_entry(rgw_log_entry
& entry
) const {};
90 inline std::ostream
& operator<<(std::ostream
& out
,
91 const rgw::auth::Identity
& id
) {
97 std::unique_ptr
<rgw::auth::Identity
>
98 transform_old_authinfo(CephContext
* const cct
,
99 const rgw_user
& auth_id
,
102 const uint32_t type
);
103 std::unique_ptr
<Identity
> transform_old_authinfo(const req_state
* const s
);
106 /* Interface for classes applying changes to request state/RADOS store
107 * imposed by a particular rgw::auth::Engine.
109 * In contrast to rgw::auth::Engine, implementations of this interface
110 * are allowed to handle req_state or RGWUserCtl in the read-write manner.
112 * It's expected that most (if not all) of implementations will also
113 * conform to rgw::auth::Identity interface to provide authorization
114 * policy (ACLs, account's ownership and entitlement). */
115 class IdentityApplier
: public Identity
{
117 typedef std::unique_ptr
<IdentityApplier
> aplptr_t
;
119 virtual ~IdentityApplier() {};
121 /* Fill provided RGWUserInfo with information about the account that
122 * RGWOp will operate on. Errors are handled solely through exceptions.
124 * XXX: be aware that the "account" term refers to rgw_user. The naming
126 virtual void load_acct_info(const DoutPrefixProvider
* dpp
, RGWUserInfo
& user_info
) const = 0; /* out */
128 /* Apply any changes to request state. This method will be most useful for
129 * TempURL of Swift API. */
130 virtual void modify_request_state(const DoutPrefixProvider
* dpp
, req_state
* s
) const {} /* in/out */
134 /* Interface class for completing the two-step authentication process.
135 * Completer provides the second step - the complete() method that should
136 * be called after Engine::authenticate() but before *committing* results
137 * of an RGWOp (or sending a response in the case of non-mutating ops).
139 * The motivation driving the interface is to address those authentication
140 * schemas that require message integrity verification *without* in-memory
141 * data buffering. Typical examples are AWS Auth v4 and the auth mechanism
142 * of browser uploads facilities both in S3 and Swift APIs (see RGWPostObj).
143 * The workflow of request from the authentication point-of-view does look
144 * like following one:
145 * A. authenticate (Engine::authenticate),
146 * B. authorize (see RGWOp::verify_permissions),
147 * C. execute-prepare (init potential data modifications),
148 * D. authenticate-complete - (Completer::complete),
149 * E. execute-commit - commit the modifications from point C. */
152 /* It's expected that Completers would tend to implement many interfaces
153 * and be used not only in req_state::auth::completer. Ref counting their
154 * instances would be helpful. */
155 typedef std::shared_ptr
<Completer
> cmplptr_t
;
157 virtual ~Completer() = default;
159 /* Complete the authentication process. Return boolean indicating whether
160 * the completion succeeded. On error throws rgw::auth::Exception storing
162 virtual bool complete() = 0;
164 /* Apply any changes to request state. The initial use case was injecting
165 * the AWSv4 filter over rgw::io::RestfulClient in req_state. */
166 virtual void modify_request_state(const DoutPrefixProvider
* dpp
, req_state
* s
) = 0; /* in/out */
170 /* Interface class for authentication backends (auth engines) in RadosGW.
172 * An engine is supposed only to authenticate (not authorize!) requests
173 * basing on their req_state and - if access has been granted - provide
174 * an upper layer with:
175 * - rgw::auth::IdentityApplier to commit all changes to the request state as
176 * well as to the RADOS store (creating an account, synchronizing
177 * user-related information with external databases and so on).
178 * - rgw::auth::Completer (optionally) to finish the authentication
179 * of the request. Typical use case is verifying message integrity
180 * in AWS Auth v4 and browser uploads (RGWPostObj).
182 * Both of them are supposed to be wrapped in Engine::AuthResult.
184 * The authentication process consists of two steps:
185 * - Engine::authenticate() which should be called before *initiating*
186 * any modifications to RADOS store that are related to an operation
187 * a client wants to perform (RGWOp::execute).
188 * - Completer::complete() supposed to be called, if completer has been
189 * returned, after the authenticate() step but before *committing*
190 * those modifications or sending a response (RGWOp::complete).
192 * An engine outlives both Applier and Completer. It's intended to live
193 * since RadosGW's initialization and handle multiple requests till
196 * Auth engine MUST NOT make any changes to req_state nor RADOS store.
197 * This is solely an Applier's responsibility!
199 * Separation between authentication and global state modification has
200 * been introduced because many auth engines are orthogonal to appliers
201 * and thus they can be decoupled. Additional motivation is to clearly
202 * distinguish all portions of code modifying data structures. */
205 virtual ~Engine() = default;
208 struct rejection_mark_t
{};
209 bool is_rejected
= false;
212 std::pair
<IdentityApplier::aplptr_t
, Completer::cmplptr_t
> result_pair
;
214 explicit AuthResult(const int reason
)
218 AuthResult(rejection_mark_t
&&, const int reason
)
223 /* Allow only the reasonable combintations - returning just Completer
224 * without accompanying IdentityApplier is strictly prohibited! */
225 explicit AuthResult(IdentityApplier::aplptr_t
&& applier
)
226 : result_pair(std::move(applier
), nullptr) {
229 AuthResult(IdentityApplier::aplptr_t
&& applier
,
230 Completer::cmplptr_t
&& completer
)
231 : result_pair(std::move(applier
), std::move(completer
)) {
236 /* Engine doesn't grant the access but also doesn't reject it. */
239 /* Engine successfully authenicated requester. */
242 /* Engine strictly indicates that a request should be rejected
243 * without trying any further engine. */
247 Status
get_status() const {
249 return Status::REJECTED
;
250 } else if (! result_pair
.first
) {
251 return Status::DENIED
;
253 return Status::GRANTED
;
257 int get_reason() const {
261 IdentityApplier::aplptr_t
get_applier() {
262 return std::move(result_pair
.first
);
265 Completer::cmplptr_t
&& get_completer() {
266 return std::move(result_pair
.second
);
269 static AuthResult
reject(const int reason
= -EACCES
) {
270 return AuthResult(rejection_mark_t(), reason
);
273 static AuthResult
deny(const int reason
= -EACCES
) {
274 return AuthResult(reason
);
277 static AuthResult
grant(IdentityApplier::aplptr_t
&& applier
) {
278 return AuthResult(std::move(applier
));
281 static AuthResult
grant(IdentityApplier::aplptr_t
&& applier
,
282 Completer::cmplptr_t
&& completer
) {
283 return AuthResult(std::move(applier
), std::move(completer
));
287 using result_t
= AuthResult
;
289 /* Get name of the auth engine. */
290 virtual const char* get_name() const noexcept
= 0;
292 /* Throwing method for identity verification. When the check is positive
293 * an implementation should return Engine::result_t containing:
294 * - a non-null pointer to an object conforming the Applier interface.
295 * Otherwise, the authentication is treated as failed.
296 * - a (potentially null) pointer to an object conforming the Completer
299 * On error throws rgw::auth::Exception containing the reason. */
300 virtual result_t
authenticate(const DoutPrefixProvider
* dpp
, const req_state
* s
, optional_yield y
) const = 0;
304 /* Interface for extracting a token basing from data carried by req_state. */
305 class TokenExtractor
{
307 virtual ~TokenExtractor() = default;
308 virtual std::string
get_token(const req_state
* s
) const = 0;
312 /* Abstract class for stacking sub-engines to expose them as a single
313 * Engine. It is responsible for ordering its sub-engines and managing
314 * fall-backs between them. Derivatee is supposed to encapsulate engine
315 * instances and add them using the add_engine() method in the order it
316 * wants to be tried during the call to authenticate().
318 * Each new Strategy should be exposed to StrategyRegistry for handling
319 * the dynamic reconfiguration. */
320 class Strategy
: public Engine
{
322 /* Specifiers controlling what happens when an associated engine fails.
323 * The names and semantic has been borrowed mostly from libpam. */
325 /* Failure of an engine injected with the REQUISITE specifier aborts
326 * the strategy's authentication process immediately. No other engine
330 /* Success of an engine injected with the SUFFICIENT specifier ends
331 * strategy's authentication process successfully. However, denying
332 * doesn't abort it -- there will be fall-back to following engine
333 * if the one that failed wasn't the last one. */
336 /* Like SUFFICIENT with the exception that on failure the reason code
337 * is not overridden. Instead, it's taken directly from the last tried
338 * non-FALLBACK engine. If there was no previous non-FALLBACK engine
339 * in a Strategy, then the result_t::deny(reason = -EACCES) is used. */
343 Engine::result_t
authenticate(const DoutPrefixProvider
* dpp
, const req_state
* s
, optional_yield y
) const override final
;
345 bool is_empty() const {
346 return auth_stack
.empty();
349 static int apply(const DoutPrefixProvider
* dpp
, const Strategy
& auth_strategy
, req_state
* s
, optional_yield y
) noexcept
;
352 /* Using the reference wrapper here to explicitly point out we are not
353 * interested in storing nulls while preserving the dynamic polymorphism. */
354 using stack_item_t
= std::pair
<std::reference_wrapper
<const Engine
>,
356 std::vector
<stack_item_t
> auth_stack
;
359 void add_engine(Control ctrl_flag
, const Engine
& engine
) noexcept
;
363 /* A class aggregating the knowledge about all Strategies in RadosGW. It is
364 * responsible for handling the dynamic reconfiguration on e.g. realm update.
365 * The definition is in rgw/rgw_auth_registry.h,
367 * Each new Strategy should be exposed to it. */
368 class StrategyRegistry
;
370 class WebIdentityApplier
: public IdentityApplier
{
374 std::string client_id
;
375 std::string user_name
;
377 CephContext
* const cct
;
378 rgw::sal::Driver
* driver
;
379 std::string role_session
;
380 std::string role_tenant
;
381 std::unordered_multimap
<std::string
, std::string
> token_claims
;
382 boost::optional
<std::multimap
<std::string
,std::string
>> role_tags
;
383 boost::optional
<std::set
<std::pair
<std::string
, std::string
>>> principal_tags
;
385 std::string
get_idp_url() const;
387 void create_account(const DoutPrefixProvider
* dpp
,
388 const rgw_user
& acct_user
,
389 const std::string
& display_name
,
390 RGWUserInfo
& user_info
) const; /* out */
392 WebIdentityApplier( CephContext
* const cct
,
393 rgw::sal::Driver
* driver
,
394 const std::string
& role_session
,
395 const std::string
& role_tenant
,
396 const std::unordered_multimap
<std::string
, std::string
>& token_claims
,
397 boost::optional
<std::multimap
<std::string
,std::string
>> role_tags
,
398 boost::optional
<std::set
<std::pair
<std::string
, std::string
>>> principal_tags
)
401 role_session(role_session
),
402 role_tenant(role_tenant
),
403 token_claims(token_claims
),
404 role_tags(role_tags
),
405 principal_tags(principal_tags
) {
406 const auto& sub
= token_claims
.find("sub");
407 if(sub
!= token_claims
.end()) {
408 this->sub
= sub
->second
;
411 const auto& iss
= token_claims
.find("iss");
412 if(iss
!= token_claims
.end()) {
413 this->iss
= iss
->second
;
416 const auto& aud
= token_claims
.find("aud");
417 if(aud
!= token_claims
.end()) {
418 this->aud
= aud
->second
;
421 const auto& client_id
= token_claims
.find("client_id");
422 if(client_id
!= token_claims
.end()) {
423 this->client_id
= client_id
->second
;
425 const auto& azp
= token_claims
.find("azp");
426 if (azp
!= token_claims
.end()) {
427 this->client_id
= azp
->second
;
431 const auto& user_name
= token_claims
.find("username");
432 if(user_name
!= token_claims
.end()) {
433 this->user_name
= user_name
->second
;
435 const auto& given_username
= token_claims
.find("given_username");
436 if (given_username
!= token_claims
.end()) {
437 this->user_name
= given_username
->second
;
442 void modify_request_state(const DoutPrefixProvider
*dpp
, req_state
* s
) const override
;
444 uint32_t get_perms_from_aclspec(const DoutPrefixProvider
* dpp
, const aclspec_t
& aclspec
) const override
{
445 return RGW_PERM_NONE
;
448 bool is_admin_of(const rgw_user
& uid
) const override
{
452 bool is_owner_of(const rgw_user
& uid
) const override
{
453 if (uid
.id
== this->sub
&& uid
.tenant
== role_tenant
&& uid
.ns
== "oidc") {
459 uint32_t get_perm_mask() const override
{
460 return RGW_PERM_NONE
;
463 void to_str(std::ostream
& out
) const override
;
465 bool is_identity(const idset_t
& ids
) const override
;
467 void load_acct_info(const DoutPrefixProvider
* dpp
, RGWUserInfo
& user_info
) const override
;
469 uint32_t get_identity_type() const override
{
473 std::string
get_acct_name() const override
{
474 return this->user_name
;
477 std::string
get_subuser() const override
{
482 virtual ~Factory() {}
484 virtual aplptr_t
create_apl_web_identity( CephContext
* cct
,
486 const std::string
& role_session
,
487 const std::string
& role_tenant
,
488 const std::unordered_multimap
<std::string
, std::string
>& token
,
489 boost::optional
<std::multimap
<std::string
, std::string
>>,
490 boost::optional
<std::set
<std::pair
<std::string
, std::string
>>> principal_tags
) const = 0;
494 class ImplicitTenants
: public md_config_obs_t
{
496 enum implicit_tenant_flag_bits
{IMPLICIT_TENANTS_SWIFT
=1,
497 IMPLICIT_TENANTS_S3
=2, IMPLICIT_TENANTS_BAD
= -1, };
500 void recompute_value(const ConfigProxy
& );
501 class ImplicitTenantValue
{
502 friend class ImplicitTenants
;
504 ImplicitTenantValue(int v
) : v(v
) {};
506 bool inline is_split_mode()
508 assert(v
!= IMPLICIT_TENANTS_BAD
);
509 return v
== IMPLICIT_TENANTS_SWIFT
|| v
== IMPLICIT_TENANTS_S3
;
511 bool inline implicit_tenants_for_(const implicit_tenant_flag_bits bit
)
513 assert(v
!= IMPLICIT_TENANTS_BAD
);
514 return static_cast<bool>(v
&bit
);
518 ImplicitTenants(const ConfigProxy
& c
) { recompute_value(c
);}
519 ImplicitTenantValue
get_value() const {
520 return ImplicitTenantValue(saved
);
523 const char** get_tracked_conf_keys() const override
;
524 void handle_conf_change(const ConfigProxy
& conf
,
525 const std::set
<std::string
> &changed
) override
;
528 std::tuple
<bool,bool> implicit_tenants_enabled_for_swift(CephContext
* const cct
);
529 std::tuple
<bool,bool> implicit_tenants_enabled_for_s3(CephContext
* const cct
);
531 /* rgw::auth::RemoteApplier targets those authentication engines which don't
532 * need to ask the RADOS store while performing the auth process. Instead,
533 * they obtain credentials from an external source like Keystone or LDAP.
535 * As the authenticated user may not have an account yet, RGWRemoteAuthApplier
536 * must be able to create it basing on data passed by an auth engine. Those
537 * data will be used to fill RGWUserInfo structure. */
538 class RemoteApplier
: public IdentityApplier
{
541 friend class RemoteApplier
;
543 const rgw_user acct_user
;
544 const std::string acct_name
;
545 const uint32_t perm_mask
;
547 const uint32_t acct_type
;
548 const std::string access_key_id
;
549 const std::string subuser
;
552 enum class acct_privilege_t
{
557 static const std::string NO_SUBUSER
;
558 static const std::string NO_ACCESS_KEY
;
560 AuthInfo(const rgw_user
& acct_user
,
561 const std::string
& acct_name
,
562 const uint32_t perm_mask
,
563 const acct_privilege_t level
,
564 const std::string access_key_id
,
565 const std::string subuser
,
566 const uint32_t acct_type
=TYPE_NONE
)
567 : acct_user(acct_user
),
568 acct_name(acct_name
),
569 perm_mask(perm_mask
),
570 is_admin(acct_privilege_t::IS_ADMIN_ACCT
== level
),
571 acct_type(acct_type
),
572 access_key_id(access_key_id
),
577 using aclspec_t
= rgw::auth::Identity::aclspec_t
;
578 typedef std::function
<uint32_t(const aclspec_t
&)> acl_strategy_t
;
581 CephContext
* const cct
;
583 /* Read-write is intensional here due to RGWUserInfo creation process. */
584 rgw::sal::Driver
* driver
;
586 /* Supplemental strategy for extracting permissions from ACLs. Its results
587 * will be combined (ORed) with a default strategy that is responsible for
588 * handling backward compatibility. */
589 const acl_strategy_t extra_acl_strategy
;
592 const rgw::auth::ImplicitTenants
& implicit_tenant_context
;
593 const rgw::auth::ImplicitTenants::implicit_tenant_flag_bits implicit_tenant_bit
;
595 virtual void create_account(const DoutPrefixProvider
* dpp
,
596 const rgw_user
& acct_user
,
597 bool implicit_tenant
,
598 RGWUserInfo
& user_info
) const; /* out */
601 RemoteApplier(CephContext
* const cct
,
602 rgw::sal::Driver
* driver
,
603 acl_strategy_t
&& extra_acl_strategy
,
604 const AuthInfo
& info
,
605 const rgw::auth::ImplicitTenants
& implicit_tenant_context
,
606 rgw::auth::ImplicitTenants::implicit_tenant_flag_bits implicit_tenant_bit
)
609 extra_acl_strategy(std::move(extra_acl_strategy
)),
611 implicit_tenant_context(implicit_tenant_context
),
612 implicit_tenant_bit(implicit_tenant_bit
) {
615 uint32_t get_perms_from_aclspec(const DoutPrefixProvider
* dpp
, const aclspec_t
& aclspec
) const override
;
616 bool is_admin_of(const rgw_user
& uid
) const override
;
617 bool is_owner_of(const rgw_user
& uid
) const override
;
618 bool is_identity(const idset_t
& ids
) const override
;
620 uint32_t get_perm_mask() const override
{ return info
.perm_mask
; }
621 void to_str(std::ostream
& out
) const override
;
622 void load_acct_info(const DoutPrefixProvider
* dpp
, RGWUserInfo
& user_info
) const override
; /* out */
623 void write_ops_log_entry(rgw_log_entry
& entry
) const override
;
624 uint32_t get_identity_type() const override
{ return info
.acct_type
; }
625 std::string
get_acct_name() const override
{ return info
.acct_name
; }
626 std::string
get_subuser() const override
{ return {}; }
629 virtual ~Factory() {}
630 /* Providing r-value reference here is required intensionally. Callee is
631 * thus disallowed to handle std::function in a way that could inhibit
632 * the move behaviour (like forgetting about std::moving a l-value). */
633 virtual aplptr_t
create_apl_remote(CephContext
* cct
,
635 acl_strategy_t
&& extra_acl_strategy
,
636 const AuthInfo
&info
) const = 0;
641 /* rgw::auth::LocalApplier targets those auth engines that base on the data
642 * enclosed in the RGWUserInfo control structure. As a side effect of doing
643 * the authentication process, they must have it loaded. Leveraging this is
644 * a way to avoid unnecessary calls to underlying RADOS store. */
645 class LocalApplier
: public IdentityApplier
{
646 using aclspec_t
= rgw::auth::Identity::aclspec_t
;
649 const RGWUserInfo user_info
;
650 const std::string subuser
;
652 const std::string access_key_id
;
654 uint32_t get_perm_mask(const std::string
& subuser_name
,
655 const RGWUserInfo
&uinfo
) const;
658 static const std::string NO_SUBUSER
;
659 static const std::string NO_ACCESS_KEY
;
661 LocalApplier(CephContext
* const cct
,
662 const RGWUserInfo
& user_info
,
664 const std::optional
<uint32_t>& perm_mask
,
665 const std::string access_key_id
)
666 : user_info(user_info
),
667 subuser(std::move(subuser
)),
668 perm_mask(perm_mask
.value_or(RGW_PERM_INVALID
)),
669 access_key_id(access_key_id
) {
673 uint32_t get_perms_from_aclspec(const DoutPrefixProvider
* dpp
, const aclspec_t
& aclspec
) const override
;
674 bool is_admin_of(const rgw_user
& uid
) const override
;
675 bool is_owner_of(const rgw_user
& uid
) const override
;
676 bool is_identity(const idset_t
& ids
) const override
;
677 uint32_t get_perm_mask() const override
{
678 if (this->perm_mask
== RGW_PERM_INVALID
) {
679 return get_perm_mask(subuser
, user_info
);
681 return this->perm_mask
;
684 void to_str(std::ostream
& out
) const override
;
685 void load_acct_info(const DoutPrefixProvider
* dpp
, RGWUserInfo
& user_info
) const override
; /* out */
686 uint32_t get_identity_type() const override
{ return TYPE_RGW
; }
687 std::string
get_acct_name() const override
{ return {}; }
688 std::string
get_subuser() const override
{ return subuser
; }
689 void write_ops_log_entry(rgw_log_entry
& entry
) const override
;
692 virtual ~Factory() {}
693 virtual aplptr_t
create_apl_local(CephContext
* cct
,
695 const RGWUserInfo
& user_info
,
696 const std::string
& subuser
,
697 const std::optional
<uint32_t>& perm_mask
,
698 const std::string
& access_key_id
) const = 0;
702 class RoleApplier
: public IdentityApplier
{
708 std::vector
<std::string
> role_policies
;
712 std::string token_policy
;
713 std::string role_session_name
;
714 std::vector
<std::string
> token_claims
;
715 std::string token_issued_at
;
716 std::vector
<std::pair
<std::string
, std::string
>> principal_tags
;
720 TokenAttrs token_attrs
;
724 RoleApplier(CephContext
* const cct
,
726 const TokenAttrs
& token_attrs
)
728 token_attrs(token_attrs
) {}
730 uint32_t get_perms_from_aclspec(const DoutPrefixProvider
* dpp
, const aclspec_t
& aclspec
) const override
{
733 bool is_admin_of(const rgw_user
& uid
) const override
{
736 bool is_owner_of(const rgw_user
& uid
) const override
{
737 return (this->token_attrs
.user_id
.id
== uid
.id
&& this->token_attrs
.user_id
.tenant
== uid
.tenant
&& this->token_attrs
.user_id
.ns
== uid
.ns
);
739 bool is_identity(const idset_t
& ids
) const override
;
740 uint32_t get_perm_mask() const override
{
741 return RGW_PERM_NONE
;
743 void to_str(std::ostream
& out
) const override
;
744 void load_acct_info(const DoutPrefixProvider
* dpp
, RGWUserInfo
& user_info
) const override
; /* out */
745 uint32_t get_identity_type() const override
{ return TYPE_ROLE
; }
746 std::string
get_acct_name() const override
{ return {}; }
747 std::string
get_subuser() const override
{ return {}; }
748 void modify_request_state(const DoutPrefixProvider
* dpp
, req_state
* s
) const override
;
749 std::string
get_role_tenant() const override
{ return role
.tenant
; }
752 virtual ~Factory() {}
753 virtual aplptr_t
create_apl_role( CephContext
* cct
,
755 const rgw::auth::RoleApplier::Role
& role
,
756 const rgw::auth::RoleApplier::TokenAttrs
& token_attrs
) const = 0;
760 /* The anonymous abstract engine. */
761 class AnonymousEngine
: public Engine
{
762 CephContext
* const cct
;
763 const rgw::auth::LocalApplier::Factory
* const apl_factory
;
766 AnonymousEngine(CephContext
* const cct
,
767 const rgw::auth::LocalApplier::Factory
* const apl_factory
)
769 apl_factory(apl_factory
) {
772 const char* get_name() const noexcept override
{
773 return "rgw::auth::AnonymousEngine";
776 Engine::result_t
authenticate(const DoutPrefixProvider
* dpp
, const req_state
* s
, optional_yield y
) const override final
;
779 virtual bool is_applicable(const req_state
*) const noexcept
{
784 } /* namespace auth */
785 } /* namespace rgw */
788 uint32_t rgw_perms_from_aclspec_default_strategy(
790 const rgw::auth::Identity::aclspec_t
& aclspec
,
791 const DoutPrefixProvider
*dpp
);