satellite/console: bug fix for using a API key to retrieve a session
Change-Id: I0202f75fb78f42af9e7cb00bb3ac73839340c977
This commit is contained in:
parent
75d10fe4fa
commit
f87772a0d3
@ -132,14 +132,13 @@ func (a *Auth) TokenByAPIKey(w http.ResponseWriter, r *http.Request) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
authToken := r.Header.Get("Authorization")
|
||||
split := strings.Split(authToken, "Bearer ")
|
||||
if len(split) != 2 {
|
||||
if !(strings.HasPrefix(authToken, "Bearer ")) {
|
||||
a.log.Info("authorization key format is incorrect. Should be 'Bearer <key>'")
|
||||
a.serveJSONError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
apiKey := split[1]
|
||||
apiKey := strings.TrimPrefix(authToken, "Bearer ")
|
||||
|
||||
userAgent := r.UserAgent()
|
||||
ip, err := web.GetRequestIP(r)
|
||||
|
Loading…
Reference in New Issue
Block a user