pub async fn load(self, server_name: &str) -> Result<std::sync::Arc<dyn AuthProvider>, String> {
    match self {
      AuthConfiguration::DatabaseOTPs { connection } => crate::auth::db_otp::new(connection),
      AuthConfiguration::LDAP { url, bind_dn, bind_pw, search_base, account_attr } => {
        crate::auth::ldap::new(url, bind_dn, bind_pw, search_base, account_attr).await
      }
      AuthConfiguration::MultipleOpenIdConnect { providers, db_connection, registration } => {
        let mut clients = std::collections::BTreeMap::new();
        for configuration in providers {
          let (client, issuer, name) = create_oidc_client(configuration.provider, configuration.client_id, configuration.client_secret, server_name)?;
          clients.insert(issuer, (name, client));
        }
        db_oidc_multiple::new(db_connection, clients, registration)
      }
      AuthConfiguration::OpenIdConnect { client_id, client_secret, provider, db_connection, registration } => {
        db_oidc::new(db_connection, create_oidc_client(provider, client_id, client_secret, server_name)?.0, registration)
      }
      AuthConfiguration::OTPs { users } => crate::auth::fixed_otp::new(users),
      AuthConfiguration::Passwords { users } => crate::auth::fixed_password::new(users),
      AuthConfiguration::PhpBB { connection, database } => match database {
        AuthDatabase::PostgreSQL => crate::auth::php_bb::new::<diesel::pg::PgConnection, _>(connection),
        #[cfg(feature = "mysql")]
        AuthDatabase::MySQL => crate::auth::php_bb::new::<diesel::mysql::MysqlConnection, _>(connection),
      },
      AuthConfiguration::Uru { connection } => crate::auth::uru::new(connection),
    }
  }
/// Parse the configuration string provided to the server into an authentication provider, if possible
Parse the configuration string provided to the server into an authentication provider, if possible
Parse the configuration string provided to the server into an authentication provider if possible
pub async fn load(self, server_name: &str) -> Result<std::sync::Arc<dyn AuthProvider>, String> {
    match self {
      AuthConfiguration::DatabaseOTPs { connection } => crate::auth::db_otp::new(connection),
      AuthConfiguration::LDAP { url, bind_dn, bind_pw, search_base, account_attr } => {
        crate::auth::ldap::new(url, bind_dn, bind_pw, search_base, account_attr).await
      }
      AuthConfiguration::MultipleOpenIdConnect { providers, db_connection, registration } => {
        let mut clients = std::collections::BTreeMap::new();
        for configuration in providers {
          let (client, issuer, name) = create_oidc_client(configuration.provider, configuration.client_id, configuration.client_secret, server_name)?;
          clients.insert(issuer, (name, client));
        }
        db_oidc_multiple::new(db_connection, clients, registration)
      }
      AuthConfiguration::OpenIdConnect { client_id, client_secret, provider, db_connection, registration } => {
        db_oidc::new(db_connection, create_oidc_client(provider, client_id, client_secret, server_name)?.0, registration)
      }
      AuthConfiguration::OTPs { users } => crate::auth::fixed_otp::new(users),
      AuthConfiguration::Passwords { users } => crate::auth::fixed_password::new(users),
      AuthConfiguration::PhpBB { connection, database } => match database {
        AuthDatabase::PostgreSQL => crate::auth::php_bb::new::<diesel::pg::PgConnection, _>(connection),
        #[cfg(feature = "mysql")]
        AuthDatabase::MySQL => crate::auth::php_bb::new::<diesel::mysql::MysqlConnection, _>(connection),
      },
      AuthConfiguration::Uru { connection } => crate::auth::uru::new(connection),
    }
  }
pub async fn load ( self , server_name : & str ) -> Result < std :: sync :: Arc < dyn AuthProvider > , String > { match self { AuthConfiguration :: DatabaseOTPs { connection } => crate :: auth :: db_otp :: new ( connection ) , AuthConfiguration :: LDAP { url , bind_dn , bind_pw , search_base , account_attr } => { crate :: auth :: ldap :: new ( url , bind_dn , bind_pw , search_base , account_attr ) . await } AuthConfiguration :: MultipleOpenIdConnect { providers , db_connection , registration } => { let mut clients = std :: collections :: BTreeMap :: new ( ) ; for configuration in providers { let ( client , issuer , name ) = create_oidc_client ( configuration . provider , configuration . client_id , configuration . client_secret , server_name ) ? ; clients . insert ( issuer , ( name , client ) ) ; } db_oidc_multiple :: new ( db_connection , clients , registration ) } AuthConfiguration :: OpenIdConnect { client_id , client_secret , provider , db_connection , registration } => { db_oidc :: new ( db_connection , create_oidc_client ( provider , client_id , client_secret , server_name ) ? . 0 , registration ) } AuthConfiguration :: OTPs { users } => crate :: auth :: fixed_otp :: new ( users ) , AuthConfiguration :: Passwords { users } => crate :: auth :: fixed_password :: new ( users ) , AuthConfiguration :: PhpBB { connection , database } => match database { AuthDatabase :: PostgreSQL => crate :: auth :: php_bb :: new :: < diesel :: pg :: PgConnection , _ > ( connection ) , # [ cfg ( feature " " ) ] AuthDatabase :: MySQL => crate :: auth :: php_bb :: new :: < diesel :: mysql :: MysqlConnection , _ > ( connection ) , } , AuthConfiguration :: Uru { connection } => crate :: auth :: uru :: new ( connection ) , } }
Parse the configuration string provided to the server into an authentication provider, if possible
Parse the configuration string provided to the server into an authentication provider if possible
self
server_name
&str
self
server_name
&str