[][src]Trait splinter::biome::credentials::store::CredentialsStore

pub trait CredentialsStore<T> {
    fn add_credentials(
        &self,
        credentials: T
    ) -> Result<(), CredentialsStoreError>;
fn update_credentials(
        &self,
        user_id: &str,
        updated_username: &str,
        updated_password: &str
    ) -> Result<(), CredentialsStoreError>;
fn remove_credentials(
        &self,
        user_id: &str
    ) -> Result<(), CredentialsStoreError>;
fn fetch_credential_by_user_id(
        &self,
        user_id: &str
    ) -> Result<T, CredentialsStoreError>;
fn fetch_credential_by_username(
        &self,
        username: &str
    ) -> Result<T, CredentialsStoreError>;
fn fetch_username_by_id(
        &self,
        user_id: &str
    ) -> Result<UsernameId, CredentialsStoreError>;
fn get_usernames(&self) -> Result<Vec<UsernameId>, CredentialsStoreError>; }

Defines methods for CRUD operations and fetching a user’s credentials without defining a storage strategy

Required methods

fn add_credentials(&self, credentials: T) -> Result<(), CredentialsStoreError>

Adds a credential to the underlying storage

Arguments

  • credentials - Credentials to be added

fn update_credentials(
    &self,
    user_id: &str,
    updated_username: &str,
    updated_password: &str
) -> Result<(), CredentialsStoreError>

Replaces a credential of a certain type for a user in the underlying storage with new credentials. This assumes that the user has only one credential of a certain type in storage

Arguments

  • user_id - The unique identifier of the user credential belongs to
  • updated_username - The updated username for the user
  • updated_password - The updated password for the user

fn remove_credentials(&self, user_id: &str) -> Result<(), CredentialsStoreError>

Removes a credential from a user from the underlying storage

Arguments

  • user_id - The unique identifier of the user credential belongs to

fn fetch_credential_by_user_id(
    &self,
    user_id: &str
) -> Result<T, CredentialsStoreError>

Fetches a credential for a user

Arguments

  • user_id - The unique identifier of the user credential belongs to

fn fetch_credential_by_username(
    &self,
    username: &str
) -> Result<T, CredentialsStoreError>

Fetches a credential for a user

Arguments

  • username - The username the user uses for login

fn fetch_username_by_id(
    &self,
    user_id: &str
) -> Result<UsernameId, CredentialsStoreError>

fn get_usernames(&self) -> Result<Vec<UsernameId>, CredentialsStoreError>

Loading content...

Implementors

Loading content...