graphql-transport-ws
graphql-transport-ws copied to clipboard
Flexible Authentication Hook
According to Apollo Authentication Over WebsSocket spec (i.e. https://www.apollographql.com/docs/graphql-subscriptions/authentication) the authentication credentials shall be passed in the connection_init message payload as authToken.
In order to support this - and - more flexible authentication / authorization schemes which may require inspection of HTTP request headers in addition of the message payload, we add this optional onConnect hook.
@fproulx-dfuse could you, please, use the opts to provide the authFunc as an option?
Also, the code needs to be rebased.
@fproulx-dfuse I just figured out that you can use a custom ContextGenerator and use it to access the request and its headers and store the auth info in the current context.
any progress on this? @fproulx-dfuse @pavelnikolov maybe someone can take this PR over & finish it?
@tot-ra contributions would be accepted. This PR is not in a mergeable state.