mirror of
https://github.com/ceph/ceph
synced 2025-02-20 17:37:29 +00:00
Merge pull request #31879 from joke-lee/rgw-sts-post-upload-auth
rgw: use STSEngine::authenticate when post upload with x_amz_security_token
This commit is contained in:
commit
c1b88a9c15
@ -1258,6 +1258,7 @@ namespace rgw {
|
||||
namespace auth {
|
||||
namespace s3 {
|
||||
class AWSBrowserUploadAbstractor;
|
||||
class STSEngine;
|
||||
}
|
||||
class Completer;
|
||||
}
|
||||
@ -1667,6 +1668,7 @@ struct req_state : DoutPrefixProvider {
|
||||
friend class RGWPostObj_ObjStore_S3;
|
||||
/* Reader. */
|
||||
friend class rgw::auth::s3::AWSBrowserUploadAbstractor;
|
||||
friend class rgw::auth::s3::STSEngine;
|
||||
|
||||
std::string access_key;
|
||||
std::string signature;
|
||||
|
@ -2885,7 +2885,12 @@ int RGWPostObj_ObjStore_S3::get_policy()
|
||||
}
|
||||
}
|
||||
|
||||
part_str(parts, "x-amz-security-token", &s->auth.s3_postobj_creds.x_amz_security_token);
|
||||
if (part_str(parts, "x-amz-security-token", &s->auth.s3_postobj_creds.x_amz_security_token)) {
|
||||
if (s->auth.s3_postobj_creds.x_amz_security_token.size() == 0) {
|
||||
err_msg = "Invalid token";
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: this is a makeshift solution. The browser upload authentication will be
|
||||
* handled by an instance of rgw::auth::Completer spawned in Handler's authorize()
|
||||
@ -5696,7 +5701,8 @@ rgw::auth::s3::STSEngine::authenticate(
|
||||
const req_state* const s) const
|
||||
{
|
||||
if (! s->info.args.exists("X-Amz-Security-Token") &&
|
||||
! s->info.env->exists("HTTP_X_AMZ_SECURITY_TOKEN")) {
|
||||
! s->info.env->exists("HTTP_X_AMZ_SECURITY_TOKEN") &&
|
||||
s->auth.s3_postobj_creds.x_amz_security_token.empty()) {
|
||||
return result_t::deny();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user