Skip to main content

ServerCommunicationConfigClient

Struct ServerCommunicationConfigClient 

Source
pub struct ServerCommunicationConfigClient<R, P>{
    repository: R,
    platform_api: P,
}
Expand description

Server communication configuration client

Fields§

§repository: R§platform_api: P

Implementations§

Source§

impl<R, P> ServerCommunicationConfigClient<R, P>

Source

pub fn new(repository: R, platform_api: P) -> Self

Creates a new server communication configuration client

§Arguments
  • repository - Cookie storage implementation (e.g a StateProvider hook)
  • platform_api - Cookie acquistion implementation
Source

pub async fn get_config( &self, domain: String, ) -> Result<ServerCommunicationConfig, R::GetError>

Retrieves the server communication configuration for a domain

Source

pub async fn needs_bootstrap(&self, domain: String) -> bool

Returns whether this domain uses cookie bootstrapping

Returns true if the domain has an SsoCookieVendor configuration, regardless of whether cookies have already been acquired. This is useful for determining if the domain requires the bootstrap flow (e.g., to show appropriate UI), without making claims about cookie validity.

Source

pub async fn cookies(&self, domain: String) -> Vec<(String, String)>

👎Deprecated: Use get_cookies() instead, which will acquire cookies if not present in the config

Returns cookies to include in HTTP requests

Returns the stored cookies as-is. For sharded cookies, each entry includes the full cookie name with its -{N} suffix (e.g., AWSELBAuthSessionCookie-0).

Source

pub async fn get_cookies( &self, domain: String, ) -> Result<Vec<AcquiredCookie>, AcquireCookieError>

Returns cookies to include in HTTP requests. For sharded cookies, each entry includes the full cookie name with its -{N} suffix (e.g., AWSELBAuthSessionCookie-0).

  • If the configuration is not found or is Direct, returns an empty vector.
  • If the configuration is SsoCookieVendor but has no acquired cookies, it will acquire them using the platform API and return the acquired cookies.
Source

pub async fn set_communication_type( &self, domain: String, request: SetCommunicationTypeRequest, ) -> Result<(), R::SaveError>

👎Deprecated: Use set_communication_type_v2() instead, which extracts the domain from the config

Sets the server communication configuration for a domain

This method saves the provided communication configuration to the repository. Typically called when receiving the /api/config response from the server.

The request type intentionally excludes cookie_value, since cookies are managed separately via Self::acquire_cookie. Any previously acquired cookies stored in the repository are preserved across calls to this method.

§Arguments
  • domain - The server domain (e.g., “vault.acme.com”)
  • request - The server communication configuration to store
§Errors

Returns an error if the repository save operation fails

Source

pub async fn set_communication_type_v2( &self, request: SetCommunicationTypeRequest, ) -> Result<(), R::SaveError>

Sets the server communication configuration using the domain from the config itself

Extracts the cookie_domain from the SsoCookieVendor config and uses it as the storage key. If the config is Direct, the call is silently ignored.

Typically called when receiving the /api/config response from the server.

§Arguments
  • config - The server communication configuration to store
§Errors

Returns an error if the repository save operation fails

Acquires a cookie from the platform and saves it to the repository

This method calls the platform API to trigger cookie acquisition (e.g., browser redirect to IdP), then validates and stores the acquired cookie in the repository.

§Arguments
  • domain - The server domain (e.g., “vault.acme.com”)
§Errors

Returns an error if:

Trait Implementations§

Source§

impl<R, P> CookieProvider for ServerCommunicationConfigClient<R, P>

Source§

fn cookies<'life0, 'life1, 'async_trait>( &'life0 self, hostname: &'life1 str, ) -> Pin<Box<dyn Future<Output = Vec<(String, String)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns stored cookies for the given hostname as name-value pairs. Read more
Acquires a fresh cookie from the platform and stores it for the given hostname. Read more
Source§

fn needs_bootstrap<'life0, 'life1, 'async_trait>( &'life0 self, hostname: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns true if the hostname requires SSO cookie bootstrapping. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CompatExt for T

§

fn compat(self) -> Compat<T>

Applies the [Compat] adapter by value. Read more
§

fn compat_ref(&self) -> Compat<&T>

Applies the [Compat] adapter by shared reference. Read more
§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the [Compat] adapter by mutable reference. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more