feat: account plat native auth handling
This commit is contained in:
@@ -90,6 +90,11 @@ pub async fn start_sdkserver() -> Result<()> {
|
|||||||
sr_tools::SRTOOLS_UPLOAD_ENDPOINT,
|
sr_tools::SRTOOLS_UPLOAD_ENDPOINT,
|
||||||
post(sr_tools::sr_tool_save),
|
post(sr_tools::sr_tool_save),
|
||||||
)
|
)
|
||||||
|
.route(
|
||||||
|
auth::APN_LOGIN_BY_PASSWORD_ENDPOINT,
|
||||||
|
post(auth::apn_login_with_password),
|
||||||
|
)
|
||||||
|
.route(auth::APN_VERIFY_TOKEN_ENDPOINT, post(auth::apn_veriy_token))
|
||||||
.layer(
|
.layer(
|
||||||
CorsLayer::new()
|
CorsLayer::new()
|
||||||
.allow_origin(Any)
|
.allow_origin(Any)
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ use serde_json::json;
|
|||||||
|
|
||||||
pub const LOGIN_WITH_PASSWORD_ENDPOINT: &str = "/{product_name}/mdk/shield/api/login";
|
pub const LOGIN_WITH_PASSWORD_ENDPOINT: &str = "/{product_name}/mdk/shield/api/login";
|
||||||
pub const LOGIN_WITH_SESSION_TOKEN_ENDPOINT: &str = "/{product_name}/mdk/shield/api/verify";
|
pub const LOGIN_WITH_SESSION_TOKEN_ENDPOINT: &str = "/{product_name}/mdk/shield/api/verify";
|
||||||
pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str = "/{product_name}/combo/granter/login/v2/login";
|
pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str =
|
||||||
|
"/{product_name}/combo/granter/login/v2/login";
|
||||||
pub const RISKY_API_CHECK_ENDPOINT: &str = "/account/risky/api/check";
|
pub const RISKY_API_CHECK_ENDPOINT: &str = "/account/risky/api/check";
|
||||||
|
pub const APN_LOGIN_BY_PASSWORD_ENDPOINT: &str = "/account/ma-cn-passport/app/loginByPassword";
|
||||||
|
pub const APN_VERIFY_TOKEN_ENDPOINT: &str = "/account/ma-cn-session/app/verify";
|
||||||
|
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
pub async fn login_with_password() -> Json<serde_json::Value> {
|
pub async fn login_with_password() -> Json<serde_json::Value> {
|
||||||
@@ -78,3 +81,51 @@ pub async fn risky_api_check() -> Json<serde_json::Value> {
|
|||||||
"retcode": 0
|
"retcode": 0
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
pub async fn apn_login_with_password() -> Json<serde_json::Value> {
|
||||||
|
Json(json!({
|
||||||
|
"data": {
|
||||||
|
"token": {
|
||||||
|
"token": "mostsecuretokenever",
|
||||||
|
"token_type": 1
|
||||||
|
},
|
||||||
|
"user_info": {
|
||||||
|
"aid": "1337",
|
||||||
|
"mid": "1337",
|
||||||
|
"is_email_verify": 1,
|
||||||
|
"area_code": "**",
|
||||||
|
"country": "US",
|
||||||
|
"is_adult": 1,
|
||||||
|
"email": "motorized@wheel.chair"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"message": "OK",
|
||||||
|
"retcode": 0
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument]
|
||||||
|
pub async fn apn_veriy_token() -> Json<serde_json::Value> {
|
||||||
|
Json(json!({
|
||||||
|
"data": {
|
||||||
|
"tokens": [
|
||||||
|
{
|
||||||
|
"token": "mostsecuretokenever",
|
||||||
|
"token_type": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"user_info": {
|
||||||
|
"aid": "1337",
|
||||||
|
"mid": "1337",
|
||||||
|
"is_email_verify": 1,
|
||||||
|
"area_code": "**",
|
||||||
|
"country": "US",
|
||||||
|
"is_adult": 1,
|
||||||
|
"email": "motorized@wheel.chair"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"message": "OK",
|
||||||
|
"retcode": 0
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user