Enforce API key IP restrictions in proxy auth

This commit is contained in:
RWDai
2026-05-18 20:47:28 +08:00
parent 276d19b63c
commit fc12cc8a36
4 changed files with 81 additions and 3 deletions

View File

@@ -317,6 +317,12 @@ pub(crate) fn build_local_auth_rejection_response(
StatusCode::FORBIDDEN,
&format!("{ACCESS_POLICY_SUBJECT}不允许访问模型 {model}"),
),
GatewayLocalAuthRejection::IpNotAllowed { remote_ip } => build_local_http_error_response(
trace_id,
control_decision,
StatusCode::UNAUTHORIZED,
&format!("API Key 不允许从当前 IP 访问: {remote_ip}"),
),
}
}