Skip to content

Commit

Permalink
move to the top
Browse files Browse the repository at this point in the history
  • Loading branch information
klaidliadon committed Oct 31, 2024
1 parent a735f66 commit 12fa5d2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ func Session[T any](cfg Options[T]) func(next http.Handler) http.Handler {
return
}

serviceClaim, _ := claims["service"].(string)
accountClaim, _ := claims["account"].(string)
adminClaim, _ := claims["admin"].(bool)
projectClaim, _ := claims["project"].(float64)

// Origin check
if originClaim, _ := claims["ogn"].(string); originClaim != "" {
originClaim = strings.TrimSuffix(originClaim, "/")
originHeader := strings.TrimSuffix(r.Header.Get("Origin"), "/")
Expand All @@ -103,6 +97,11 @@ func Session[T any](cfg Options[T]) func(next http.Handler) http.Handler {
}
}

serviceClaim, _ := claims["service"].(string)
accountClaim, _ := claims["account"].(string)
adminClaim, _ := claims["admin"].(bool)
projectClaim, _ := claims["project"].(float64)

switch {
case serviceClaim != "":
ctx = WithService(ctx, serviceClaim)
Expand Down

0 comments on commit 12fa5d2

Please sign in to comment.