pub struct Request {
pub auth_adapter: Arc<dyn AuthAdapter>,
/* private fields */
}Fields§
§auth_adapter: Arc<dyn AuthAdapter>Implementations§
Source§impl Request
impl Request
pub fn new( auth_adapter: Arc<dyn AuthAdapter>, proxy_tokens: Arc<ProxyTokenCache>, ) -> ClResult<Self>
pub async fn create_proxy_token( &self, tn_id: TnId, id_tag: &str, subject: Option<&str>, ) -> ClResult<Box<str>>
pub async fn get_bin( &self, tn_id: TnId, id_tag: &str, path: &str, auth: bool, ) -> ClResult<Bytes>
pub async fn get_stream( &self, tn_id: TnId, id_tag: &str, path: &str, auth: bool, ) -> ClResult<impl AsyncRead + Send + Unpin + use<>>
pub async fn get<Res>(
&self,
tn_id: TnId,
id_tag: &str,
path: &str,
) -> ClResult<Res>where
Res: DeserializeOwned,
pub async fn get_noauth<Res>(
&self,
tn_id: TnId,
id_tag: &str,
path: &str,
) -> ClResult<Res>where
Res: DeserializeOwned,
Sourcepub async fn get_public<Res>(&self, id_tag: &str, path: &str) -> ClResult<Res>where
Res: DeserializeOwned,
pub async fn get_public<Res>(&self, id_tag: &str, path: &str) -> ClResult<Res>where
Res: DeserializeOwned,
Make a public GET request without authentication or tenant context
Sourcepub async fn get_conditional<Res>(
&self,
id_tag: &str,
path: &str,
etag: Option<&str>,
) -> ClResult<ConditionalResult<Res>>where
Res: DeserializeOwned,
pub async fn get_conditional<Res>(
&self,
id_tag: &str,
path: &str,
etag: Option<&str>,
) -> ClResult<ConditionalResult<Res>>where
Res: DeserializeOwned,
Make a conditional GET request with If-None-Match header for etag support
Returns ConditionalResult::NotModified if server returns 304,
or ConditionalResult::Modified with data and new etag if content changed.
Sourcepub async fn post_public<Req, Res>(
&self,
id_tag: &str,
path: &str,
data: &Req,
) -> ClResult<Res>where
Req: Serialize,
Res: DeserializeOwned,
pub async fn post_public<Req, Res>(
&self,
id_tag: &str,
path: &str,
data: &Req,
) -> ClResult<Res>where
Req: Serialize,
Res: DeserializeOwned,
Make a public POST request without authentication or tenant context
Sourcepub async fn post_bin(
&self,
_tn_id: TnId,
id_tag: &str,
path: &str,
data: Bytes,
) -> ClResult<Bytes>
pub async fn post_bin( &self, _tn_id: TnId, id_tag: &str, path: &str, data: Bytes, ) -> ClResult<Bytes>
Unauthenticated POST to a remote tenant.
Callers (e.g. IDP registration/resend, action federation inbox) authenticate
via signed tokens carried in the request body, not via an Authorization
header — tn_id is therefore unused at the transport layer.
Sourcepub async fn post_stream<S>(
&self,
_tn_id: TnId,
id_tag: &str,
path: &str,
stream: S,
) -> ClResult<Bytes>
pub async fn post_stream<S>( &self, _tn_id: TnId, id_tag: &str, path: &str, stream: S, ) -> ClResult<Bytes>
Unauthenticated streaming POST to a remote tenant. See Self::post_bin
for why no Authorization header is attached.
pub async fn post<Res>(
&self,
tn_id: TnId,
id_tag: &str,
path: &str,
data: &impl Serialize,
) -> ClResult<Res>where
Res: DeserializeOwned,
Sourcepub async fn post_json_authed(
&self,
tn_id: TnId,
id_tag: &str,
path: &str,
data: Bytes,
) -> ClResult<Bytes>
pub async fn post_json_authed( &self, tn_id: TnId, id_tag: &str, path: &str, data: Bytes, ) -> ClResult<Bytes>
Authenticated JSON POST to a remote tenant. Mirrors Self::get_bin:
attaches a cached proxy token in the Authorization header and retries
once on 401/403 after invalidating the cached token. Branches on
response status so callers see a typed Error (NotFound / Gone /
PermissionDenied / NetworkError) instead of a downstream JSON-
deserialization failure when the upstream returns an error envelope.
Hard-codes Content-Type: application/json; for binary authed POSTs
add a separate helper that takes an explicit content-type parameter.
Sourcepub async fn post_authed<Res>(
&self,
tn_id: TnId,
id_tag: &str,
path: &str,
data: &impl Serialize,
) -> ClResult<Res>where
Res: DeserializeOwned,
pub async fn post_authed<Res>(
&self,
tn_id: TnId,
id_tag: &str,
path: &str,
data: &impl Serialize,
) -> ClResult<Res>where
Res: DeserializeOwned,
Typed JSON wrapper around Self::post_json_authed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Request
impl !UnwindSafe for Request
impl Freeze for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more