graphql-python / graphql-python/graphene

Request-level middleware

オープン
#1,117 コメント 4 件 リアクション 5 件 担当者 1 名 @erikwrede が担当を希望しています GitHub で見る
wontfix
主要言語
Python
スター
8.2k
フォーク
818
PR マージ指標
30日以内にマージされた PR はありません

説明

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()`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。