Skip to content

Commit

Permalink
chore: update skip path to use prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Nov 11, 2024
1 parent c8e676a commit c9a0a6d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions auth/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"
"log/slog"
"slices"
"strings"
"time"

"github.com/flanksource/commons/hash"
Expand Down Expand Up @@ -111,7 +111,12 @@ func Middleware(ctx context.Context, e *echo.Echo) error {

// TODO: Use regex supported path matching
func canSkipAuth(c echo.Context) bool {
return slices.Contains(skipAuthPaths, c.Path())
for _, p := range skipAuthPaths {
if strings.HasPrefix(c.Path(), p) {
return true
}
}
return false
}

func mapIDsToRoles(ctx context.Context, session *client.Session, person models.Person) error {
Expand Down

0 comments on commit c9a0a6d

Please sign in to comment.