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§
Sourcefn 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_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
Sourcefn 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 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.
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,
Sourcefn 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 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.
Sourcefn 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 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
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§
Sourcefn 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_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)).
Sourcefn 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,
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.