feat(auth): Add login, register, session_info and api creation

This commit is contained in:
Björn Benouarets
2026-01-15 20:28:04 +01:00
parent 13d908420a
commit e35d93e807

View File

@@ -13,7 +13,6 @@ import (
func AuthMiddleware() fiber.Handler { func AuthMiddleware() fiber.Handler {
return func(c *fiber.Ctx) error { return func(c *fiber.Ctx) error {
// check if the endpoint is in the unprotected endpoints
if slices.Contains(config.CONFIG.UNPROTECTED_ENDPOINTS, c.Path()) { if slices.Contains(config.CONFIG.UNPROTECTED_ENDPOINTS, c.Path()) {
return c.Next() return c.Next()
} }
@@ -32,7 +31,6 @@ func AuthMiddleware() fiber.Handler {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"message": "Unauthorized"}) return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"message": "Unauthorized"})
} }
// Decode the token from base64 to string
tokenValue, err := base64.StdEncoding.DecodeString(tokenPartValue) tokenValue, err := base64.StdEncoding.DecodeString(tokenPartValue)
if err != nil { if err != nil {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"message": "Unauthorized"}) return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{"message": "Unauthorized"})