int RGWOp::do_aws4_auth_completion()
{
- int ret;
-
if (s->aws4_auth_needs_complete) {
/* complete */
- ret = RGW_Auth_S3::authorize_aws4_auth_complete(store, s);
+ int ret = RGW_Auth_S3::authorize_aws4_auth_complete(store, s);
s->aws4_auth_needs_complete = false;
if (ret) {
return ret;
}
- /* verify signature */
- if (s->aws4_auth->signature != s->aws4_auth->new_signature) {
- ret = -ERR_SIGNATURE_NO_MATCH;
- ldout(s->cct, 20) << "delayed aws4 auth failed" << dendl;
- return ret;
- }
/* authorization ok */
dout(10) << "v4 auth ok" << dendl;
}
* a Canonical Request, and thus verify a Signature. x-amz-content-sha256
* header lets get the information very early -- before seeing first byte
* of HTTP body. As a consequence, we can decouple Signature verification
- * from payload's fingerprint check. Although RadosGW doesn't do that for
- * now, the situation will definitely change in the future.
+ * from payload's fingerprint check.
*
* An HTTP client MUST send x-amz-content-sha256. AFAIK the single exception
* to that is the case of using Query Parameters for doing the auth In such
std::string credential;
std::string signed_hdrs;
+ std::string client_signature;
int ret = rgw::auth::s3::parse_credentials(s->info,
credential,
signed_hdrs,
- s->aws4_auth->signature,
+ client_signature,
s->aws4_auth->date,
using_qs);
if (ret < 0) {
* a Canonical Request, and thus verify a Signature. x-amz-content-sha256
* header lets get the information very early -- before seeing first byte
* of HTTP body. As a consequence, we can decouple Signature verification
- * from payload's fingerprint check. Although RadosGW doesn't do that for
- * now, the situation will definitely change in the future.
+ * from payload's fingerprint check.
*
* An HTTP client MUST send x-amz-content-sha256. AFAIK the single exception
* to that is the case of using Query Parameters for doing the auth In such
s->aws4_auth->signing_key = \
rgw::auth::s3::get_v4_signing_key(s->cct,
s->aws4_auth->credential_scope, k.key);
- s->aws4_auth->new_signature = \
+ const std::string server_signature = \
rgw::auth::s3::get_v4_signature(s->cct, s->aws4_auth->signing_key,
string_to_sign);
ldout(s->cct, 10) << "----------------------------- Verifying signatures" << dendl;
- ldout(s->cct, 10) << "Signature = " << s->aws4_auth->signature << dendl;
- ldout(s->cct, 10) << "New Signature = " << s->aws4_auth->new_signature << dendl;
+ ldout(s->cct, 10) << "Signature = " << client_signature << dendl;
+ ldout(s->cct, 10) << "New Signature = " << server_signature << dendl;
ldout(s->cct, 10) << "-----------------------------" << dendl;
- s->aws4_auth->seed_signature = s->aws4_auth->new_signature;
+ /* verify signature */
+ if (client_signature != server_signature) {
+ ret = -ERR_SIGNATURE_NO_MATCH;
+ ldout(s->cct, 20) << "delayed aws4 auth failed" << dendl;
+ return ret;
+ }
+
+ s->aws4_auth->seed_signature = server_signature;
/* from rfc2616 - 4.3 Message Body
*
return err;
}
- /* verify signature */
-
- if (s->aws4_auth->signature != s->aws4_auth->new_signature) {
- return -ERR_SIGNATURE_NO_MATCH;
- }
-
/* authorization ok */
-
dout(10) << "v4 auth ok" << dendl;
/* aws4 auth completed */
return err;
}
- /* verify seed signature */
-
- if (s->aws4_auth->signature != s->aws4_auth->new_signature) {
- dout(10) << "ERROR: AWS4 seed signature does NOT match!" << dendl;
- return -ERR_SIGNATURE_NO_MATCH;
- }
-
dout(10) << "aws4 seed signature ok... delaying v4 auth" << dendl;
s->aws4_auth_needs_complete = false;