mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
Merge pull request #2350 from ceph/wip-8718
rgw: don't try to authenticate a CORS preflight request Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
2288011732
@ -2050,6 +2050,12 @@ int RGW_Auth_S3_Keystone_ValidateToken::validate_s3token(const string& auth_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void init_anon_user(struct req_state *s)
|
||||
{
|
||||
rgw_get_anon_user(s->user);
|
||||
s->perm_mask = RGW_PERM_FULL_CONTROL;
|
||||
}
|
||||
|
||||
/*
|
||||
* verify that a signed request comes from the keyholder
|
||||
* by checking the signature against our locally-computed version
|
||||
@ -2070,6 +2076,11 @@ int RGW_Auth_S3::authorize(RGWRados *store, struct req_state *s)
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if (s->op == OP_OPTIONS) {
|
||||
init_anon_user(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!s->http_auth || !(*s->http_auth)) {
|
||||
auth_id = s->info.args.get("AWSAccessKeyId");
|
||||
if (auth_id.size()) {
|
||||
@ -2083,8 +2094,7 @@ int RGW_Auth_S3::authorize(RGWRados *store, struct req_state *s)
|
||||
qsr = true;
|
||||
} else {
|
||||
/* anonymous access */
|
||||
rgw_get_anon_user(s->user);
|
||||
s->perm_mask = RGW_PERM_FULL_CONTROL;
|
||||
init_anon_user(s);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
|
@ -778,7 +778,8 @@ RGWOp *RGWHandler_ObjStore_Obj_SWIFT::op_options()
|
||||
|
||||
int RGWHandler_ObjStore_SWIFT::authorize()
|
||||
{
|
||||
if (!s->os_auth_token && s->info.args.get("temp_url_sig").empty()) {
|
||||
if ((!s->os_auth_token && s->info.args.get("temp_url_sig").empty()) ||
|
||||
(s->op == OP_OPTIONS)) {
|
||||
/* anonymous access */
|
||||
rgw_get_anon_user(s->user);
|
||||
s->perm_mask = RGW_PERM_FULL_CONTROL;
|
||||
|
Loading…
Reference in New Issue
Block a user