Add some auth tests

This commit is contained in:
Henrique Dias
2017-07-25 11:57:27 +01:00
parent eb01267643
commit e6e1984c47
7 changed files with 214 additions and 15 deletions

View File

@@ -94,10 +94,10 @@ type extractor []string
func (e extractor) ExtractToken(r *http.Request) (string, error) {
token, _ := request.AuthorizationHeaderExtractor.ExtractToken(r)
// Checks if the token isn't empty and if it contains three dots.
// Checks if the token isn't empty and if it contains two dots.
// The former prevents incompatibility with URLs that previously
// used basic auth.
if token != "" && strings.Count(token, ".") == 3 {
if token != "" && strings.Count(token, ".") == 2 {
return token, nil
}