Skip to content

Commit fd4fdae

Browse files
committed
implement HttpClient for OAuthSession
1 parent fcf622f commit fd4fdae

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

atrium-oauth/oauth-client/src/oauth_session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ where
6666
{
6767
async fn send_http(
6868
&self,
69-
_request: Request<Vec<u8>>,
69+
request: Request<Vec<u8>>,
7070
) -> Result<Response<Vec<u8>>, Box<dyn std::error::Error + Send + Sync + 'static>> {
71-
todo!()
71+
self.server.send_http(request).await
7272
}
7373
}
7474

atrium-oauth/oauth-client/src/server_agent.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::types::{
1111
use crate::utils::{compare_algos, generate_nonce};
1212
use atrium_api::types::string::Datetime;
1313
use atrium_identity::{did::DidResolver, handle::HandleResolver};
14-
use atrium_xrpc::http::{Method, Request, StatusCode};
14+
use atrium_xrpc::http::{Method, Request, Response, StatusCode};
1515
use atrium_xrpc::HttpClient;
1616
use chrono::{TimeDelta, Utc};
1717
use jose_jwk::Key;
@@ -314,3 +314,18 @@ where
314314
}
315315
}
316316
}
317+
318+
impl<T, D, H> HttpClient for OAuthServerAgent<T, D, H>
319+
where
320+
T: HttpClient + Send + Sync + 'static,
321+
D: DidResolver + Send + Sync + 'static,
322+
H: HandleResolver + Send + Sync + 'static,
323+
{
324+
async fn send_http(
325+
&self,
326+
request: Request<Vec<u8>>,
327+
) -> core::result::Result<Response<Vec<u8>>, Box<dyn std::error::Error + Send + Sync + 'static>>
328+
{
329+
self.dpop_client.send_http(request).await
330+
}
331+
}

0 commit comments

Comments
 (0)