mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
Fix authorization for paths that previously used basic auth or any other kind of auth
This commit is contained in:
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
Block a user