-
In my Spring WebFlux app I use spring security with OAuth2:
Note: I added a GraphQLContextFactory:
For any query I get the context injected:
But for subscriptions no context will be injected:
Currently I get a class cast exception, but this is just another bug due to no context was found in mono's subscriber context and the wrong default context will be injected (see #945). Removing the AuthenticatedGraphQLContext parameter, the subscription-handler will be called without any issue. In my application, the debug log of the GraphQLContextFactory will correctly print out the security context for '/graphql' requests, as well as for '/subscription' requests. But on the way from the Just to compare with the examples: Recently I added a new test Just for debugging I modified
For the examples I got In my application I guess that during the protocol upgrade to the web socket connection, the context gets lost. I prefer a spring security configuration, that blocks requests for a web socket connection before handshake over sending a token as payload after handshake. That is the reason why I use query params method. And since the Does anyone knows any solution how to get the security context / graphql context to the handlers? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This seems to be an issue with dependencies Working Example for whom it may be helpful: |
Beta Was this translation helpful? Give feedback.
This seems to be an issue with dependencies
Working Example for whom it may be helpful:
react-graphql-webflux-keycloak.zip