mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-04-18 10:53:56 +01:00
18 lines
443 B
Rust
18 lines
443 B
Rust
use crate::auth::{AuthImpl, UserId};
|
|
use actix_web::{dev::ServiceRequest, Error as ActixError};
|
|
use std::fmt::Display;
|
|
|
|
#[derive(Debug)]
|
|
pub struct NoneAuth;
|
|
|
|
impl AuthImpl for NoneAuth {
|
|
async fn for_write_request(&self, _req: &ServiceRequest) -> Result<Option<UserId>, ActixError> {
|
|
Ok(Some(UserId::DEFAULT))
|
|
}
|
|
}
|
|
|
|
impl Display for NoneAuth {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "None")
|
|
}
|
|
}
|