mod common;
#[cfg(all(feature = "persistence", not(target_arch = "wasm32")))]
pub(crate) mod persistence;
#[cfg(all(feature = "browser", target_arch = "wasm32"))]
pub(crate) mod browser;
#[cfg(not(target_arch = "wasm32"))]
mod native;
use crate::error::StdbAuthError;
use crate::session::StdbAuthSessionParts;
#[derive(Clone, Debug, Default)]
pub enum StdbOidcPrompt {
#[default]
None,
Login,
SelectAccount,
}
impl StdbOidcPrompt {
fn as_param(&self) -> Option<&'static str> {
match self {
Self::None => None,
Self::Login => Some("login"),
Self::SelectAccount => Some("select_account"),
}
}
}
#[derive(Clone, Debug)]
pub struct StdbOidcAuthOptions {
pub client_id: String,
pub redirect_uri: String,
pub post_logout_redirect_uri: Option<String>,
pub scopes: Vec<String>,
pub prompt: StdbOidcPrompt,
}
#[cfg(all(feature = "browser", target_arch = "wasm32"))]
pub(crate) async fn acquire_session(
options: StdbOidcAuthOptions,
) -> Result<StdbAuthSessionParts, StdbAuthError> {
browser::acquire_session(options).await
}
#[cfg(not(target_arch = "wasm32"))]
pub(crate) async fn acquire_session(
options: StdbOidcAuthOptions,
) -> Result<StdbAuthSessionParts, StdbAuthError> {
native::acquire_session(options).await
}