mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
fix(router): populate profile_id in for the HeaderAuth of v1 (#6936)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -419,7 +419,7 @@ outgoing_enabled = true
|
|||||||
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
|
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
|
||||||
|
|
||||||
[unmasked_headers]
|
[unmasked_headers]
|
||||||
keys = "accept-language,user-agent"
|
keys = "accept-language,user-agent,x-profile-id"
|
||||||
|
|
||||||
[saved_payment_methods]
|
[saved_payment_methods]
|
||||||
sdk_eligible_payment_methods = "card"
|
sdk_eligible_payment_methods = "card"
|
||||||
|
|||||||
@ -435,7 +435,7 @@ outgoing_enabled = true
|
|||||||
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
|
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
|
||||||
|
|
||||||
[unmasked_headers]
|
[unmasked_headers]
|
||||||
keys = "accept-language,user-agent"
|
keys = "accept-language,user-agent,x-profile-id"
|
||||||
|
|
||||||
[saved_payment_methods]
|
[saved_payment_methods]
|
||||||
sdk_eligible_payment_methods = "card"
|
sdk_eligible_payment_methods = "card"
|
||||||
|
|||||||
@ -437,7 +437,7 @@ outgoing_enabled = true
|
|||||||
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
|
connectors_with_webhook_source_verification_call = "paypal" # List of connectors which has additional source verification api-call
|
||||||
|
|
||||||
[unmasked_headers]
|
[unmasked_headers]
|
||||||
keys = "accept-language,user-agent"
|
keys = "accept-language,user-agent,x-profile-id"
|
||||||
|
|
||||||
[saved_payment_methods]
|
[saved_payment_methods]
|
||||||
sdk_eligible_payment_methods = "card"
|
sdk_eligible_payment_methods = "card"
|
||||||
|
|||||||
@ -768,7 +768,7 @@ enabled = true
|
|||||||
file_storage_backend = "file_system"
|
file_storage_backend = "file_system"
|
||||||
|
|
||||||
[unmasked_headers]
|
[unmasked_headers]
|
||||||
keys = "accept-language,user-agent"
|
keys = "accept-language,user-agent,x-profile-id"
|
||||||
|
|
||||||
[opensearch]
|
[opensearch]
|
||||||
host = "https://localhost:9200"
|
host = "https://localhost:9200"
|
||||||
|
|||||||
@ -609,7 +609,7 @@ source = "logs"
|
|||||||
file_storage_backend = "file_system"
|
file_storage_backend = "file_system"
|
||||||
|
|
||||||
[unmasked_headers]
|
[unmasked_headers]
|
||||||
keys = "accept-language,user-agent"
|
keys = "accept-language,user-agent,x-profile-id"
|
||||||
|
|
||||||
[opensearch]
|
[opensearch]
|
||||||
host = "https://opensearch:9200"
|
host = "https://opensearch:9200"
|
||||||
|
|||||||
@ -666,6 +666,13 @@ where
|
|||||||
metrics::PARTIAL_AUTH_FAILURE.add(1, &[]);
|
metrics::PARTIAL_AUTH_FAILURE.add(1, &[]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let profile_id = HeaderMapStruct::new(request_headers)
|
||||||
|
.get_id_type_from_header_if_present::<id_type::ProfileId>(headers::X_PROFILE_ID)
|
||||||
|
.change_context(errors::ValidationError::IncorrectValueProvided {
|
||||||
|
field_name: "X-Profile-Id",
|
||||||
|
})
|
||||||
|
.change_context(errors::ApiErrorResponse::Unauthorized)?;
|
||||||
|
|
||||||
let payload = ExtractedPayload::from_headers(request_headers)
|
let payload = ExtractedPayload::from_headers(request_headers)
|
||||||
.and_then(|value| {
|
.and_then(|value| {
|
||||||
let (algo, secret) = state.get_detached_auth()?;
|
let (algo, secret) = state.get_detached_auth()?;
|
||||||
@ -687,8 +694,13 @@ where
|
|||||||
merchant_id: Some(merchant_id),
|
merchant_id: Some(merchant_id),
|
||||||
key_id: Some(key_id),
|
key_id: Some(key_id),
|
||||||
} => {
|
} => {
|
||||||
let auth =
|
let auth = construct_authentication_data(
|
||||||
construct_authentication_data(state, &merchant_id, request_headers).await?;
|
state,
|
||||||
|
&merchant_id,
|
||||||
|
request_headers,
|
||||||
|
profile_id,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
Ok((
|
Ok((
|
||||||
auth.clone(),
|
auth.clone(),
|
||||||
AuthenticationType::ApiKey {
|
AuthenticationType::ApiKey {
|
||||||
@ -702,8 +714,13 @@ where
|
|||||||
merchant_id: Some(merchant_id),
|
merchant_id: Some(merchant_id),
|
||||||
key_id: None,
|
key_id: None,
|
||||||
} => {
|
} => {
|
||||||
let auth =
|
let auth = construct_authentication_data(
|
||||||
construct_authentication_data(state, &merchant_id, request_headers).await?;
|
state,
|
||||||
|
&merchant_id,
|
||||||
|
request_headers,
|
||||||
|
profile_id,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
Ok((
|
Ok((
|
||||||
auth.clone(),
|
auth.clone(),
|
||||||
AuthenticationType::PublishableKey {
|
AuthenticationType::PublishableKey {
|
||||||
@ -779,6 +796,7 @@ async fn construct_authentication_data<A>(
|
|||||||
state: &A,
|
state: &A,
|
||||||
merchant_id: &id_type::MerchantId,
|
merchant_id: &id_type::MerchantId,
|
||||||
request_headers: &HeaderMap,
|
request_headers: &HeaderMap,
|
||||||
|
profile_id: Option<id_type::ProfileId>,
|
||||||
) -> RouterResult<AuthenticationData>
|
) -> RouterResult<AuthenticationData>
|
||||||
where
|
where
|
||||||
A: SessionStateInfo + Sync,
|
A: SessionStateInfo + Sync,
|
||||||
@ -830,7 +848,7 @@ where
|
|||||||
merchant_account: merchant,
|
merchant_account: merchant,
|
||||||
platform_merchant_account,
|
platform_merchant_account,
|
||||||
key_store,
|
key_store,
|
||||||
profile_id: None,
|
profile_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(auth)
|
Ok(auth)
|
||||||
|
|||||||
@ -396,7 +396,7 @@ client_secret = ""
|
|||||||
partner_id = ""
|
partner_id = ""
|
||||||
|
|
||||||
[unmasked_headers]
|
[unmasked_headers]
|
||||||
keys = "accept-language,user-agent"
|
keys = "accept-language,user-agent,x-profile-id"
|
||||||
|
|
||||||
[multitenancy]
|
[multitenancy]
|
||||||
enabled = false
|
enabled = false
|
||||||
|
|||||||
Reference in New Issue
Block a user