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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
fix(users): revert using mget in authorization (#3999)
Mani Chandra7375b866a2a2
diff --git a/crates/router/src/services/authentication/blacklist.rs b/crates/router/src/services/authentication/blacklist.rsindex b5cdcaf084..2ee8302be6 100644--- a/crates/router/src/services/authentication/blacklist.rs+++ b/crates/router/src/services/authentication/blacklist.rs@@ -80,25 +80,19 @@ pub async fn check_user_in_blacklist<A: AppStateInfo>(.map(|timestamp| timestamp.map_or(false, |timestamp| timestamp > token_issued_at))}-pub async fn check_user_and_role_in_blacklist<A: AppStateInfo>(+pub async fn check_role_in_blacklist<A: AppStateInfo>(state: &A,- user_id: &str,role_id: &str,token_expiry: u64,) -> RouterResult<bool> {- let user_token = format!("{}{}", USER_BLACKLIST_PREFIX, user_id);- let role_token = format!("{}{}", ROLE_BLACKLIST_PREFIX, role_id);+ let token = format!("{}{}", ROLE_BLACKLIST_PREFIX, role_id);let token_issued_at = expiry_to_i64(token_expiry - JWT_TOKEN_TIME_IN_SECS)?;let redis_conn = get_redis_connection(state)?;-- Ok(redis_conn- .get_multiple_keys::<Vec<&str>, i64>(vec![user_token.as_str(), role_token.as_str()])+ redis_conn+ .get_key::<Option<i64>>(token.as_str()).await- .change_context(ApiErrorResponse::InternalServerError)?- .into_iter()- .max()- .flatten()- .map_or(false, |timestamp| timestamp > token_issued_at))+ .change_context(ApiErrorResponse::InternalServerError)+ .map(|timestamp| timestamp.map_or(false, |timestamp| timestamp > token_issued_at))}#[cfg(feature = "email")]@@ -156,7 +150,10 @@ impl BlackList for AuthToken {whereA: AppStateInfo + Sync,{- check_user_and_role_in_blacklist(state, &self.user_id, &self.role_id, self.exp).await+ Ok(+ check_user_in_blacklist(state, &self.user_id, self.exp).await?+ || check_role_in_blacklist(state, &self.role_id, self.exp).await?,+ )}}