mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 19:42:27 +08:00
refactor(router): Refactored Authentication (#327)
This commit is contained in:
@ -8,28 +8,25 @@ use serde::Serialize;
|
||||
use crate::{
|
||||
core::errors::{self, RouterResult},
|
||||
routes,
|
||||
services::{api, logger},
|
||||
types::storage,
|
||||
services::{api, authentication as auth, logger},
|
||||
};
|
||||
|
||||
#[instrument(skip(request, payload, state, func))]
|
||||
pub async fn compatibility_api_wrap<'a, 'b, A, T, Q, F, Fut, S, E>(
|
||||
#[instrument(skip(request, payload, state, func, api_authentication))]
|
||||
pub async fn compatibility_api_wrap<'a, 'b, U, T, Q, F, Fut, S, E>(
|
||||
state: &'b routes::AppState,
|
||||
request: &'a HttpRequest,
|
||||
payload: T,
|
||||
func: F,
|
||||
api_authentication: A,
|
||||
api_authentication: &dyn auth::AuthenticateAndFetch<U>,
|
||||
) -> HttpResponse
|
||||
where
|
||||
A: Into<api::ApiAuthentication<'a>> + std::fmt::Debug,
|
||||
F: Fn(&'b routes::AppState, storage::MerchantAccount, T) -> Fut,
|
||||
F: Fn(&'b routes::AppState, U, T) -> Fut,
|
||||
Fut: Future<Output = RouterResult<api::BachResponse<Q>>>,
|
||||
Q: Serialize + std::fmt::Debug + 'a,
|
||||
S: From<Q> + Serialize,
|
||||
E: From<errors::ApiErrorResponse> + Serialize + error_stack::Context + actix_web::ResponseError,
|
||||
T: std::fmt::Debug,
|
||||
{
|
||||
let api_authentication = api_authentication.into();
|
||||
let resp = api::server_wrap_util(state, request, payload, func, api_authentication).await;
|
||||
match resp {
|
||||
Ok(api::BachResponse::Json(router_resp)) => {
|
||||
|
||||
Reference in New Issue
Block a user