AuthenticationProvider

Trait AuthenticationProvider 

Source
pub trait AuthenticationProvider:
    Send
    + Sync
    + 'static {
    // Required methods
    fn get_principals<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Principal>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_principal<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Principal>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_principal<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn insert_principal<'life0, 'async_trait>(
        &'life0 self,
        user: Principal,
        overwrite: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_app_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        name: String,
        token: String,
    ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_app_token<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        token_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_app_tokens<'life0, 'life1, 'async_trait>(
        &'life0 self,
        principal: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AppToken>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add_membership<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        principal: &'life1 str,
        member_of: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove_membership<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        principal: &'life1 str,
        member_of: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_members<'life0, 'life1, 'async_trait>(
        &'life0 self,
        principal: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn validate_password<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        password_input: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Principal>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn validate_app_token<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 str,
        token: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Principal>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

The AuthenticationProvider is the principal store for rustical.

Required Methods§

Source

fn get_principals<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Principal>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a list of all principals

Source

fn get_principal<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Principal>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a principal by its id as an Option<Principal>. If the principal does not exist Ok(None) is returned.

Source

fn remove_principal<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn insert_principal<'life0, 'async_trait>( &'life0 self, user: Principal, overwrite: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Inserts a principal and upserts it if overwrite=true. Ignores Principal.membership field which is instead managed via the `*_membership´ methods.

Source

fn add_app_token<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 str, name: String, token: String, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns a token identifier

Source

fn remove_app_token<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, token_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn get_app_tokens<'life0, 'life1, 'async_trait>( &'life0 self, principal: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<AppToken>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn add_membership<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, principal: &'life1 str, member_of: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn remove_membership<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, principal: &'life1 str, member_of: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn list_members<'life0, 'life1, 'async_trait>( &'life0 self, principal: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn validate_password<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, password_input: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Principal>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Validates a password input for a principal. If the password input is correct returns Ok(Some(principal)).

Source

fn validate_app_token<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 str, token: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Principal>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Validates an app token for a given principal id.

Implementors§