Remove auth token query param fallback
This commit is contained in:
parent
5467bd4f01
commit
c10615a164
1 changed files with 1 additions and 7 deletions
8
admin.go
8
admin.go
|
|
@ -10,13 +10,7 @@ import (
|
||||||
|
|
||||||
func adminAuth(token string, next http.Handler) http.Handler {
|
func adminAuth(token string, next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
auth := r.Header.Get("Authorization")
|
if r.Header.Get("Authorization") == "Bearer "+token {
|
||||||
if auth == "Bearer "+token {
|
|
||||||
next.ServeHTTP(w, r)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// For the HTML page, allow token via query param so it can be bookmarked
|
|
||||||
if r.URL.Query().Get("token") == token {
|
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue