summaryrefslogtreecommitdiff
path: root/middleware/auth.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2025-12-19 18:01:24 +0530
committerBobby <[email protected]>2025-12-19 18:01:24 +0530
commitb1bfec1ce2987d9fe0cc52e5ae9115977fdf8c24 (patch)
tree7080b7dc97522ffe0837a1e0b2965489d7e67664 /middleware/auth.go
parent767297e28d47ee9cf3722054e41caa837f0e68d2 (diff)
downloadlain-b1bfec1ce2987d9fe0cc52e5ae9115977fdf8c24.tar.xz
lain-b1bfec1ce2987d9fe0cc52e5ae9115977fdf8c24.zip
added utils, templates, routes, types, middleware, processors and a whole lot of things for a basic login page
Diffstat (limited to 'middleware/auth.go')
-rw-r--r--middleware/auth.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/middleware/auth.go b/middleware/auth.go
new file mode 100644
index 0000000..baa67fb
--- /dev/null
+++ b/middleware/auth.go
@@ -0,0 +1,15 @@
+package middleware
+
+import (
+ "lain/utils/auth"
+ "lain/utils/shortcuts"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func authentication(context *fiber.Ctx) error {
+ if !auth.IsAuthenticated(context) {
+ return shortcuts.Redirect(context, "auth.login")
+ }
+ return context.Next()
+}