Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Neptune IAM authentication #152

Open
copumpkin opened this issue Mar 11, 2022 · 4 comments
Open

AWS Neptune IAM authentication #152

copumpkin opened this issue Mar 11, 2022 · 4 comments

Comments

@copumpkin
Copy link

I'm looking into using this package with AWS Neptune and its IAM Authentication feature. Based on their sample code and asking around, my understanding is that for this to work, I'd need to use sigv4 to sign the initial WebSocket connection request.

It seems like the place I'd need to hook into is

let (client, _) = { connect_async_with_tls_connector(url, tls::connector(&opts)).await? };
, to pass an extra authentication header to tungstenite when it opens the websocket connection.

Does that all sound reasonable? It doesn't seem like the interface is flexible enough today for me to inject that in, since I'd need a Request rather than the Url that code currently passes in. I'd be happy to make a PR to add an optional feature for this if someone can confirm I'm looking in the right places.

@u382514
Copy link

u382514 commented Mar 28, 2022

You have the right idea. It would probably be as easy as adding 'custom_headers' to the options and passing that down the chain to build out a Request rather than a simple Url. We should probably change the title of this issue to "Allow Custom Headers" since sigv4 are just added headers and make the developer do the work at creating those headers outside of this package. Also this would allow any other custom header that may be needed in the future. The logic would also need to account for the synchronous workflow.

@wolf4ood
Copy link
Owner

👋 all if you agree we can close this and follow the additional headers query params on #153

@copumpkin
Copy link
Author

copumpkin commented Apr 12, 2022

I don't think it's as simple as custom headers because the content of the header (a cryptographic signature) is a function of the (hash of the) exact request being sent to the server, which gets modified fairly deep in the websocket lib. On the other hand, I have some code working that I haven't cleaned up yet for PR (and I only added it to the async pathway), but seems to be working on my Neptune instance.

@lyndonbauto
Copy link

@copumpkin custom header injection should allow you to do this. If you inspect other tinkerpop drivers like the gremlin-python driver for example support iam auth through custom header injection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants