Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(auth): distinguish platform self-operations from connected-scope operations (#10913)

Apoorv Dixit95d07db7be71
diff --git a/crates/router/src/analytics.rs b/crates/router/src/analytics.rs
index 409c3cf280..29c1a1ea31 100644
--- a/crates/router/src/analytics.rs
+++ b/crates/router/src/analytics.rs
@@ -2698,8 +2698,8 @@ pub mod routes {
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileAnalyticsRead,
diff --git a/crates/router/src/compatibility/stripe/customers.rs b/crates/router/src/compatibility/stripe/customers.rs
index 1d6d3430a4..2d1127ce86 100644
--- a/crates/router/src/compatibility/stripe/customers.rs
+++ b/crates/router/src/compatibility/stripe/customers.rs
@@ -53,8 +53,8 @@ pub async fn customer_create(
customers::create_customer(state, auth.platform.get_provider().clone(), req, None)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
api_locking::LockAction::NotApplicable,
))
@@ -95,8 +95,8 @@ pub async fn customer_retrieve(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
api_locking::LockAction::NotApplicable,
))
@@ -150,8 +150,8 @@ pub async fn customer_update(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
api_locking::LockAction::NotApplicable,
))
@@ -187,8 +187,8 @@ pub async fn customer_delete(
customers::delete_customer(state, auth.platform.get_provider().clone(), customer_id)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
api_locking::LockAction::NotApplicable,
))
@@ -231,8 +231,8 @@ pub async fn list_customer_payment_method_api(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs
index 0f7f2af172..09791f7279 100644
--- a/crates/router/src/compatibility/stripe/payment_intents.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents.rs
@@ -95,8 +95,8 @@ pub async fn payment_intents_create(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -125,8 +125,8 @@ pub async fn payment_intents_retrieve(
};
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) =
@@ -204,8 +204,8 @@ pub async fn payment_intents_retrieve_with_gateway_creds(
};
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, _auth_flow) = match auth::get_auth_type_and_flow(req.headers(), api_auth) {
@@ -290,8 +290,8 @@ pub async fn payment_intents_update(
payload.payment_id = Some(api_types::PaymentIdType::PaymentIntentId(payment_id));
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) = match auth::get_auth_type_and_flow(req.headers(), api_auth) {
@@ -379,8 +379,8 @@ pub async fn payment_intents_confirm(
payload.confirm = Some(true);
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) =
@@ -500,8 +500,8 @@ pub async fn payment_intents_capture(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -535,8 +535,8 @@ pub async fn payment_intents_cancel(
payload.payment_id = payment_id;
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) = match auth::get_auth_type_and_flow(req.headers(), api_auth) {
@@ -618,8 +618,8 @@ pub async fn payment_intent_list(
payments::list_payments(state, auth.platform, None, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/compatibility/stripe/refunds.rs b/crates/router/src/compatibility/stripe/refunds.rs
index ad646f282c..f583c94192 100644
--- a/crates/router/src/compatibility/stripe/refunds.rs
+++ b/crates/router/src/compatibility/stripe/refunds.rs
@@ -53,8 +53,8 @@ pub async fn refund_create(
refunds::refund_create_core(state, auth.platform, None, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -106,8 +106,8 @@ pub async fn refund_retrieve_with_gateway_creds(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -152,8 +152,8 @@ pub async fn refund_retrieve(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -189,8 +189,8 @@ pub async fn refund_update(
refunds::refund_update_core(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs
index 9ec104e80f..7b70524b28 100644
--- a/crates/router/src/compatibility/stripe/setup_intents.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents.rs
@@ -81,8 +81,8 @@ pub async fn setup_intents_create(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -111,8 +111,8 @@ pub async fn setup_intents_retrieve(
};
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) =
@@ -192,8 +192,8 @@ pub async fn setup_intents_update(
payload.payment_id = Some(api_types::PaymentIdType::PaymentIntentId(setup_id));
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) =
@@ -274,8 +274,8 @@ pub async fn setup_intents_confirm(
payload.confirm = Some(true);
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) =
diff --git a/crates/router/src/routes/authentication.rs b/crates/router/src/routes/authentication.rs
index 10eb6cfec4..57c56ca220 100644
--- a/crates/router/src/routes/authentication.rs
+++ b/crates/router/src/routes/authentication.rs
@@ -32,8 +32,8 @@ pub async fn authentication_create(
unified_authentication_service::authentication_create_core(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -185,8 +185,8 @@ pub async fn authentication_retrieve_eligibility_check(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/blocklist.rs b/crates/router/src/routes/blocklist.rs
index a1cbbd95fe..fe9aa8bfee 100644
--- a/crates/router/src/routes/blocklist.rs
+++ b/crates/router/src/routes/blocklist.rs
@@ -37,8 +37,8 @@ pub async fn add_entry_to_blocklist(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantAccountWrite,
@@ -78,8 +78,8 @@ pub async fn remove_entry_from_blocklist(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantAccountWrite,
@@ -114,8 +114,8 @@ pub async fn list_blocked_payment_methods(
let payload = query_payload.into_inner();
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
};
let (auth_type, _) =
@@ -174,8 +174,8 @@ pub async fn toggle_blocklist_guard(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantAccountWrite,
diff --git a/crates/router/src/routes/currency.rs b/crates/router/src/routes/currency.rs
index f311b23673..10f72d8dd8 100644
--- a/crates/router/src/routes/currency.rs
+++ b/crates/router/src/routes/currency.rs
@@ -18,8 +18,8 @@ pub async fn retrieve_forex(state: web::Data<AppState>, req: HttpRequest) -> Htt
|state, _auth: auth::AuthenticationData, _, _| currency::retrieve_forex(state),
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::DashboardNoPermissionAuth,
req.headers(),
@@ -54,8 +54,8 @@ pub async fn convert_forex(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::DashboardNoPermissionAuth,
req.headers(),
diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs
index 380b979fe5..ac9a950763 100644
--- a/crates/router/src/routes/customers.rs
+++ b/crates/router/src/routes/customers.rs
@@ -26,8 +26,8 @@ pub async fn customers_create(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
@@ -56,8 +56,8 @@ pub async fn customers_create(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
@@ -86,8 +86,8 @@ pub async fn customers_retrieve(
})
} else {
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
match auth::is_ephemeral_auth(req.headers(), api_auth) {
Ok(auth) => auth,
@@ -138,8 +138,8 @@ pub async fn customers_retrieve(
} else {
api_or_client_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&v2_client_auth,
req.headers(),
@@ -179,8 +179,8 @@ pub async fn customers_list(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
@@ -211,8 +211,8 @@ pub async fn customers_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
@@ -244,8 +244,8 @@ pub async fn customers_list_with_count(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
@@ -276,8 +276,8 @@ pub async fn customers_list_with_count(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
@@ -319,8 +319,8 @@ pub async fn customers_update(
},
auth::auth_type(
&auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
@@ -359,8 +359,8 @@ pub async fn customers_update(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
@@ -392,8 +392,8 @@ pub async fn customers_delete(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
@@ -425,8 +425,8 @@ pub async fn customers_delete(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
&auth::JWTAuth {
permission: Permission::MerchantCustomerWrite,
@@ -458,8 +458,8 @@ pub async fn get_customer_mandates(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantMandateRead,
diff --git a/crates/router/src/routes/disputes.rs b/crates/router/src/routes/disputes.rs
index 0806f13581..57034ba7c7 100644
--- a/crates/router/src/routes/disputes.rs
+++ b/crates/router/src/routes/disputes.rs
@@ -53,8 +53,8 @@ pub async fn retrieve_dispute(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeRead,
@@ -88,8 +88,8 @@ pub async fn fetch_disputes(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeRead,
@@ -143,8 +143,8 @@ pub async fn retrieve_disputes_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantDisputeRead,
@@ -204,8 +204,8 @@ pub async fn retrieve_disputes_list_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeRead,
@@ -242,8 +242,8 @@ pub async fn get_disputes_filters(state: web::Data<AppState>, req: HttpRequest)
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantDisputeRead,
@@ -287,8 +287,8 @@ pub async fn get_disputes_filters_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeRead,
@@ -337,8 +337,8 @@ pub async fn accept_dispute(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeWrite,
@@ -382,8 +382,8 @@ pub async fn submit_dispute_evidence(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeWrite,
@@ -434,8 +434,8 @@ pub async fn attach_dispute_evidence(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeWrite,
@@ -484,8 +484,8 @@ pub async fn retrieve_dispute_evidence(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeRead,
@@ -529,8 +529,8 @@ pub async fn delete_dispute_evidence(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeWrite,
@@ -561,8 +561,8 @@ pub async fn get_disputes_aggregate(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantDisputeRead,
@@ -599,8 +599,8 @@ pub async fn get_disputes_aggregate_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileDisputeRead,
diff --git a/crates/router/src/routes/ephemeral_key.rs b/crates/router/src/routes/ephemeral_key.rs
index ae39636d4f..ebe5f0f2ce 100644
--- a/crates/router/src/routes/ephemeral_key.rs
+++ b/crates/router/src/routes/ephemeral_key.rs
@@ -35,8 +35,8 @@ pub async fn ephemeral_key_create(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
)
@@ -59,8 +59,8 @@ pub async fn ephemeral_key_delete(
payload,
|state, _: auth::AuthenticationData, req, _| helpers::delete_ephemeral_key(state, req),
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
)
@@ -90,8 +90,8 @@ pub async fn client_secret_create(
)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -114,8 +114,8 @@ pub async fn client_secret_delete(
payload,
|state, _: auth::AuthenticationData, req, _| helpers::delete_client_secret(state, req),
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/files.rs b/crates/router/src/routes/files.rs
index ce30c3b970..f612f71f6f 100644
--- a/crates/router/src/routes/files.rs
+++ b/crates/router/src/routes/files.rs
@@ -51,8 +51,8 @@ pub async fn files_create(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::DashboardNoPermissionAuth,
req.headers(),
@@ -100,8 +100,8 @@ pub async fn files_delete(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::DashboardNoPermissionAuth,
req.headers(),
@@ -151,8 +151,8 @@ pub async fn files_retrieve(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::DashboardNoPermissionAuth,
req.headers(),
diff --git a/crates/router/src/routes/fraud_check.rs b/crates/router/src/routes/fraud_check.rs
index 4dc649838e..842d965f12 100644
--- a/crates/router/src/routes/fraud_check.rs
+++ b/crates/router/src/routes/fraud_check.rs
@@ -23,8 +23,8 @@ pub async fn frm_fulfillment(
frm_core::frm_fulfillment_core(state, auth.platform, req)
},
&services::authentication::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/mandates.rs b/crates/router/src/routes/mandates.rs
index d1666653a8..6caecdd211 100644
--- a/crates/router/src/routes/mandates.rs
+++ b/crates/router/src/routes/mandates.rs
@@ -31,8 +31,8 @@ pub async fn get_mandate(
mandate::get_mandate(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -59,8 +59,8 @@ pub async fn revoke_mandate(
mandate::revoke_mandate(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -85,8 +85,8 @@ pub async fn retrieve_mandates_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantMandateRead,
diff --git a/crates/router/src/routes/payment_link.rs b/crates/router/src/routes/payment_link.rs
index 3971ae0623..6bce4f3b49 100644
--- a/crates/router/src/routes/payment_link.rs
+++ b/crates/router/src/routes/payment_link.rs
@@ -132,8 +132,8 @@ pub async fn payments_link_list(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs
index bf7dcf446a..b117c378c6 100644
--- a/crates/router/src/routes/payment_methods.rs
+++ b/crates/router/src/routes/payment_methods.rs
@@ -60,8 +60,8 @@ pub async fn create_payment_method_api(
.await
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
api_locking::LockAction::NotApplicable,
))
@@ -93,8 +93,8 @@ pub async fn create_payment_method_api(
.await
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -125,8 +125,8 @@ pub async fn get_pm_nt_eligibility_api(
.await
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -156,8 +156,8 @@ pub async fn create_payment_method_intent_api(
.await
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -217,8 +217,8 @@ pub async fn payment_method_update_api(
)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -251,8 +251,8 @@ pub async fn payment_method_retrieve_api(
)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -281,8 +281,8 @@ pub async fn payment_method_delete_api(
payment_methods_routes::delete_payment_method(state, pm, auth.platform, auth.profile)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -567,8 +567,8 @@ pub async fn save_payment_method_api(
let payload = json_payload.into_inner();
let pm_id = path.into_inner();
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth)
@@ -606,8 +606,8 @@ pub async fn list_payment_method_api(
let flow = Flow::PaymentMethodsList;
let payload = json_payload.into_inner();
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth)
@@ -646,8 +646,8 @@ pub async fn list_customer_payment_method_api(
let payload = query_payload.into_inner();
let customer_id = customer_id.into_inner().0;
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
let ephemeral_auth = match auth::is_ephemeral_auth(req.headers(), api_auth) {
@@ -688,8 +688,8 @@ pub async fn list_customer_payment_method_api_client(
let payload = query_payload.into_inner();
let api_key = auth::get_api_key(req.headers()).ok();
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
let (auth, _, is_ephemeral_auth) =
match auth::get_ephemeral_or_other_auth(req.headers(), false, Some(&payload), api_auth)
@@ -736,8 +736,8 @@ pub async fn initiate_pm_collect_link_flow(
payment_methods_routes::initiate_pm_collect_link(state, auth.platform, req)
},
&auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
},
api_locking::LockAction::NotApplicable,
))
@@ -770,8 +770,8 @@ pub async fn list_customer_payment_method_api(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
@@ -811,8 +811,8 @@ pub async fn get_payment_method_token_data(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
@@ -845,8 +845,8 @@ pub async fn get_total_payment_method_count(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantCustomerRead,
@@ -917,8 +917,8 @@ pub async fn payment_method_retrieve_api(
.await
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
api_locking::LockAction::NotApplicable,
))
@@ -937,8 +937,8 @@ pub async fn payment_method_update_api(
let payment_method_id = path.into_inner();
let payload = json_payload.into_inner();
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
let (auth, _) = match auth::check_client_secret_and_get_auth(req.headers(), &payload, api_auth)
@@ -979,8 +979,8 @@ pub async fn payment_method_delete_api(
payment_method_id: payment_method_id.into_inner().0,
};
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
let ephemeral_auth = match auth::is_ephemeral_auth(req.headers(), api_auth) {
@@ -1031,8 +1031,8 @@ pub async fn list_countries_currencies_for_connector_payment_method(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
}),
&auth::JWTAuth {
permission: Permission::ProfileConnectorWrite,
@@ -1072,8 +1072,8 @@ pub async fn list_countries_currencies_for_connector_payment_method(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileConnectorRead,
@@ -1101,8 +1101,8 @@ pub async fn default_payment_method_set_api(
let pc = payload.clone();
let customer_id = &pc.customer_id;
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: true,
};
let ephemeral_auth = match auth::is_ephemeral_auth(req.headers(), api_auth) {
@@ -1423,8 +1423,8 @@ pub async fn payment_methods_session_create(
.await
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -1460,8 +1460,8 @@ pub async fn payment_methods_session_update(
}
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -1493,8 +1493,8 @@ pub async fn payment_methods_session_retrieve(
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(
common_utils::types::authentication::ResourceId::PaymentMethodSession(
@@ -1711,8 +1711,8 @@ pub async fn network_token_status_check_api(
)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -1747,8 +1747,8 @@ pub async fn payment_method_get_token_details_api(
}
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs
index 701fa4ebfb..41ad98adf2 100644
--- a/crates/router/src/routes/payments.rs
+++ b/crates/router/src/routes/payments.rs
@@ -94,14 +94,14 @@ pub async fn payments_create(
let auth_type = match env::which() {
env::Env::Production => {
&auth::InternalMerchantIdProfileIdAuth(auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}))
}
_ => auth::auth_type(
&auth::InternalMerchantIdProfileIdAuth(auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
})),
&auth::InternalMerchantIdProfileIdAuth(auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
@@ -156,8 +156,8 @@ pub async fn recovery_payments_create(
)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -208,13 +208,13 @@ pub async fn payments_create_intent(
},
match env::which() {
env::Env::Production => &auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
_ => auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
@@ -276,8 +276,8 @@ pub async fn payments_get_intent(
},
auth::api_or_client_or_jwt_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id.clone(),
@@ -334,8 +334,8 @@ pub async fn revenue_recovery_get_intent(
},
auth::api_or_client_or_jwt_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id.clone(),
@@ -398,8 +398,8 @@ pub async fn list_payment_attempts(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
@@ -431,13 +431,13 @@ pub async fn payments_create_and_confirm_intent(
} else {
match env::which() {
env::Env::Production => &auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
_ => auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
@@ -517,8 +517,8 @@ pub async fn payments_update_intent(
)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -615,8 +615,8 @@ pub async fn payments_retrieve(
tracing::Span::current().record("flow", flow.to_string());
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) = match auth::check_internal_api_key_auth(
@@ -678,8 +678,8 @@ pub async fn payments_retrieve_with_gateway_creds(
json_payload: web::Json<payment_types::PaymentRetrieveBodyWithCredentials>,
) -> impl Responder {
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, _auth_flow) = match auth::get_auth_type_and_flow(req.headers(), api_auth) {
@@ -766,8 +766,8 @@ pub async fn payments_update(
payload.payment_id = Some(payment_types::PaymentIdType::PaymentIntentId(payment_id));
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) = match auth::check_internal_api_key_auth_no_client_secret(
req.headers(),
@@ -856,8 +856,8 @@ pub async fn payments_post_session_tokens(
)
},
&auth::PublishableKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
},
locking_action,
))
@@ -917,8 +917,8 @@ pub async fn payments_update_metadata(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -963,8 +963,8 @@ pub async fn payments_confirm(
payload.confirm = Some(true);
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) = match auth::check_internal_api_key_auth(
@@ -1049,8 +1049,8 @@ pub async fn payments_capture(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -1111,8 +1111,8 @@ pub async fn payments_dynamic_tax_calculation(
)
},
&auth::PublishableKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
},
locking_action,
))
@@ -1236,8 +1236,8 @@ pub async fn payments_connector_session(
)
},
&auth::HeaderAuth(auth::PublishableKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -1464,8 +1464,8 @@ pub async fn payments_complete_authorize(
};
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, auth_flow) =
@@ -1553,8 +1553,8 @@ pub async fn payments_cancel(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -1623,8 +1623,8 @@ pub async fn payments_cancel(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
@@ -1680,8 +1680,8 @@ pub async fn payments_cancel_post_capture(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -1707,8 +1707,8 @@ pub async fn payments_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantPaymentRead,
@@ -1739,8 +1739,8 @@ pub async fn revenue_recovery_invoices_list(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantPaymentRead,
@@ -1770,8 +1770,8 @@ pub async fn payments_list(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantPaymentRead,
@@ -1807,8 +1807,8 @@ pub async fn profile_payments_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
@@ -2052,13 +2052,13 @@ pub async fn payments_approve(
},
match env::which() {
env::Env::Production => &auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
_ => auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
@@ -2122,13 +2122,13 @@ pub async fn payments_reject(
},
match env::which() {
env::Env::Production => &auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
_ => auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
@@ -2298,8 +2298,8 @@ pub async fn payments_incremental_authorization(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -2348,8 +2348,8 @@ pub async fn payments_extend_authorization(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -2383,8 +2383,8 @@ pub async fn payments_external_authentication(
>(state, auth.platform, req)
},
&auth::HeaderAuth(auth::PublishableKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
locking_action,
))
@@ -2497,8 +2497,8 @@ pub async fn retrieve_extended_card_info(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -2519,8 +2519,8 @@ pub async fn payments_submit_eligibility(
payload.payment_id = payment_id.clone();
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_type, _auth_flow) =
@@ -3151,8 +3151,8 @@ pub async fn payment_confirm_intent(
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id,
@@ -3205,8 +3205,8 @@ pub async fn payments_apply_pm_data(
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id,
@@ -3285,8 +3285,8 @@ pub async fn proxy_confirm_intent(
))
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
locking_action,
))
@@ -3361,8 +3361,8 @@ pub async fn confirm_intent_with_external_vault_proxy(
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Payment(
global_payment_id,
@@ -3447,8 +3447,8 @@ pub async fn payment_status(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentRead,
@@ -3498,13 +3498,13 @@ pub async fn payments_status_with_gateway_creds(
} else {
match env::which() {
env::Env::Production => &auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
_ => auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfilePaymentWrite,
@@ -3585,8 +3585,8 @@ pub async fn payment_get_intent_using_merchant_reference_id(
.await
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -3704,8 +3704,8 @@ pub async fn payments_capture(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileAccountWrite,
diff --git a/crates/router/src/routes/payouts.rs b/crates/router/src/routes/payouts.rs
index b1eabeec61..92b485e6a5 100644
--- a/crates/router/src/routes/payouts.rs
+++ b/crates/router/src/routes/payouts.rs
@@ -56,8 +56,8 @@ pub async fn payouts_create(
payouts_create_core(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -91,8 +91,8 @@ pub async fn payouts_retrieve(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePayoutRead,
@@ -135,8 +135,8 @@ pub async fn payouts_update(
payouts_update_core(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -205,8 +205,8 @@ pub async fn payouts_cancel(
payouts_cancel_core(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -233,8 +233,8 @@ pub async fn payouts_fulfill(
payouts_fulfill_core(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -262,8 +262,8 @@ pub async fn payouts_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantPayoutRead,
@@ -301,8 +301,8 @@ pub async fn payouts_list_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePayoutRead,
@@ -335,8 +335,8 @@ pub async fn payouts_list_by_filter(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantPayoutRead,
@@ -374,8 +374,8 @@ pub async fn payouts_list_by_filter_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePayoutRead,
@@ -408,8 +408,8 @@ pub async fn payouts_list_available_filters_for_merchant(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantPayoutRead,
@@ -447,8 +447,8 @@ pub async fn payouts_list_available_filters_for_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePayoutRead,
@@ -485,8 +485,8 @@ pub async fn get_payout_filters(state: web::Data<AppState>, req: HttpRequest) ->
|state, auth: auth::AuthenticationData, _, _| get_payout_filters_core(state, auth.platform),
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfilePayoutRead,
diff --git a/crates/router/src/routes/poll.rs b/crates/router/src/routes/poll.rs
index 290c185217..d974cf41c1 100644
--- a/crates/router/src/routes/poll.rs
+++ b/crates/router/src/routes/poll.rs
@@ -41,8 +41,8 @@ pub async fn retrieve_poll_status(
poll_id,
|state, auth, req, _| poll::retrieve_poll_status(state, req, auth.platform),
&auth::HeaderAuth(auth::PublishableKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/profile_acquirer.rs b/crates/router/src/routes/profile_acquirer.rs
index cf5483ffd2..8ec0514cb1 100644
--- a/crates/router/src/routes/profile_acquirer.rs
+++ b/crates/router/src/routes/profile_acquirer.rs
@@ -28,8 +28,8 @@ pub async fn create_profile_acquirer(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileAccountWrite,
@@ -72,8 +72,8 @@ pub async fn profile_acquirer_update(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: true,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileAccountWrite,
diff --git a/crates/router/src/routes/profiles.rs b/crates/router/src/routes/profiles.rs
index 6ff7b2a610..66e55fbf2b 100644
--- a/crates/router/src/routes/profiles.rs
+++ b/crates/router/src/routes/profiles.rs
@@ -482,8 +482,8 @@ pub async fn toggle_connector_agnostic_mit(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: permissions::Permission::MerchantRoutingWrite,
diff --git a/crates/router/src/routes/proxy.rs b/crates/router/src/routes/proxy.rs
index d51b2941df..27bd9a0e28 100644
--- a/crates/router/src/routes/proxy.rs
+++ b/crates/router/src/routes/proxy.rs
@@ -25,8 +25,8 @@ pub async fn proxy(
proxy::proxy_core(state, auth.platform, req)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/refunds.rs b/crates/router/src/routes/refunds.rs
index 036f259af6..5977063a71 100644
--- a/crates/router/src/routes/refunds.rs
+++ b/crates/router/src/routes/refunds.rs
@@ -66,8 +66,8 @@ pub async fn refunds_create(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRefundWrite,
@@ -105,8 +105,8 @@ pub async fn refunds_create(
} else {
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileRefundWrite,
@@ -171,8 +171,8 @@ pub async fn refunds_retrieve(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRefundRead,
@@ -215,8 +215,8 @@ pub async fn refunds_retrieve(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileRefundRead,
@@ -255,8 +255,8 @@ pub async fn refunds_retrieve_with_gateway_creds(
} else {
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileRefundRead,
@@ -313,8 +313,8 @@ pub async fn refunds_retrieve_with_body(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -345,8 +345,8 @@ pub async fn refunds_update(
refund_update_core(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -384,8 +384,8 @@ pub async fn refunds_metadata_update(
)
},
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -413,8 +413,8 @@ pub async fn refunds_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRefundRead,
@@ -449,8 +449,8 @@ pub async fn refunds_list(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantRefundRead,
@@ -488,8 +488,8 @@ pub async fn refunds_list_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRefundRead,
@@ -522,8 +522,8 @@ pub async fn refunds_filter_list(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRefundRead,
@@ -552,8 +552,8 @@ pub async fn get_refunds_filters(state: web::Data<AppState>, req: HttpRequest) -
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRefundRead,
@@ -589,8 +589,8 @@ pub async fn get_refunds_filters_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRefundRead,
@@ -621,8 +621,8 @@ pub async fn get_refunds_aggregates(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRefundRead,
@@ -681,8 +681,8 @@ pub async fn get_refunds_aggregate_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRefundRead,
diff --git a/crates/router/src/routes/relay.rs b/crates/router/src/routes/relay.rs
index 973b6575b8..186258c47e 100644
--- a/crates/router/src/routes/relay.rs
+++ b/crates/router/src/routes/relay.rs
@@ -33,8 +33,8 @@ pub async fn relay(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -71,8 +71,8 @@ pub async fn relay_retrieve(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index c2e096da82..9bf72fa41c 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -59,8 +59,8 @@ pub async fn routing_create_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRoutingWrite,
@@ -98,8 +98,8 @@ pub async fn routing_create_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileRoutingWrite,
@@ -144,8 +144,8 @@ pub async fn routing_link_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRoutingWrite,
@@ -189,8 +189,8 @@ pub async fn routing_link_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuthProfileFromRoute {
profile_id: wrapper.profile_id,
@@ -233,8 +233,8 @@ pub async fn routing_retrieve_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRoutingRead,
@@ -271,8 +271,8 @@ pub async fn routing_retrieve_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileRoutingRead,
@@ -315,8 +315,8 @@ pub async fn list_routing_configs(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRoutingRead,
@@ -355,8 +355,8 @@ pub async fn list_routing_configs_for_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRoutingRead,
@@ -394,8 +394,8 @@ pub async fn routing_unlink_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuthProfileFromRoute {
profile_id: path,
@@ -441,8 +441,8 @@ pub async fn routing_unlink_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRoutingWrite,
@@ -482,8 +482,8 @@ pub async fn routing_update_default_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::MerchantRoutingWrite,
@@ -522,8 +522,8 @@ pub async fn routing_update_default_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRoutingWrite,
@@ -558,8 +558,8 @@ pub async fn routing_retrieve_default_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuthProfileFromRoute {
profile_id: path,
@@ -600,8 +600,8 @@ pub async fn routing_retrieve_default_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRoutingRead,
@@ -636,8 +636,8 @@ pub async fn upsert_surcharge_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantSurchargeDecisionManagerWrite,
@@ -670,8 +670,8 @@ pub async fn delete_surcharge_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantSurchargeDecisionManagerWrite,
@@ -705,8 +705,8 @@ pub async fn retrieve_surcharge_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantSurchargeDecisionManagerRead,
@@ -741,8 +741,8 @@ pub async fn upsert_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantThreeDsDecisionManagerWrite,
@@ -782,8 +782,8 @@ pub async fn upsert_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileThreeDsDecisionManagerWrite,
@@ -817,8 +817,8 @@ pub async fn delete_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantThreeDsDecisionManagerWrite,
@@ -857,8 +857,8 @@ pub async fn retrieve_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileThreeDsDecisionManagerWrite,
@@ -893,8 +893,8 @@ pub async fn retrieve_decision_manager_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantThreeDsDecisionManagerRead,
@@ -941,8 +941,8 @@ pub async fn routing_retrieve_linked_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id,
@@ -973,8 +973,8 @@ pub async fn routing_retrieve_linked_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileRoutingRead,
@@ -1019,8 +1019,8 @@ pub async fn routing_retrieve_linked_config(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuthProfileFromRoute {
profile_id: wrapper.profile_id,
@@ -1060,8 +1060,8 @@ pub async fn routing_retrieve_default_config_for_profiles(
#[cfg(not(feature = "release"))]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRoutingRead,
@@ -1071,8 +1071,8 @@ pub async fn routing_retrieve_default_config_for_profiles(
#[cfg(feature = "release")]
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantRoutingRead,
@@ -1113,8 +1113,8 @@ pub async fn routing_update_default_config_for_profile(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: routing_payload_wrapper.profile_id,
@@ -1166,8 +1166,8 @@ pub async fn create_success_based_routing(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: wrapper.profile_id,
@@ -1210,8 +1210,8 @@ pub async fn success_based_routing_update_configs(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: routing_payload_wrapper.profile_id,
@@ -1254,8 +1254,8 @@ pub async fn elimination_routing_update_configs(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: routing_payload_wrapper.profile_id,
@@ -1303,8 +1303,8 @@ pub async fn contract_based_routing_setup_config(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: routing_payload_wrapper.profile_id,
@@ -1351,8 +1351,8 @@ pub async fn contract_based_routing_update_configs(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: routing_payload_wrapper.profile_id,
@@ -1404,8 +1404,8 @@ pub async fn create_elimination_routing(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: wrapper.profile_id,
@@ -1454,8 +1454,8 @@ pub async fn set_dynamic_routing_volume_split(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: payload.profile_id,
@@ -1488,8 +1488,8 @@ pub async fn get_dynamic_routing_volume_split(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuthProfileFromRoute {
profile_id: payload.profile_id,
@@ -1535,8 +1535,8 @@ pub async fn evaluate_routing_rule(
Ok(services::ApplicationResponse::Json(euclid_response))
},
&auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -1618,8 +1618,8 @@ pub async fn call_decide_gateway_open_router(
payload.clone(),
|state, _auth, payload, _| routing::decide_gateway_open_router(state.clone(), payload),
&auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
@@ -1643,8 +1643,8 @@ pub async fn call_update_gateway_score_open_router(
routing::update_gateway_score_open_router(state.clone(), payload)
},
&auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/subscription.rs b/crates/router/src/routes/subscription.rs
index e94d7f8588..2c2fd53ad0 100644
--- a/crates/router/src/routes/subscription.rs
+++ b/crates/router/src/routes/subscription.rs
@@ -76,8 +76,8 @@ pub async fn create_subscription(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileSubscriptionWrite,
@@ -117,8 +117,8 @@ pub async fn pause_subscription(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -153,8 +153,8 @@ pub async fn resume_subscription(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -189,8 +189,8 @@ pub async fn cancel_subscription(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -320,8 +320,8 @@ pub async fn get_subscription(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileSubscriptionRead,
@@ -359,8 +359,8 @@ pub async fn create_and_confirm_subscription(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileSubscriptionWrite,
@@ -385,8 +385,8 @@ pub async fn get_estimate(
Err(response) => return response,
};
let api_auth = auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
};
let (auth_type, _auth_flow) = match auth::get_auth_type_and_flow(req.headers(), api_auth) {
Ok(auth) => auth,
@@ -434,8 +434,8 @@ pub async fn update_subscription(
)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
@@ -470,8 +470,8 @@ pub async fn list_subscriptions(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileSubscriptionRead,
diff --git a/crates/router/src/routes/three_ds_decision_rule.rs b/crates/router/src/routes/three_ds_decision_rule.rs
index dab8a8ca7f..9c707d354a 100644
--- a/crates/router/src/routes/three_ds_decision_rule.rs
+++ b/crates/router/src/routes/three_ds_decision_rule.rs
@@ -25,8 +25,8 @@ pub async fn execute_decision_rule(
three_ds_decision_rule_core::execute_three_ds_decision_rule(state, auth.platform, req)
},
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/tokenization.rs b/crates/router/src/routes/tokenization.rs
index 1ed44ce660..40b4dce334 100644
--- a/crates/router/src/routes/tokenization.rs
+++ b/crates/router/src/routes/tokenization.rs
@@ -55,8 +55,8 @@ pub async fn create_token_vault_api(
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(common_utils::types::authentication::ResourceId::Customer(
customer_id,
@@ -91,8 +91,8 @@ pub async fn delete_tokenized_data_api(
},
auth::api_or_client_auth(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::V2ClientAuth(
common_utils::types::authentication::ResourceId::PaymentMethodSession(session_id),
diff --git a/crates/router/src/routes/user.rs b/crates/router/src/routes/user.rs
index 8767ab81ec..3364cf3c61 100644
--- a/crates/router/src/routes/user.rs
+++ b/crates/router/src/routes/user.rs
@@ -1083,8 +1083,8 @@ pub async fn issue_embedded_token(
)
},
&auth::ApiKeyAuth {
- is_platform_allowed: false,
- is_connected_allowed: false,
+ allow_platform_self_operation: false,
+ allow_connected_scope_operation: false,
},
api_locking::LockAction::NotApplicable,
))
diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rs
index 0cb7d55c5b..9566a6f737 100644
--- a/crates/router/src/routes/verification.rs
+++ b/crates/router/src/routes/verification.rs
@@ -33,8 +33,8 @@ pub async fn apple_pay_merchant_registration(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::ProfileAccountWrite,
@@ -71,8 +71,8 @@ pub async fn apple_pay_merchant_registration(
},
auth::auth_type(
&auth::V2ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
},
&auth::JWTAuth {
permission: Permission::ProfileAccountWrite,
@@ -108,8 +108,8 @@ pub async fn retrieve_apple_pay_verified_domains(
},
auth::auth_type(
&auth::HeaderAuth(auth::ApiKeyAuth {
- is_connected_allowed: false,
- is_platform_allowed: false,
+ allow_connected_scope_operation: false,
+ allow_platform_self_operation: false,
}),
&auth::JWTAuth {
permission: Permission::MerchantAccountRead,
diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs
index 7ad68e29f8..d16cf909d9 100644
--- a/crates/router/src/services/authentication.rs
+++ b/crates/router/src/services/authentication.rs
@@ -375,8 +375,8 @@ where
#[derive(Debug, Default)]
pub struct ApiKeyAuth {
- pub is_connected_allowed: bool,
- pub is_platform_allowed: bool,
+ pub allow_connected_scope_operation: bool,
+ pub allow_platform_self_operation: bool,
}
pub struct NoAuth;
@@ -440,17 +440,17 @@ impl GetAuthType for ApiKeyAuth {
#[cfg(feature = "partial-auth")]
pub trait GetMerchantAccessFlags {
- fn get_is_connected_allowed(&self) -> bool;
- fn get_is_platform_allowed(&self) -> bool;
+ fn is_connected_scope_operation_allowed(&self) -> bool;
+ fn is_platform_self_operation_allowed(&self) -> bool;
}
#[cfg(feature = "partial-auth")]
impl GetMerchantAccessFlags for ApiKeyAuth {
- fn get_is_connected_allowed(&self) -> bool {
- self.is_connected_allowed
+ fn is_connected_scope_operation_allowed(&self) -> bool {
+ self.allow_connected_scope_operation
}
- fn get_is_platform_allowed(&self) -> bool {
- self.is_platform_allowed
+ fn is_platform_self_operation_allowed(&self) -> bool {
+ self.allow_platform_self_operation
}
}
@@ -597,11 +597,13 @@ where
.await
.to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
+ // Validate access based on merchant type and header presence
check_merchant_access(
state,
+ request_headers,
initiator_merchant.merchant_account_type,
- self.is_connected_allowed,
- self.is_platform_allowed,
+ self.allow_connected_scope_operation,
+ self.allow_platform_self_operation,
)?;
let platform = resolve_platform(
@@ -692,11 +694,13 @@ where
.await
.to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
+ // Validate access based on merchant type and header presence
check_merchant_access(
state,
+ request_headers,
initiator_merchant.merchant_account_type,
- self.is_connected_allowed,
- self.is_platform_allowed,
+ self.allow_connected_scope_operation,
+ self.allow_platform_self_operation,
)?;
let platform = resolve_platform(
@@ -754,9 +758,10 @@ where
request_headers: &HeaderMap,
state: &A,
) -> RouterResult<(AuthenticationData, AuthenticationType)> {
+ // This is currently used for profile and connector CRUD operations
let api_auth = ApiKeyAuth {
- is_connected_allowed: true,
- is_platform_allowed: false,
+ allow_connected_scope_operation: true,
+ allow_platform_self_operation: false,
};
let (auth_data, auth_type) = api_auth
.authenticate_and_fetch(request_headers, state)
@@ -1204,8 +1209,8 @@ where
&merchant_id,
request_headers,
profile_id,
- self.0.get_is_connected_allowed(),
- self.0.get_is_platform_allowed(),
+ self.0.is_connected_scope_operation_allowed(),
+ self.0.is_platform_self_operation_allowed(),
)
.await?;
Ok((
@@ -1226,8 +1231,8 @@ where
&merchant_id,
request_headers,
profile_id,
- self.0.get_is_connected_allowed(),
- self.0.get_is_platform_allowed(),
+ self.0.is_connected_scope_operation_allowed(),
+ self.0.is_platform_self_operation_allowed(),
)
.await?;
Ok((
@@ -1303,8 +1308,8 @@ async fn construct_authentication_data<A>(
merchant_id: &id_type::MerchantId,
request_headers: &HeaderMap,
profile_id: Option<id_type::ProfileId>,
- is_connected_allowed: bool,
- is_platform_allowed: bool,
+ allow_connected_scope_operation: bool,
+ allow_platform_self_operation: bool,
) -> RouterResult<AuthenticationData>
where
A: SessionStateInfo + Sync,
@@ -1325,12 +1330,13 @@ where
.await
.to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
- // Validate merchant account type access
+ // Validate access based on merchant type and header presence
check_merchant_access(
state,
+ request_headers,
initiator_merchant.merchant_account_type,
- is_connected_allowed,
- is_platform_allowed,
+ allow_connected_scope_operation,
+ allow_platform_self_operation,
)?;
let platform = resolve_platform(state, request_headers, initiator_merchant, key_store).await?;
@@ -2671,8 +2677,8 @@ where
#[cfg(feature = "v2")]
#[derive(Debug)]
pub struct V2ApiKeyAuth {
- pub is_connected_allowed: bool,
- pub is_platform_allowed: bool,
+ pub allow_connected_scope_operation: bool,
+ pub allow_platform_self_operation: bool,
}
#[cfg(feature = "v2")]
@@ -2751,11 +2757,13 @@ where
.await
.to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
+ // Validate access based on merchant type and header presence
check_merchant_access(
state,
+ request_headers,
initiator_merchant.merchant_account_type,
- self.is_connected_allowed,
- self.is_platform_allowed,
+ self.allow_connected_scope_operation,
+ self.allow_platform_self_operation,
)?;
let platform = resolve_platform(
@@ -2936,8 +2944,8 @@ where
}
#[derive(Debug, Default)]
pub struct PublishableKeyAuth {
- pub is_connected_allowed: bool,
- pub is_platform_allowed: bool,
+ pub allow_connected_scope_operation: bool,
+ pub allow_platform_self_operation: bool,
}
#[cfg(feature = "partial-auth")]
@@ -2949,11 +2957,11 @@ impl GetAuthType for PublishableKeyAuth {
#[cfg(feature = "partial-auth")]
impl GetMerchantAccessFlags for PublishableKeyAuth {
- fn get_is_connected_allowed(&self) -> bool {
- self.is_connected_allowed
+ fn is_connected_scope_operation_allowed(&self) -> bool {
+ self.allow_connected_scope_operation
}
- fn get_is_platform_allowed(&self) -> bool {
- self.is_platform_allowed
+ fn is_platform_self_operation_allowed(&self) -> bool {
+ self.allow_platform_self_operation
}
}
@@ -2978,12 +2986,13 @@ where
.await
.to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
- // Check access permissions using existing function
+ // Validate access based on merchant type and header presence
check_merchant_access(
state,
+ request_headers,
initiator_merchant.merchant_account_type,
- self.is_connected_allowed,
- self.is_platform_allowed,
+ self.allow_connected_scope_operation,
+ self.allow_platform_self_operation,
)?;
let platform = resolve_platform(
@@ -3031,12 +3040,13 @@ where
.await
.to_not_found_response(errors::ApiErrorResponse::Unauthorized)?;
- // Check access permissions using existing function
+ // Validate access based on merchant type and header presence
check_merchant_access(
state,
+ request_headers,
initiator_merchant.merchant_account_type,
- self.is_connected_allowed,
- self.is_platform_allowed,
+ self.allow_connected_scope_operation,
+ self.allow_platform_self_operation,
)?;
let platform = resolve_platform(
@@ -4763,8 +4773,8 @@ pub fn get_auth_type_and_flow<A: SessionStateInfo + Sync + Send>(
if api_key.starts_with("pk_") {
return Ok((
Box::new(HeaderAuth(PublishableKeyAuth {
- is_connected_allowed: api_auth.is_connected_allowed,
- is_platform_allowed: api_auth.is_platform_allowed,
+ allow_connected_scope_operation: api_auth.allow_connected_scope_operation,
+ allow_platform_self_operation: api_auth.allow_platform_self_operation,
})),
api::AuthFlow::Client,
));
@@ -4795,8 +4805,8 @@ where
})?;
return Ok((
Box::new(HeaderAuth(PublishableKeyAuth {
- is_connected_allowed: api_auth.is_connected_allowed,
- is_platform_allowed: api_auth.is_platform_allowed,
+ allow_connected_scope_operation: api_auth.allow_connected_scope_operation,
+ allow_platform_self_operation: api_auth.allow_platform_self_operation,
})),
api::AuthFlow::Client,
));
@@ -5124,16 +5134,36 @@ where
}
/// Validates whether the merchant account type is authorized to access the resource
+///
+/// # Access Control Logic:
+/// - **Connected Merchant**: Allowed if `allow_connected_scope_operation` is true (no header required)
+/// - **Platform Merchant**:
+/// - With `X-Connected-Merchant-Id` header: Allowed if `allow_connected_scope_operation` is true
+/// (platform acting on behalf of connected merchant)
+/// - Without header: Allowed if `allow_platform_self_operation` is true
+/// (platform self operation)
+/// - **Standard Merchant**: Always allowed
pub fn check_merchant_access<A>(
state: &A,
- merchant_account_type: MerchantAccountType,
- is_connected_allowed: bool,
- is_platform_allowed: bool,
+ request_headers: &HeaderMap,
+ initiator_merchant_account_type: MerchantAccountType,
+ allow_connected_scope_operation: bool,
+ allow_platform_self_operation: bool,
) -> Result<(), error_stack::Report<errors::ApiErrorResponse>>
where
A: SessionStateInfo + Sync,
{
- match merchant_account_type {
+ // Check if connected merchant header is present
+ let has_connected_merchant_header = HeaderMapStruct::new(request_headers)
+ .get_id_type_from_header_if_present::<id_type::MerchantId>(headers::X_CONNECTED_MERCHANT_ID)
+ .map_err(|e| {
+ e.change_context(errors::ApiErrorResponse::InvalidRequestData {
+ message: "Invalid X-Connected-Merchant-Id header".to_string(),
+ })
+ })?
+ .is_some();
+
+ match initiator_merchant_account_type {
MerchantAccountType::Connected => {
// Check if platform feature is enabled
state.conf().platform.enabled.then_some(()).ok_or_else(|| {
@@ -5141,10 +5171,15 @@ where
.attach_printable("Platform feature is not enabled")
})?;
- is_connected_allowed.then_some(()).ok_or_else(|| {
- report!(errors::ApiErrorResponse::ConnectedAccountAuthNotSupported)
- .attach_printable("Connected Merchant is not authorized to access the resource")
- })
+ // Connected merchant can perform operation if allow_connected_scope_operation is true
+ allow_connected_scope_operation
+ .then_some(())
+ .ok_or_else(|| {
+ report!(errors::ApiErrorResponse::ConnectedAccountAuthNotSupported)
+ .attach_printable(
+ "Connected Merchant is not authorized to access the resource",
+ )
+ })
}
MerchantAccountType::Platform => {
// Check if platform feature is enabled
@@ -5153,11 +5188,23 @@ where
.attach_printable("Platform feature is not enabled")
})?;
- // Check if platform is allowed for this resource
- is_platform_allowed.then_some(()).ok_or_else(|| {
- report!(errors::ApiErrorResponse::PlatformAccountAuthNotSupported)
- .attach_printable("Platform Merchant is not authorized to access the resource")
- })
+ if has_connected_merchant_header {
+ // Platform is acting on behalf of a connected merchant
+ // Requires allow_connected_scope_operation to be true
+ allow_connected_scope_operation.then_some(()).ok_or_else(|| {
+ report!(errors::ApiErrorResponse::ConnectedAccountAuthNotSupported)
+ .attach_printable("Platform is not authorized to perform this operation on behalf of connected merchant")
+ })
+ } else {
+ // Platform is performing a self operation (no connected merchant header)
+ // Requires allow_platform_self_operation to be true
+ allow_platform_self_operation.then_some(()).ok_or_else(|| {
+ report!(errors::ApiErrorResponse::PlatformAccountAuthNotSupported)
+ .attach_printable(
+ "Platform Merchant is not authorized to access the resource",
+ )
+ })
+ }
}
MerchantAccountType::Standard => Ok(()),
}
@@ -5208,12 +5255,20 @@ where
Ok((connected_merchant_account, key_store))
}
-/// Resolves processor and provider merchant accounts
+/// Resolves processor and provider merchant accounts based on merchant type and headers
+///
+/// This function handles the resolution of merchant accounts for platform operations:
+/// - **Platform Merchant**: Uses `X-Connected-Merchant-Id` header to act on behalf of connected merchant,
+/// or operates as self if header is absent
+/// - **Connected Merchant**: Resolves the platform account for the connected merchant
+/// - **Standard Merchant**: Returns the merchant as-is
+///
+/// Note: Access control validation should be done via `check_merchant_access` before calling this function
async fn resolve_platform<A>(
state: &A,
request_headers: &HeaderMap,
initiator_merchant_account: domain::MerchantAccount,
- merchant_key_store: domain::MerchantKeyStore,
+ initiator_merchant_key_store: domain::MerchantKeyStore,
) -> RouterResult<domain::Platform>
where
A: SessionStateInfo + Sync,
@@ -5242,7 +5297,7 @@ where
}
None => (
initiator_merchant_account.clone(),
- merchant_key_store.clone(),
+ initiator_merchant_key_store.clone(),
),
};
@@ -5251,7 +5306,7 @@ where
processor_key_store,
Some(PlatformAccountWithKeyStore {
account: initiator_merchant_account.clone(),
- key_store: merchant_key_store,
+ key_store: initiator_merchant_key_store,
}),
)
}
@@ -5275,7 +5330,7 @@ where
(
initiator_merchant_account.clone(),
- merchant_key_store,
+ initiator_merchant_key_store,
Some(PlatformAccountWithKeyStore {
account: platform_account,
key_store: platform_key_store,
@@ -5297,7 +5352,11 @@ where
},
)?;
- (initiator_merchant_account.clone(), merchant_key_store, None)
+ (
+ initiator_merchant_account.clone(),
+ initiator_merchant_key_store,
+ None,
+ )
}
};