fix: retry critical writes and allow super login
This commit is contained in:
@@ -62,6 +62,9 @@ func (m *Middlewares) Auth(ctx fiber.Ctx) error {
|
||||
}
|
||||
|
||||
func (m *Middlewares) SuperAuth(ctx fiber.Ctx) error {
|
||||
if isSuperPublicRoute(ctx) {
|
||||
return ctx.Next()
|
||||
}
|
||||
authHeader := ctx.Get("Authorization")
|
||||
if authHeader == "" {
|
||||
return errorx.ErrUnauthorized.WithMsg("Missing token")
|
||||
@@ -130,3 +133,14 @@ func isPublicRoute(ctx fiber.Ctx) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func isSuperPublicRoute(ctx fiber.Ctx) bool {
|
||||
path := ctx.Path()
|
||||
method := ctx.Method()
|
||||
|
||||
if method == fiber.MethodPost && path == "/super/v1/auth/login" {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user