Skip to content
Snippets Groups Projects
Commit c2bd8999 authored by Travis Ralston's avatar Travis Ralston
Browse files

Disable noisy log warning

parent 157ec5d4
No related branches found
No related tags found
No related merge requests found
......@@ -4,22 +4,18 @@ import (
"net/http"
"net/url"
"strings"
"github.com/sirupsen/logrus"
)
func GetAccessTokenFromRequest(request *http.Request) string {
token := request.Header.Get("Authorization")
if token != "" {
if !strings.HasPrefix(token, "Bearer") {
logrus.Warn("Invalid Authorization header observed: expected a Bearer token, got something else")
if !strings.HasPrefix(token, "Bearer ") { // including space
// It's probably an X-Matrix authentication header (federation)
//logrus.Warn("Invalid Authorization header observed: expected a Bearer token, got something else")
return ""
}
if len(token) > 7 {
// "Bearer <token>"
return token[7:]
}
return token[len("Bearer "):] // including space
}
return request.URL.Query().Get("access_token")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment