Skip to content

Commit

Permalink
refactor: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
DOOduneye committed Apr 25, 2024
1 parent 378f0e6 commit 0c76214
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
29 changes: 0 additions & 29 deletions backend/middleware/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@ import (
"github.com/gofiber/fiber/v2/middleware/limiter"
)

// func getExcludedPaths() []map[string]string {
// return []map[string]string{
// {"/api/v1/users/": "POST"},
// {"/api/v1/auth/login": "POST"},
// {"/api/v1/auth/logout": "POST"},
// {"/api/v1/auth/refresh": "POST"},
// {"/api/v1/auth/send-code/": "POST"},
// {"/api/v1/auth/verify-email": "POST"},
// {"/api/v1/auth/verify-reset": "POST"},
// {"/api/v1/auth/forgot-password": "POST"},
// }
// }

func (m *AuthMiddlewareService) IsSuper(c *fiber.Ctx) bool {
claims, err := auth.From(c)
if err != nil {
Expand Down Expand Up @@ -57,22 +44,6 @@ func GetAuthroizationToken(c *fiber.Ctx) *string {
}

func (m *AuthMiddlewareService) Authenticate(c *fiber.Ctx) error {
// for _, excludedPath := range getExcludedPaths() {
// for path, method := range excludedPath {
// if c.Path() == path && c.Method() == method {
// return c.Next()
// }
// }
// }

// if c.Method() == "OPTIONS" {
// return c.Next()
// }
// if a get request but not /api/v1/users/ or /api/v1/users/me
// if c.Method() == "GET" && c.Path() != "/api/v1/users/" && c.Path() != "/api/v1/users/me" {
// return c.Next()
// }

accessToken := GetAuthroizationToken(c)
if accessToken == nil {
return errors.Unauthorized.FiberError(c)
Expand Down
1 change: 0 additions & 1 deletion backend/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func Init(db *gorm.DB, integrations integrations.Integrations, settings config.S
authMiddleware := middleware.NewAuthAuthMiddlewareService(db, validate, settings.Auth)

apiv1 := app.Group("/api/v1")
// apiv1.Use(authMiddleware.Authenticate)

routeParams := types.RouteParams{
Router: apiv1,
Expand Down

0 comments on commit 0c76214

Please sign in to comment.