diff options
| -rw-r--r-- | app/controllers/dashboard/controller.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go index 02238bb..8f5105d 100644 --- a/app/controllers/dashboard/controller.go +++ b/app/controllers/dashboard/controller.go @@ -7,6 +7,7 @@ import ( "github.com/xlgmokha/x/pkg/x" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/views" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/key" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web/middleware" ) type Controller struct { @@ -17,7 +18,9 @@ func New() *Controller { } func (c *Controller) MountTo(mux *http.ServeMux) { - mux.HandleFunc("GET /dashboard", c.Show) + requireUser := middleware.RequireUser(http.StatusFound, "/") + + mux.Handle("GET /dashboard", requireUser(http.HandlerFunc(c.Show))) } func (c *Controller) Show(w http.ResponseWriter, r *http.Request) { |
