mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-17 05:12:34 +02:00
30 lines
779 B
Rust
30 lines
779 B
Rust
use axum::http::StatusCode;
|
|
|
|
mod authenticator;
|
|
mod password;
|
|
mod auth_bearer;
|
|
mod auth_basic;
|
|
mod access_token;
|
|
mod fingerprint;
|
|
type Rejection = (StatusCode, &'static str);
|
|
|
|
#[macro_export]
|
|
macro_rules! permission_layer {
|
|
($app_state:expr, $permission:expr ) => {
|
|
{
|
|
let app_state = ::std::sync::Arc::clone($app_state);
|
|
::axum::middleware::from_fn_with_state(app_state, move |state, auth, request, next| {
|
|
$crate::auth::require_permission_inner($permission, state, auth, request, next)
|
|
})
|
|
}
|
|
};
|
|
}
|
|
pub use permission_layer;
|
|
|
|
pub use self::authenticator::*;
|
|
pub use self::access_token::*;
|
|
pub use self::password::*;
|
|
pub use self::fingerprint::*;
|
|
pub use self::auth_basic::*;
|
|
pub use self::auth_bearer::*;
|