5
0
Fork 0

Validate token fields

master
Daniel Lim 2019-07-04 05:19:11 +08:00
parent e64c1988cc
commit b6111a1f44
1 changed files with 5 additions and 0 deletions

View File

@ -87,6 +87,11 @@ func AuthMiddleware(next httprouter.Handle) httprouter.Handle {
return
}
if client.UserId == "" || ClientId == "" {
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
return
}
context := context.WithValue(r.Context(), "user", client)
next(w, r.WithContext(context), p)
}