0

我是 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();
    }
4

1 回答 1

0

当身份验证设置为匿名和 Windows 身份验证时,如何返回用户的计算机名?

据我所知,如果你已经启用了匿名认证,那就意味着所有的用户都不会使用windows auth,它会使用你的IIS匿名用户作为用户帐户。

根据您的设置,用户帐户可以是特定用户或身份池用户。

在此处输入图像描述

如果您禁用匿名身份验证,它将使用客户端用户的域用户名,该用户名可以由客户端 uswer 设置来访问您的 Web 应用程序。

于 2020-01-27T04:59:09.700 回答