diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-24 17:00:35 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-24 17:00:35 -0600 |
| commit | 2a819759f6a4c515c5cac3c3317e3e6ec091dc0b (patch) | |
| tree | cb66161c1d33c9e59e7976b0875c033a774aaf98 /app/controllers/dashboard | |
| parent | 072a554f7fa5c4ce1d7e5bcc389ffb3e4640d198 (diff) | |
feat: connect require user middleware to dashboard controller
Diffstat (limited to 'app/controllers/dashboard')
| -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) { |
