Skip to content

Commit

Permalink
feat(auth): add log to whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
hunshenshi committed May 16, 2024
1 parent f9e0389 commit 1dfac7c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions auth/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package auth

import (
"context"
"log"
"net/http"
"strings"

Expand All @@ -20,6 +21,7 @@ var JWTTokenMiddleware = func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
api := r.URL.Path[strings.LastIndex(r.URL.Path, "/")+1:]
for _, a := range whitelistAPI {
log.Println("whitelistAPI " + a)
if strings.EqualFold(a, api) {
ctx := context.WithValue(r.Context(), WhitelistCtxKey, true)
h.ServeHTTP(w, r.WithContext(ctx))
Expand Down

0 comments on commit 1dfac7c

Please sign in to comment.