如何在身份服务器 4 中获取客户端的远程 IP 地址

How to get remote IP Address of client in identity server 4

上下文变量 (ResourceOwnerPasswordValidationContext) 中是否有 属性 让我访问发送初始身份验证请求的客户端的 IP 地址。

没有这样的信息供您在该上下文中获取。您唯一的选择是将 IHttpContextAccessor 注入到您的 ResourceOwnerPasswordValidator 中,然后您可以从 HttpContext.Request 对象中获取请求 IP。