graphql-transport-ws icon indicating copy to clipboard operation
graphql-transport-ws copied to clipboard

Flexible Authentication Hook

Open fproulx-dfuse opened this issue 6 years ago • 5 comments

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 avatar Apr 02 '19 20:04 fproulx-dfuse

@fproulx-dfuse could you, please, use the opts to provide the authFunc as an option?

pavelnikolov avatar Apr 05 '21 20:04 pavelnikolov

Also, the code needs to be rebased.

pavelnikolov avatar Apr 13 '21 06:04 pavelnikolov

@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.

pavelnikolov avatar Apr 14 '21 23:04 pavelnikolov

any progress on this? @fproulx-dfuse @pavelnikolov maybe someone can take this PR over & finish it?

tot-ra avatar Jun 09 '21 07:06 tot-ra

@tot-ra contributions would be accepted. This PR is not in a mergeable state.

pavelnikolov avatar Jun 09 '21 11:06 pavelnikolov