feat(auth): Add support for partial-auth, by facilitating injection of authentication parameters in headers (#4802)

Co-authored-by: Jagan <jaganelavarasan@gmail.com>
This commit is contained in:
Nishant Joshi
2024-08-01 14:57:39 +05:30
committed by GitHub
parent 5e1eb4af86
commit 1d4c87a9e3
31 changed files with 523 additions and 103 deletions

View File

@ -53,7 +53,7 @@ pub async fn customer_create(
|state, auth, req, _| {
customers::create_customer(state, auth.merchant_account, auth.key_store, req)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await
@ -87,7 +87,7 @@ pub async fn customer_retrieve(
|state, auth, req, _| {
customers::retrieve_customer(state, auth.merchant_account, auth.key_store, req)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await
@ -132,7 +132,7 @@ pub async fn customer_update(
|state, auth, req, _| {
customers::update_customer(state, auth.merchant_account, req, auth.key_store)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await
@ -166,7 +166,7 @@ pub async fn customer_delete(
|state, auth: auth::AuthenticationData, req, _| {
customers::delete_customer(state, auth.merchant_account, req, auth.key_store)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await
@ -208,7 +208,7 @@ pub async fn list_customer_payment_method_api(
None,
)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await

View File

@ -1,4 +1,5 @@
pub mod types;
use actix_web::{web, HttpRequest, HttpResponse};
use api_models::payments as payment_types;
use error_stack::report;
@ -71,7 +72,7 @@ pub async fn payment_intents_create(
api_types::HeaderPayload::default(),
)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
locking_action,
))
.await
@ -400,7 +401,7 @@ pub async fn payment_intents_capture(
api_types::HeaderPayload::default(),
)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
locking_action,
))
.await
@ -500,7 +501,7 @@ pub async fn payment_intent_list(
|state, auth, req, _| {
payments::list_payments(state, auth.merchant_account, auth.key_store, req)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await

View File

@ -1,4 +1,5 @@
pub mod types;
use actix_web::{web, HttpRequest, HttpResponse};
use error_stack::report;
use router_env::{instrument, tracing, Flow, Tag};
@ -51,7 +52,7 @@ pub async fn refund_create(
|state, auth, req, _| {
refunds::refund_create_core(state, auth.merchant_account, auth.key_store, req)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await
@ -101,7 +102,7 @@ pub async fn refund_retrieve_with_gateway_creds(
refunds::refund_retrieve_core,
)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await
@ -143,7 +144,7 @@ pub async fn refund_retrieve(
refunds::refund_retrieve_core,
)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await
@ -175,7 +176,7 @@ pub async fn refund_update(
&req,
create_refund_update_req,
|state, auth, req, _| refunds::refund_update_core(state, auth.merchant_account, req),
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await

View File

@ -1,4 +1,5 @@
pub mod types;
use actix_web::{web, HttpRequest, HttpResponse};
use api_models::payments as payment_types;
use error_stack::report;
@ -72,7 +73,7 @@ pub async fn setup_intents_create(
api_types::HeaderPayload::default(),
)
},
&auth::ApiKeyAuth,
&auth::HeaderAuth(auth::ApiKeyAuth),
api_locking::LockAction::NotApplicable,
))
.await