feat(auth): Add login, register, session_info and api creation
This commit is contained in:
@@ -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"})
|
||||||
|
|||||||
Reference in New Issue
Block a user