use apiresponse::{ApiResponse, Response};
use axum::response::{IntoResponse, Response as AxumResponse};
#[derive(Debug, thiserror::Error, Response)]
#[response(module = "authentik")]
pub enum AuthentikError {
#[error("missing authentication headers")]
#[response(code = 1000, status = 401)]
Unauthenticated,
#[error("user does not have required group: {required_group}")]
#[response(code = 1001, status = 403)]
Forbidden {
required_group: String,
},
}
impl IntoResponse for AuthentikError {
fn into_response(self) -> AxumResponse {
let result: Result<(), Self> = Err(self);
ApiResponse::from(result).into_response()
}
}