summaryrefslogtreecommitdiff
path: root/src/repo/login/extract.rs
blob: ab61106bde2d2805595283cc512a153904722055 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use axum::{extract::FromRequestParts, http::request::Parts};

use super::Login;
use crate::{app::App, login::extract::Identity};

#[async_trait::async_trait]
impl FromRequestParts<App> for Login {
    type Rejection = <Identity as FromRequestParts<App>>::Rejection;

    async fn from_request_parts(parts: &mut Parts, state: &App) -> Result<Self, Self::Rejection> {
        let identity = Identity::from_request_parts(parts, state).await?;

        Ok(identity.login)
    }
}