Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants