Add GraphQLContextHolder like SecurityContextHolder? #1140
Labels
status: waiting-for-feedback
We need additional information before we can continue
status: waiting-for-triage
An issue we've not yet triaged
It appears there's no way to access GraphQLContext other than inject it into a resolver method argument like so:
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 aThreadLocal
. 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?The text was updated successfully, but these errors were encountered: