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

Commit

Permalink
Merge pull request #265 from Moopli/update-httpsig
Browse files Browse the repository at this point in the history
fix: http signature should sign @method and @target-uri instead of @request-target
  • Loading branch information
rolsonquadras authored Jul 19, 2022
2 parents 46d5e2c + 0a9950b commit 12fd8f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spi/gnap/proof/httpsig/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (s *Signer) Sign(request *http.Request, requestBody []byte) (*http.Request,
func Sign(req *http.Request, bodyBytes []byte, signingKey *jwk.JWK, digestName string) (*http.Request, error) {
conf := httpsign.NewSignConfig().SignAlg(false)

fields := httpsign.Headers("@request-target")
fields := httpsign.Headers("@method", "@target-uri")

if len(bodyBytes) > 0 {
body := ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
Expand Down
2 changes: 1 addition & 1 deletion spi/gnap/proof/httpsig/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewVerifier(req *http.Request) *Verifier {
func (v *Verifier) Verify(key *gnap.ClientKey) error {
verKey := key.JWK

fields := httpsign.Headers("@request-target")
fields := httpsign.Headers("@method", "@target-uri")

if v.req.Header.Get("Authorization") != "" {
fields.AddHeader("Authorization")
Expand Down

0 comments on commit 12fd8f7

Please sign in to comment.