Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Use the Sign header instead of Authorization: Sign
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusor committed Dec 3, 2022
1 parent 62a0925 commit 3647b4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type Signer struct {
headers []string
}

// NewSigner contructs a signer with the specified key id, key, algorithm,
// NewSigner constructs a signer with the specified key id, key, algorithm,
// and headers to sign. By default, if headers is nil or empty, the
// request-target and date headers will be signed.
func NewSigner(id string, key interface{}, algo Algorithm, headers []string) (
Expand Down Expand Up @@ -88,11 +88,11 @@ func (r *Signer) Sign(req *http.Request) error {
return err
}

req.Header.Set("Authorization", "Signature "+params)
req.Header.Set("Signature", params)
return nil
}

// signRequest signs an http request and returns the parameter string.
// signRequest signs an HTTP request and returns the parameter string.
func signRequest(id string, key interface{}, algo Algorithm, headers []string, created, expires time.Time, req *http.Request) (params string, err error) {
signatureData, err := BuildSignatureData(req, headers, created, expires)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type Params struct {
}

func getParamsFromAuthHeader(req *http.Request) *Params {
return getParams(req, "Authorization", "Signature ")
return getParams(req, "Signature", "")
}

func getParams(req *http.Request, header, prefix string) *Params {
Expand Down

0 comments on commit 3647b4d

Please sign in to comment.