Skip to content

Add GraphQLContextHolder like SecurityContextHolder? #1140

@Sam-Kruglov

Description

@Sam-Kruglov

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions