1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
use std;

pub trait Authenticator{
    /// the identifier used to denote the session cookie
    const COOKIE_IDENTIFIER : &'static str;

    /// a function that returns a user_id in the form a String
    fn user_id(&self) -> String;

    /// a function that checks if the user pass combination is valid and if it is returns true and
    /// an instance of itself
    fn check_credentials(username: String, password: String) -> Result<Self,Self>
        where Self: std::marker::Sized;
}