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

Add authorization for http and websocket #829

Merged
merged 10 commits into from Jan 27, 2022
Merged

Conversation

th4s
Copy link
Contributor

@th4s th4s commented Jan 25, 2022

Summary

This pull request adds basic and bearer authentication for http and non-wasm websockets transport.

Motivation

Some people operate their node behind a reverse-proxy which uses some form of authentication. This pull request makes it possible to use ethers-rs in this case.

Solution

The solution is to inject auth headers into http requests and the websocket handshake request.

PR Checklist

  • Added Tests (Is that necessary in this, case? If yes, how would you do that?
  • Added Documentation
  • Updated the changelog

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for this,
some suggestions and few nits

ethers-providers/src/transports/http.rs Outdated Show resolved Hide resolved
ethers-providers/src/transports/http.rs Outdated Show resolved Hide resolved
ethers-providers/src/transports/ws.rs Show resolved Hide resolved
ethers-providers/src/transports/ws.rs Outdated Show resolved Hide resolved
ethers-providers/src/transports/ws.rs Outdated Show resolved Hide resolved
ethers-providers/src/transports/common.rs Outdated Show resolved Hide resolved
ethers-providers/src/transports/common.rs Outdated Show resolved Hide resolved
ethers-providers/src/transports/common.rs Outdated Show resolved Hide resolved
@th4s
Copy link
Contributor Author

th4s commented Jan 26, 2022

Thanks for your feedback!

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last nit but lgtm!

@th4s
Copy link
Contributor Author

th4s commented Jan 26, 2022

Thanks a lot!

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice

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

Successfully merging this pull request may close these issues.

None yet

3 participants