Fix authorization for paths that previously used basic auth or any other kind of auth

pull/157/head
Henrique Dias 2017-07-22 13:46:21 +01:00
parent a771d49b33
commit 503cc79758
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
3 changed files with 6 additions and 2388 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"math/rand"
"net/http"
"strings"
"time"
"golang.org/x/crypto/bcrypt"
@ -92,7 +93,11 @@ type extractor []string
func (e extractor) ExtractToken(r *http.Request) (string, error) {
token, _ := request.AuthorizationHeaderExtractor.ExtractToken(r)
if token != "" {
// Checks if the token isn't empty and if it contains three dots.
// The former prevents incompatibility with URLs that previously
// used basic auth.
if token != "" && strings.Count(token, ".") == 3 {
return token, nil
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long