update comparison script

This commit is contained in:
Matthieu Lamalle 2020-07-21 11:20:06 +02:00
parent 8a8d06cb7c
commit beabe82b50
1 changed files with 1 additions and 2 deletions

View File

@ -259,7 +259,7 @@ var Refresh = func(w http.ResponseWriter, r *http.Request) {
func ValidateToken(w http.ResponseWriter, r *http.Request) (*TokenDetails, error) { func ValidateToken(w http.ResponseWriter, r *http.Request) (*TokenDetails, error) {
var pwd string var pwd string
urltomatch := r.URL.String() urltomatch := r.URL.String()
if urltomatch == "/api/user/refresh" { if strings.Contains(urltomatch, "/api/user/refresh") {
pwd = "refresh_token_password" pwd = "refresh_token_password"
} else { } else {
pwd = "access_token_password" pwd = "access_token_password"
@ -274,7 +274,6 @@ func ValidateToken(w http.ResponseWriter, r *http.Request) (*TokenDetails, error
w.WriteHeader(http.StatusForbidden) w.WriteHeader(http.StatusForbidden)
w.Header().Add("Content-Type", "application/json") w.Header().Add("Content-Type", "application/json")
respond(w, response) respond(w, response)
return tk, errors.New("Missing auth token")
} }
splitted := strings.Split(bearToken, " ") //The token normally comes in format `Bearer {token-body}`, we check if the retrieved token matched this requirement splitted := strings.Split(bearToken, " ") //The token normally comes in format `Bearer {token-body}`, we check if the retrieved token matched this requirement