use crate::client::auth::{AuthOptionResolver, AuthOptionResolverParams, AuthSchemeId};
use crate::client::orchestrator::BoxError;
use std::borrow::Cow;
#[derive(Debug)]
pub struct StaticAuthOptionResolver {
auth_options: Vec<AuthSchemeId>,
}
impl StaticAuthOptionResolver {
pub fn new(auth_options: Vec<AuthSchemeId>) -> Self {
Self { auth_options }
}
}
impl AuthOptionResolver for StaticAuthOptionResolver {
fn resolve_auth_options(
&self,
_params: &AuthOptionResolverParams,
) -> Result<Cow<'_, [AuthSchemeId]>, BoxError> {
Ok(Cow::Borrowed(&self.auth_options))
}
}
#[derive(Debug)]
pub struct StaticAuthOptionResolverParams;
impl StaticAuthOptionResolverParams {
pub fn new() -> Self {
Self
}
}
impl From<StaticAuthOptionResolverParams> for AuthOptionResolverParams {
fn from(params: StaticAuthOptionResolverParams) -> Self {
AuthOptionResolverParams::new(params)
}
}