Merge pull request #40 from nspcc-dev/migrate-to-sdk-0.3.3-and-fix-39
Update dependencies and fixes
This commit is contained in:
commit
3e124a87c9
3 changed files with 18 additions and 45 deletions
|
@ -71,11 +71,6 @@ func (c *center) Authenticate(r *http.Request) (*token.BearerToken, error) {
|
|||
return nil, errors.New("unsupported request: wrong length of Authorization header field")
|
||||
}
|
||||
|
||||
// { // to debug request
|
||||
// data, _ := httputil.DumpRequest(r, false)
|
||||
// fmt.Println(string(data))
|
||||
// }
|
||||
|
||||
sms1 := c.reg.getSubmatches(authHeaderField[0])
|
||||
if len(sms1) != 7 {
|
||||
return nil, errors.New("bad Authorization header field")
|
||||
|
@ -109,25 +104,19 @@ func (c *center) Authenticate(r *http.Request) (*token.BearerToken, error) {
|
|||
}
|
||||
|
||||
otherRequest := r.Clone(context.TODO())
|
||||
otherRequest.Header = map[string][]string{}
|
||||
otherRequest.Header = make(http.Header)
|
||||
|
||||
for hfn, hfvs := range r.Header {
|
||||
for _, shfn := range signedHeaderFieldsNames {
|
||||
if strings.EqualFold(hfn, shfn) {
|
||||
otherRequest.Header[hfn] = hfvs
|
||||
for key, val := range r.Header {
|
||||
for _, name := range signedHeaderFieldsNames {
|
||||
if strings.EqualFold(key, name) {
|
||||
otherRequest.Header[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
awsCreds := credentials.NewStaticCredentials(accessKeyID, secret, "")
|
||||
signer := v4.NewSigner(awsCreds)
|
||||
|
||||
// body, err := readAndKeepBody(r)
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrap(err, "failed to read out request body")
|
||||
// }
|
||||
//
|
||||
// _ = body
|
||||
signer.DisableURIPathEscaping = true
|
||||
|
||||
// body not required
|
||||
if _, err := signer.Sign(otherRequest, nil, sms1["service"], sms1["region"], signatureDateTime); err != nil {
|
||||
|
@ -141,21 +130,3 @@ func (c *center) Authenticate(r *http.Request) (*token.BearerToken, error) {
|
|||
|
||||
return tkn, nil
|
||||
}
|
||||
|
||||
// for debug reasons
|
||||
// func panicSeeker() io.ReadSeeker { return prs(0) }
|
||||
|
||||
// TODO: Make this write into a smart buffer backed by a file on a fast drive.
|
||||
// func readAndKeepBody(request *http.Request) (*bytes.Reader, error) {
|
||||
// if request.Body == nil {
|
||||
// return new(bytes.Reader), nil
|
||||
// }
|
||||
//
|
||||
// payload, err := ioutil.ReadAll(request.Body)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// request.Body = ioutil.NopCloser(bytes.NewReader(payload))
|
||||
// return bytes.NewReader(payload), nil
|
||||
// }
|
||||
|
|
8
go.mod
8
go.mod
|
@ -3,11 +3,11 @@ module github.com/nspcc-dev/neofs-s3-gate
|
|||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/aws/aws-sdk-go v1.36.28
|
||||
github.com/google/uuid v1.1.5
|
||||
github.com/aws/aws-sdk-go v1.37.1
|
||||
github.com/google/uuid v1.2.0
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/nspcc-dev/cdn-sdk v0.3.1
|
||||
github.com/nspcc-dev/neofs-api-go v1.22.1
|
||||
github.com/nspcc-dev/cdn-sdk v0.3.3
|
||||
github.com/nspcc-dev/neofs-api-go v1.22.2
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.9.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
|
|
14
go.sum
14
go.sum
|
@ -47,6 +47,8 @@ github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQ
|
|||
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.36.28 h1:JVRN7BZgwQ31SQCBwG5QM445+ynJU0ruKu+miFIijYY=
|
||||
github.com/aws/aws-sdk-go v1.36.28/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
|
||||
github.com/aws/aws-sdk-go v1.37.1 h1:BTHmuN+gzhxkvU9sac2tZvaY0gV9ihbHw+KxZOecYvY=
|
||||
github.com/aws/aws-sdk-go v1.37.1/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
|
||||
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
|
@ -178,8 +180,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
|
|||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I=
|
||||
github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||
|
@ -296,8 +298,8 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE
|
|||
github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/nspcc-dev/cdn-sdk v0.3.1 h1:8aDktq8vkzv/KUF1isSe6sUQiDGn6CG1k0Y/zaNn1LA=
|
||||
github.com/nspcc-dev/cdn-sdk v0.3.1/go.mod h1:Wiw3oQjT2F+8ZRt8VnC34ZrSuCDvijyxc1p7bWmcSvk=
|
||||
github.com/nspcc-dev/cdn-sdk v0.3.3 h1:lAKK6ntvfqlxbn1JN0i4pv3ECFl0jpHVbxamzdTRysg=
|
||||
github.com/nspcc-dev/cdn-sdk v0.3.3/go.mod h1:wVkJYINe4WtK40uiQRT6OtmbG2zohjl1EM17U5UkgOY=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+dBlPhLnuZhBV+DfPEdS2CHWWLp5JTScY3bw=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk=
|
||||
|
@ -308,8 +310,8 @@ github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkP
|
|||
github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg=
|
||||
github.com/nspcc-dev/neo-go v0.91.0 h1:KKOPMKs0fm8JIau1SuwxiLdrZ+1kDPBiVRlWwzfebWE=
|
||||
github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc=
|
||||
github.com/nspcc-dev/neofs-api-go v1.22.1 h1:O4uRUM4OxAKKQOebqXIn8uDaER4E5LTEO9Yd7GYkiQA=
|
||||
github.com/nspcc-dev/neofs-api-go v1.22.1/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8=
|
||||
github.com/nspcc-dev/neofs-api-go v1.22.2 h1:kNKM7wQMZ23nfFCUgBdkaYaszu4bjgabaUR8nTYBYZQ=
|
||||
github.com/nspcc-dev/neofs-api-go v1.22.2/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
|
||||
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=
|
||||
|
|
Loading…
Reference in a new issue