From 6c0ddca8d0730501c37f0c7b88a8d3b3c36ca11f Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 21 Jul 2020 12:28:00 +0300 Subject: [PATCH] Add missing error checks --- auth/center.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/auth/center.go b/auth/center.go index 35797766..801f6074 100644 --- a/auth/center.go +++ b/auth/center.go @@ -152,7 +152,7 @@ func (center *Center) AuthenticationPassed(request *http.Request) (*service.Bear } signatureDateTime, err := time.Parse("20060102T150405Z", request.Header.Get("X-Amz-Date")) if err != nil { - // TODO + return nil, errors.Wrap(err, "failed to parse x-amz-date header field") } accessKeyID := sms1["access_key_id"] bearerToken, secretAccessKey, err := center.unpackBearerToken(accessKeyID) @@ -174,11 +174,11 @@ func (center *Center) AuthenticationPassed(request *http.Request) (*service.Bear signer := v4.NewSigner(awsCreds) body, err := readAndKeepBody(request) if err != nil { - // TODO + return nil, errors.Wrap(err, "failed to read out request body") } _, err = signer.Sign(otherRequest, body, sms1["service"], sms1["region"], signatureDateTime) if err != nil { - // TODO + return nil, errors.Wrap(err, "failed to sign temporary HTTP request") } sms2 := center.submatcher.getSubmatches(otherRequest.Header.Get("Authorization")) if sms1["v4_signature"] != sms2["v4_signature"] {