Skip to content

Commit

Permalink
golangci lint
Browse files Browse the repository at this point in the history
  • Loading branch information
notque committed Jan 2, 2025
1 parent bb9b3d8 commit f9a1060
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/api/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ func getIndexID(token *gopherpolicy.Token, r *http.Request, w http.ResponseWrite
// Fallback to a token domain scope
indexID = token.Context.Auth["domain_id"]
}

// Log and handle the case where neither project_id nor domain_id is found
if indexID == "" {
logg.Debug("Token context: %v", token.Context.Auth) // Log the token context for debugging
logg.Error("Neither project_id nor domain_id found in token context")
http.Error(w, "Unauthorized: Missing project or domain scope", http.StatusUnauthorized)
return "", fmt.Errorf("missing project_id and domain_id in token context")
return "", errors.New("missing project_id and domain_id in token context")
}

// Sanitize user input
Expand Down

0 comments on commit f9a1060

Please sign in to comment.