Open tuanlt2 opened 3 years ago
@tuanlt2 take a look at the GraphQLExecutionInputCustomizer interface.
@tuanlt2 please check jwt-security
example: https://github.com/micronaut-projects/micronaut-graphql/tree/master/examples/jwt-security.
It uses custom GraphQLExecutionInputCustomizer
implementation: https://github.com/micronaut-projects/micronaut-graphql/blob/bb9004086874f450e7f7502a3c16107c0346b7ae/examples/jwt-security/src/main/java/example/graphql/RequestResponseCustomizer.java
And after that inside the resolver, you can get the request object from the context: https://github.com/micronaut-projects/micronaut-graphql/blob/766cccb3b5f70d0ba0f6728014146138151f621c/examples/jwt-security/src/main/java/example/graphql/LoginDataFetcher.java#L86
I am using Micronaut GraphQL with Kickstart tool (https://github.com/graphql-java-kickstart/graphql-java-tools). How can I get HTTP request headers in GraphQL resolvers?