[][src]Trait ellidri::auth::Provider

pub trait Provider: Send + Sync {
    fn is_available(&self) -> bool;
fn write_mechanisms(&self, buf: &mut String);
fn start_auth(
        &self,
        mechanism: &str,
        next: &mut Vec<u8>
    ) -> Result<usize, Error>;
fn next_challenge(
        &self,
        auth: usize,
        response: &[u8],
        next: &mut Vec<u8>
    ) -> Result<Option<String>, Error>; }

Required methods

fn is_available(&self) -> bool

Whether the SASL backend is available.

If not, start_auth and next_challenge will always return Err(()).

fn write_mechanisms(&self, buf: &mut String)

Write the SASL mechanisms this provider supports, separated by commas (,).

Example: PLAIN,EXTERNAL

Used for capability advertisment.

fn start_auth(
    &self,
    mechanism: &str,
    next: &mut Vec<u8>
) -> Result<usize, Error>

Start the authentication process of a client.

On success, returns an identifier that must be passed to next_challenge to continue the authentication, so that multiple clients can authenticate at the same time.

fn next_challenge(
    &self,
    auth: usize,
    response: &[u8],
    next: &mut Vec<u8>
) -> Result<Option<String>, Error>

Given the authentication process identifier auth, and the response to the previous challenge from the client response, returns whether the client is authenticated or not.

If the client is not authenticated yet, the next challenge to be sent to the client is appended to next.

Loading content...

Implementors

impl Provider for DummyProvider[src]

impl<M> Provider for DbProvider<M> where
    M: ManageConnection,
    Pool<M>: Plain
[src]

Loading content...