我是 IIS 部署的新手。看起来应用程序池身份用户将始终显示为用户的计算机名称。因此,如果我们使用域/用户名作为应用程序池标识,它将始终处理域/用户名,无论谁登录了应用程序。
当身份验证设置为匿名和 Windows 身份验证时,如何返回用户的计算机名?
这是我在 Startup.cs 上的内容
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
//app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
OAuthAuthorizationServerOptions option = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/token"),
Provider = new ApplicationOAuthProvider(),
AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(300),
AllowInsecureHttp = true
};
app.UseOAuthAuthorizationServer(option);
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
}
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(IISDefaults.AuthenticationScheme);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseAuthentication();
}
