Skip to content

Commit

Permalink
move var in if
Browse files Browse the repository at this point in the history
  • Loading branch information
klaidliadon committed Oct 31, 2024
1 parent fb666ce commit a735f66
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ func Session[T any](cfg Options[T]) func(next http.Handler) http.Handler {
accountClaim, _ := claims["account"].(string)
adminClaim, _ := claims["admin"].(bool)
projectClaim, _ := claims["project"].(float64)
originClaim, _ := claims["ogn"].(string)

// Origin check
if originClaim != "" {
if originClaim, _ := claims["ogn"].(string); originClaim != "" {
originClaim = strings.TrimSuffix(originClaim, "/")
originHeader := strings.TrimSuffix(r.Header.Get("Origin"), "/")
if originHeader != "" && originHeader != originClaim {
Expand Down

0 comments on commit a735f66

Please sign in to comment.