proxy: fix wrong applied middleware

Validate signature middleware must be applied for the callback
sub-router, not the whole dashboard router.

Fixes #1297
This commit is contained in:
Cuong Manh Le 2020-08-18 18:08:32 +07:00
parent afec38e5cb
commit 31205c0c29
2 changed files with 17 additions and 1 deletions

View file

@ -45,7 +45,7 @@ func (p *Proxy) registerDashboardHandlers(r *mux.Router) *mux.Router {
// callback used to set route-scoped session and redirect back to destination
// only accept signed requests (hmac) from other trusted pomerium services
c := r.PathPrefix(dashboardPath + "/callback").Subrouter()
h.Use(func(h http.Handler) http.Handler {
c.Use(func(h http.Handler) http.Handler {
return middleware.ValidateSignature(p.state.Load().sharedKey)(h)
})