-
Notifications
You must be signed in to change notification settings - Fork 323
Description
It appears there's no way to access GraphQLContext other than inject it into a resolver method argument like so:
@QueryMaping
fun myQuery(context: GraphQLContext)...
And then we must pass it around in all the downstream methods so that they can access it. Spring Security has the same problem of accessing the current user information from JWT and they have SecurityContextHolder
(https://docs.spring.io/spring-security/reference/servlet/authentication/architecture.html#servlet-authentication-securitycontextholder) which simply stores all the context in a ThreadLocal
. And they have something else for reactive context too.
Why don't we do the same for graphql context? I feel like it's inconvenient to pass it around, it should be doable to just store it in a thread local?
Or perhaps we could add the whole DataFetchingEnvironment
in a thread local?