2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-11 13:11:12 +00:00

lsat: change WWW-Authenticate header format

To be compliant with RFC 7235 section 4.1 we change the format of the
WWW-Authenticate header field to double quoted and comma separated
fields.
This commit is contained in:
Oliver Gugger 2020-01-07 15:41:40 +01:00
parent 5e00ce6267
commit bbc829585f
No known key found for this signature in database
GPG Key ID: 8E4256593F177720
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ var (
// authHeaderRegex is the regular expression the payment challenge must // authHeaderRegex is the regular expression the payment challenge must
// match for us to be able to parse the macaroon and invoice. // match for us to be able to parse the macaroon and invoice.
authHeaderRegex = regexp.MustCompile( authHeaderRegex = regexp.MustCompile(
"LSAT macaroon='(.*?)' invoice='(.*?)'", "LSAT macaroon=\"(.*?)\", invoice=\"(.*?)\"",
) )
) )

View File

@ -324,6 +324,6 @@ func makeAuthHeader(macBytes []byte) string {
"3l2ahrqsfpp3x9et2e20v6pu37c5d9vax37wxq72un98k6vcx9fz94w0qf23" + "3l2ahrqsfpp3x9et2e20v6pu37c5d9vax37wxq72un98k6vcx9fz94w0qf23" +
"7cm2rqv9pmn5lnexfvf5579slr4zq3u8kmczecytdx0xg9rwzngp7e6guwqp" + "7cm2rqv9pmn5lnexfvf5579slr4zq3u8kmczecytdx0xg9rwzngp7e6guwqp" +
"qlhssu04sucpnz4axcv2dstmknqq6jsk2l" "qlhssu04sucpnz4axcv2dstmknqq6jsk2l"
return fmt.Sprintf("LSAT macaroon='%s' invoice='%s'", return fmt.Sprintf("LSAT macaroon=\"%s\", invoice=\"%s\"",
base64.StdEncoding.EncodeToString(macBytes), invoice) base64.StdEncoding.EncodeToString(macBytes), invoice)
} }