Skip to content

Commit

Permalink
chore: fix issue 84 and use EqualFold
Browse files Browse the repository at this point in the history
  • Loading branch information
shaj13 committed Feb 27, 2021
1 parent b4513b3 commit c9e7002
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion auth/strategies/digest/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (h Header) WWWAuthenticate() string {
func (h Header) Compare(ch Header) error {
for k, v := range h {
cv := ch[k]
if cv != v {
if !strings.EqualFold(cv, v) {
return fmt.Errorf("strategies/digest: %s Does not match value in provided header", k)
}
}
Expand Down
5 changes: 5 additions & 0 deletions auth/strategies/digest/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ func TestCompare(t *testing.T) {
clientHeader string
expectedErr bool
}{
{
serverHeader: `Digest algorithm="md5"`,
clientHeader: `Digest algorithm="MD5"`,
expectedErr: false,
},
{
serverHeader: `Digest username="a", realm="t", nonce="1", uri="/", cnonce="1=", nc=00000001, qop=auth, response="22cf307b29e6318dafba1fc1d564fc12", opaque="1"`,
clientHeader: `Digest username="a", realm="t", nonce="1", uri="/", cnonce="1=", nc=00000001, qop=auth, response="22cf307b29e6318dafba1fc1d564fc12", opaque="1"`,
Expand Down

0 comments on commit c9e7002

Please sign in to comment.