use crate::{AxumCsrfService, CsrfConfig};
use tower_layer::Layer;
#[derive(Clone)]
pub struct CsrfLayer {
pub(crate) config: CsrfConfig,
}
impl CsrfLayer {
pub fn new(config: CsrfConfig) -> Self {
Self { config }
}
}
impl<S> Layer<S> for CsrfLayer {
type Service = AxumCsrfService<S>;
fn layer(&self, inner: S) -> Self::Service {
AxumCsrfService {
config: self.config.clone(),
inner,
}
}
}