Also allow Bearer token
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f9171c178e
commit
67d658d1ba
2
main.go
2
main.go
|
@ -1074,7 +1074,7 @@ func main() {
|
||||||
func wrapAuth(handler http.HandlerFunc) http.HandlerFunc {
|
func wrapAuth(handler http.HandlerFunc) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
auth := r.Header.Get("Authorization")
|
auth := r.Header.Get("Authorization")
|
||||||
if auth == "" || (authToken != "" && auth == "Token "+authToken) {
|
if auth == "" || (authToken != "" && (auth == "Token "+authToken || auth == "Bearer "+authToken)) {
|
||||||
r = r.WithContext(context.WithValue(r.Context(), authKey, auth != ""))
|
r = r.WithContext(context.WithValue(r.Context(), authKey, auth != ""))
|
||||||
// auth == "", require cookie in handler
|
// auth == "", require cookie in handler
|
||||||
handler.ServeHTTP(w, r)
|
handler.ServeHTTP(w, r)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user