Skip to content

Commit

Permalink
Merge pull request #3 from blang/fix_credentialdecode
Browse files Browse the repository at this point in the history
Fix credential decode index out of range
  • Loading branch information
elithrar committed Jun 4, 2014
2 parents d334795 + 68b26a1 commit 109e740
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions basic_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func (b *basicAuth) authenticate(r *http.Request) bool {
// allowable characters in the password.
creds := strings.SplitN(string(str), ":", 2)

if len(creds) != 2 {
return false
}

// Compare the supplied credentials to those set in our options
if creds[0] == b.opts.User && creds[1] == b.opts.Password {
return true
Expand Down

0 comments on commit 109e740

Please sign in to comment.