-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auth-server: Use admin auth to proxy relayer requests
- Loading branch information
Showing
9 changed files
with
454 additions
and
571 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 3 additions & 49 deletions
52
auth/auth-server/src/server/handle_proxy.rs → auth/auth-server/src/server/api_auth.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//! Handler code for proxied relayer requests | ||
//! | ||
//! At a high level the server must first authenticate the request, then forward | ||
//! it to the relayer with admin authentication | ||
|
||
use bytes::Bytes; | ||
use http::Method; | ||
use warp::{reject::Rejection, reply::Reply}; | ||
|
||
use super::Server; | ||
|
||
/// Handle a proxied request | ||
impl Server { | ||
/// Handle an external match request | ||
pub async fn handle_external_match_request( | ||
&self, | ||
path: warp::path::FullPath, | ||
mut headers: warp::hyper::HeaderMap, | ||
body: Bytes, | ||
) -> Result<impl Reply, Rejection> { | ||
// Authorize the request | ||
self.authorize_request(path.as_str(), &mut headers, &body).await?; | ||
|
||
// Send the request to the relayer | ||
let resp = self.send_admin_request(Method::POST, path.as_str(), headers, body).await?; | ||
Ok(resp) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters