Skip to main content

AuthenticationProvider

Trait AuthenticationProvider 

Source
pub trait AuthenticationProvider: Send + Sync {
    // Required methods
    fn method(&self) -> &str;
    fn create(
        &self,
        rng: &Rng,
        config: &HashMap<String, String>,
    ) -> Result<HashMap<String, String>>;
    fn authenticate(
        &self,
        stored: &HashMap<String, String>,
        credentials: &HashMap<String, String>,
    ) -> Result<AuthStep>;
}

Required Methods§

Source

fn method(&self) -> &str

The method name this provider handles (e.g., “password”, “token”, “solana”).

Source

fn create( &self, rng: &Rng, config: &HashMap<String, String>, ) -> Result<HashMap<String, String>>

Create stored credentials from configuration. Called during CREATE AUTHENTICATION ... FOR USER .... The rng parameter provides deterministic randomness in test mode.

Source

fn authenticate( &self, stored: &HashMap<String, String>, credentials: &HashMap<String, String>, ) -> Result<AuthStep>

Authenticate a user given their stored credentials and the presented credentials.

For single-step methods (password, token), this returns Authenticated or Failed. For challenge-response methods, this may return Challenge with data the client must respond to, followed by a second call with the response.

Implementors§