package middleware import ( "net/http" "github.com/gin-gonic/gin" ) func AuthProxy() gin.HandlerFunc { return func(c *gin.Context) { userID := c.GetHeader("X-User-Id") userRole := c.GetHeader("X-User-Role") if userID == "" { c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "unauthorized"}) return } c.Set("userID", userID) c.Set("userRole", userRole) c.Next() } }