Fix authorization for paths that previously used basic auth or any other kind of auth
parent
a771d49b33
commit
503cc79758
7
auth.go
7
auth.go
|
@ -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
2318
rice-box.go
2318
rice-box.go
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue