writium_auth/
dumb.rs

1use writium::prelude::*;
2use auth::Authority;
3
4const ERR_DUMB: &'static str = "An dumb authority is used, any privilege is not granted.";
5
6pub struct DumbAuthority();
7impl DumbAuthority {
8    pub fn new() -> DumbAuthority {
9        DumbAuthority()
10    }
11}
12impl Authority for DumbAuthority {
13    type Privilege = ();
14    fn authorize(&self, _pr: Self::Privilege, _req: &Request) -> Result<()> {
15        Err(Error::new(StatusCode::Unauthorized, ERR_DUMB))
16    }
17}