auth::user_provider

Trait UserProvider

source
pub trait UserProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn authenticate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: Identity<'life1>,
        password: Password<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<UserInfoRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn authorize<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        catalog: &'life1 str,
        schema: &'life2 str,
        user_info: &'life3 UserInfoRef,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;

    // Provided methods
    fn auth<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        id: Identity<'life1>,
        password: Password<'life2>,
        catalog: &'life3 str,
        schema: &'life4 str,
    ) -> Pin<Box<dyn Future<Output = Result<UserInfoRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait { ... }
    fn external(&self) -> bool { ... }
}

Required Methods§

source

fn name(&self) -> &str

source

fn authenticate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: Identity<'life1>, password: Password<'life2>, ) -> Pin<Box<dyn Future<Output = Result<UserInfoRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Checks whether a user is valid and allowed to access the database.

source

fn authorize<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, catalog: &'life1 str, schema: &'life2 str, user_info: &'life3 UserInfoRef, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Checks whether a connection request from a certain user to a certain catalog/schema is legal. This method should be called after authenticate().

Provided Methods§

source

fn auth<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, id: Identity<'life1>, password: Password<'life2>, catalog: &'life3 str, schema: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<UserInfoRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Combination of authenticate() and authorize(). In most cases it’s preferred for both convenience and performance.

source

fn external(&self) -> bool

Returns whether this user provider implementation is backed by an external system.

Implementors§