fix(auth): check handle

This commit is contained in:
2026-02-11 10:55:26 +08:00
parent e29926a62b
commit ba6e39d60a
9 changed files with 239 additions and 24 deletions

View File

@@ -1,14 +1,15 @@
use axum::body::Body;
use axum::http::{Request, StatusCode};
use iam_service::presentation::http::api;
use iam_service::presentation::http::state::AppState;
use iam_service::infrastructure::repositories::tenant_config_repo::TenantConfigRepoPg;
use iam_service::models::CreateTenantRequest;
use iam_service::models::CreateUserRequest;
use iam_service::application::services::{
AppService, AuthService, AuthorizationService, ClientService, PermissionService, RoleService,
TenantService, UserService,
};
use iam_service::constants::CANONICAL_BASE;
use iam_service::infrastructure::repositories::tenant_config_repo::TenantConfigRepoPg;
use iam_service::models::CreateTenantRequest;
use iam_service::models::CreateUserRequest;
use iam_service::presentation::http::api;
use iam_service::presentation::http::state::AppState;
use redis::aio::ConnectionManager;
use sqlx::PgPool;
use tower::ServiceExt;
@@ -106,7 +107,7 @@ async fn code2token_modes_requirements() -> Result<(), Box<dyn std::error::Error
.oneshot(
Request::builder()
.method("POST")
.uri("/api/v1/auth/login-code")
.uri(format!("{}/auth/login-code", CANONICAL_BASE))
.header("Content-Type", "application/json")
.header("X-Tenant-ID", tenant.id.to_string())
.body(Body::from(login_code_req.to_string()))?,
@@ -134,7 +135,7 @@ async fn code2token_modes_requirements() -> Result<(), Box<dyn std::error::Error
.oneshot(
Request::builder()
.method("POST")
.uri("/api/v1/auth/code2token")
.uri(format!("{}/auth/code2token", CANONICAL_BASE))
.header("Content-Type", "application/json")
.header("X-Tenant-ID", tenant.id.to_string())
.body(Body::from(code2token_req.to_string()))?,
@@ -152,7 +153,7 @@ async fn code2token_modes_requirements() -> Result<(), Box<dyn std::error::Error
.oneshot(
Request::builder()
.method("POST")
.uri("/api/v1/auth/code2token")
.uri(format!("{}/auth/code2token", CANONICAL_BASE))
.header("Content-Type", "application/json")
.body(Body::from(code2token_req_missing_tenant.to_string()))?,
)
@@ -168,7 +169,7 @@ async fn code2token_modes_requirements() -> Result<(), Box<dyn std::error::Error
.oneshot(
Request::builder()
.method("POST")
.uri("/api/v1/internal/auth/code2token")
.uri(format!("{}/internal/auth/code2token", CANONICAL_BASE))
.header("Content-Type", "application/json")
.header("X-Internal-Token", internal_psk)
.body(Body::from(code2token_req_internal.to_string()))?,