Application id check in auth middleware

pull/559/head
kompotkot 2022-03-08 14:25:08 +00:00
rodzic 3405f6746f
commit ca5bca10ae
2 zmienionych plików z 5 dodań i 0 usunięć

Wyświetl plik

@ -19,6 +19,7 @@ type NodeStatusResponse struct {
type BugoutUserResponse struct {
ID string `json:"user_id"`
ApplicationID string `json:"application_id"`
}
// Node - which one node client worked with

Wyświetl plik

@ -104,6 +104,10 @@ func authMiddleware(next http.Handler) http.Handler {
http.Error(w, "Wrong authorization header", http.StatusForbidden)
return
}
if userResponse.ApplicationID != configs.BUGOUT_NODE_BALANCER_APPLICATION_ID {
http.Error(w, "Wrong authorization header", http.StatusForbidden)
return
}
next.ServeHTTP(w, r)
})