Skip to main content

alibi_plugins/oauth_provider/
select_account.rs

1use alibi_core::AuthResult;
2use async_trait::async_trait;
3use std::sync::Arc;
4
5pub type OAuthSelectAccountContext<'a> = super::OAuthInteractionContext<'a>;
6
7/// Additional account selection on initial authorization only, after authentication.
8#[async_trait]
9pub trait OAuthSelectAccountPolicy: Send + Sync + std::fmt::Debug {
10    async fn should_redirect(&self, input: OAuthSelectAccountContext<'_>) -> AuthResult<bool>;
11}
12
13#[derive(Debug, Clone)]
14pub struct OAuthSelectAccountConfig {
15    /// Policy redirects fall back to the legacy page, then the login page.
16    /// Explicit `prompt=select_account` requires a nonempty selection page.
17    pub page: Option<String>,
18    pub should_redirect: Arc<dyn OAuthSelectAccountPolicy>,
19}