Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: clean-up in the authentication infrastructure #10212

Merged
merged 3 commits into from
Aug 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 21 additions & 18 deletions src/rgw/rgw_auth_decoimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ class RGWDecoratingAuthApplier : public RGWAuthApplier {
decoratee(decoratee) {
}

virtual uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override {
uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override {
return decoratee.get_perms_from_aclspec(aclspec);
}

virtual bool is_admin_of(const rgw_user& uid) const override {
bool is_admin_of(const rgw_user& uid) const override {
return decoratee.is_admin_of(uid);
}

virtual bool is_owner_of(const rgw_user& uid) const override {
bool is_owner_of(const rgw_user& uid) const override {
return decoratee.is_owner_of(uid);
}

virtual uint32_t get_perm_mask() const override {
uint32_t get_perm_mask() const override {
return decoratee.get_perm_mask();
}

virtual void to_str(std::ostream& out) const override {
void to_str(std::ostream& out) const override {
decoratee.to_str(out);
}

virtual void load_acct_info(RGWUserInfo& user_info) const override { /* out */
void load_acct_info(RGWUserInfo& user_info) const override { /* out */
return decoratee.load_acct_info(user_info);
}

virtual void modify_request_state(req_state * s) const override { /* in/out */
void modify_request_state(req_state * s) const override { /* in/out */
return decoratee.modify_request_state(s);
}
};
Expand All @@ -63,31 +63,31 @@ class RGWDecoratingAuthApplier<RGWAuthApplier::aplptr_t> : public RGWAuthApplier
decoratee(std::move(decoratee)) {
}

virtual uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override {
uint32_t get_perms_from_aclspec(const aclspec_t& aclspec) const override {
return decoratee->get_perms_from_aclspec(aclspec);
}

virtual bool is_admin_of(const rgw_user& uid) const override {
bool is_admin_of(const rgw_user& uid) const override {
return decoratee->is_admin_of(uid);
}

virtual bool is_owner_of(const rgw_user& uid) const override {
bool is_owner_of(const rgw_user& uid) const override {
return decoratee->is_owner_of(uid);
}

virtual uint32_t get_perm_mask() const override {
uint32_t get_perm_mask() const override {
return decoratee->get_perm_mask();
}

virtual void to_str(std::ostream& out) const override {
void to_str(std::ostream& out) const override {
decoratee->to_str(out);
}

virtual void load_acct_info(RGWUserInfo& user_info) const override { /* out */
void load_acct_info(RGWUserInfo& user_info) const override { /* out */
return decoratee->load_acct_info(user_info);
}

virtual void modify_request_state(req_state * s) const override { /* in/out */
void modify_request_state(req_state * s) const override { /* in/out */
return decoratee->modify_request_state(s);
}
};
Expand All @@ -98,7 +98,9 @@ class RGWThirdPartyAccountAuthApplier : public RGWDecoratingAuthApplier<T> {
/* const */RGWRados * const store;
const rgw_user acct_user_override;
public:
/* FIXME: comment this. */
/* A value representing situations where there is no requested account
* override. In other words, acct_user_override will be equal to this
* constant where the request isn't a cross-tenant one. */
static const rgw_user UNKNOWN_ACCT;

template <typename U>
Expand All @@ -110,11 +112,12 @@ class RGWThirdPartyAccountAuthApplier : public RGWDecoratingAuthApplier<T> {
acct_user_override(acct_user_override) {
}

virtual void to_str(std::ostream& out) const override;
virtual void load_acct_info(RGWUserInfo& user_info) const override; /* out */
void to_str(std::ostream& out) const override;
void load_acct_info(RGWUserInfo& user_info) const override; /* out */
};

/* static declaration */
/* static declaration: UNKNOWN_ACCT will be an empty rgw_user that is a result
* of the default construction. */
template <typename T>
const rgw_user RGWThirdPartyAccountAuthApplier<T>::UNKNOWN_ACCT;

Expand Down
13 changes: 6 additions & 7 deletions src/rgw/rgw_rest_swift.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1486,10 +1486,9 @@ RGWOp *RGWHandler_REST_Obj_SWIFT::op_options()
int RGWHandler_REST_SWIFT::authorize()
{
/* Factories. */
class SwiftAuthFactory
: public RGWTempURLAuthApplier::Factory,
public RGWLocalAuthApplier::Factory,
public RGWRemoteAuthApplier::Factory {
class SwiftAuthFactory : public RGWTempURLAuthApplier::Factory,
public RGWLocalAuthApplier::Factory,
public RGWRemoteAuthApplier::Factory {
typedef RGWAuthApplier::aplptr_t aplptr_t;

RGWRados * const store;
Expand All @@ -1511,8 +1510,8 @@ int RGWHandler_REST_SWIFT::authorize()
}

aplptr_t create_apl_local(CephContext * const cct,
const RGWUserInfo& user_info,
const std::string& subuser) const override {
const RGWUserInfo& user_info,
const std::string& subuser) const override {
return aplptr_t(
new RGWThirdPartyAccountAuthApplier<RGWLocalAuthApplier>(
RGWLocalAuthApplier(cct, user_info, subuser),
Expand Down Expand Up @@ -1557,7 +1556,7 @@ int RGWHandler_REST_SWIFT::authorize()
ldout(s->cct, 5) << "trying auth engine: " << engine->get_name() << dendl;

auto applier = engine->authenticate();
if (!applier) {
if (! applier) {
/* Access denied is acknowledged by returning a std::unique_ptr with
* nullptr inside. */
ldout(s->cct, 5) << "auth engine refused to authenicate" << dendl;
Expand Down