summaryrefslogtreecommitdiff
path: root/pkg/webui/routes.go
diff options
context:
space:
mode:
authorJulien Dessaux2025-01-06 00:41:32 +0100
committerJulien Dessaux2025-01-06 00:41:32 +0100
commit6e069484cb0a911ba541e07bf04331fadbb76612 (patch)
tree3457c759d54ae91e5ac1e64fe0bbf9c4b8ac18f0 /pkg/webui/routes.go
parentfeat(tfstated): add syscall.SIGTERM handling (diff)
downloadtfstated-6e069484cb0a911ba541e07bf04331fadbb76612.tar.gz
tfstated-6e069484cb0a911ba541e07bf04331fadbb76612.tar.bz2
tfstated-6e069484cb0a911ba541e07bf04331fadbb76612.zip
feat(webui): bootstrap session handling and login process
Diffstat (limited to '')
-rw-r--r--pkg/webui/routes.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/webui/routes.go b/pkg/webui/routes.go
index ef16040..5cf31c0 100644
--- a/pkg/webui/routes.go
+++ b/pkg/webui/routes.go
@@ -10,5 +10,11 @@ func addRoutes(
mux *http.ServeMux,
db *database.DB,
) {
+ session := sessionsMiddleware(db)
+ requireLogin := loginMiddleware(db)
mux.Handle("GET /healthz", handleHealthz())
+ mux.Handle("GET /login", session(handleLoginGET()))
+ mux.Handle("POST /login", session(handleLoginPOST(db)))
+ mux.Handle("GET /static/", cache(http.FileServer(http.FS(staticFS))))
+ mux.Handle("GET /", session(requireLogin(handleIndexGET())))
}