graphql-python / graphql-python/graphene

Request-level middleware

Abierto
#1,117 4 comentarios 5 reacciones 1 asignado Reclamado por @erikwrede Ver en GitHub
wontfix
Lenguaje dominante
Python
Estrellas
8.2k
Forks
818
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I'm using Graphene with Django, and I have a middleware that checks user auth token. I'm having an issue with the middleware being executed at the field-level. Each field resolution triggers a call to check user's token in my case.

Any suggestions to improve this? Any plans for supporting request-level middleware?

I have some idea:
1. Move auth checking into a Django middleware, but that means any exception raised will not be serialized into GraphQLResponse.
2. Add a flag `is_authenticated` into `info.context` object, if the value of `info.context.is_authenticated` is True, skip the middleware by calling `next()`

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.