pub trait OAuthProvider:
Send
+ Sync
+ Debug {
// Required methods
fn provider_id(&self) -> &'static str;
fn callback_path(&self) -> &str;
fn authorize_url(
&self,
request: &AuthorizeUrlRequest,
) -> Result<Url, AuthError>;
fn exchange_code<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
code: &'life1 str,
code_verifier: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<ProviderExchange, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn refresh<'life0, 'life1, 'async_trait>(
&'life0 self,
refresh_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<ProviderExchange, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
An upstream identity provider soma-auth can redirect a user to for login.
Implementations: crate::google::GoogleProvider,
crate::authelia::AutheliaProvider, crate::github::GitHubProvider.
AuthState.providers holds a provider_id() -> Arc<dyn OAuthProvider>
map so a deployment can enable more than one simultaneously.
Required Methods§
Sourcefn provider_id(&self) -> &'static str
fn provider_id(&self) -> &'static str
Stable identifier used as the providers map key, the provider
column value persisted in SQLite, and the subject-namespace prefix.
One of "google", "authelia", "github".
Sourcefn callback_path(&self) -> &str
fn callback_path(&self) -> &str
The absolute path (no scheme/host) this provider’s registered
redirect_uri resolves to, e.g. /auth/google/callback. Used by
routes::router to mount one callback route per configured provider.