mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
feat(router): Add new JWT authentication variants and use them (#2835)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -5,6 +5,7 @@ pub mod payment;
|
||||
pub mod payouts;
|
||||
pub mod refund;
|
||||
pub mod routing;
|
||||
pub mod user;
|
||||
|
||||
use common_utils::{
|
||||
events::{ApiEventMetric, ApiEventsType},
|
||||
|
||||
14
crates/api_models/src/events/user.rs
Normal file
14
crates/api_models/src/events/user.rs
Normal file
@ -0,0 +1,14 @@
|
||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
|
||||
use crate::user::{ConnectAccountRequest, ConnectAccountResponse};
|
||||
|
||||
impl ApiEventMetric for ConnectAccountResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::User {
|
||||
merchant_id: self.merchant_id.clone(),
|
||||
user_id: self.user_id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ApiEventMetric for ConnectAccountRequest {}
|
||||
@ -21,5 +21,6 @@ pub mod payments;
|
||||
pub mod payouts;
|
||||
pub mod refunds;
|
||||
pub mod routing;
|
||||
pub mod user;
|
||||
pub mod verifications;
|
||||
pub mod webhooks;
|
||||
|
||||
21
crates/api_models/src/user.rs
Normal file
21
crates/api_models/src/user.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use common_utils::pii;
|
||||
use masking::Secret;
|
||||
|
||||
#[derive(serde::Deserialize, Debug, Clone, serde::Serialize)]
|
||||
pub struct ConnectAccountRequest {
|
||||
pub email: pii::Email,
|
||||
pub password: Secret<String>,
|
||||
}
|
||||
|
||||
#[derive(serde::Serialize, Debug, Clone)]
|
||||
pub struct ConnectAccountResponse {
|
||||
pub token: Secret<String>,
|
||||
pub merchant_id: String,
|
||||
pub name: Secret<String>,
|
||||
pub email: pii::Email,
|
||||
pub verification_days_left: Option<i64>,
|
||||
pub user_role: String,
|
||||
//this field is added for audit/debug reasons
|
||||
#[serde(skip_serializing)]
|
||||
pub user_id: String,
|
||||
}
|
||||
Reference in New Issue
Block a user