package http import ( "github.com/gin-gonic/gin" "leafdev.top/leaf/rag/consts" "leafdev.top/leaf/rag/internal/logic" "leafdev.top/leaf/rag/internal/providers/helper" "leafdev.top/leaf/rag/models" "net/http" ) func RequireJWTIDToken(c *gin.Context) { auth := logic.NewAuthLogic() user, err := auth.GinMiddlewareAuth(models.JWTIDToken, c) if err != nil { c.Abort() helper.ResponseError(c, http.StatusUnauthorized, err) return } c.Set(consts.AuthMiddlewareKey, user) c.Next() }