簡體   English   中英

對於應用程序池身份,當身份驗證設置為匿名和 Windows 身份驗證時,您如何返回登錄用戶?

[英]For Application Pool Identity, how do you return the logged in user when authentication is both set to anonymous and windows authentication?

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

當身份驗證設置為匿名和 Windows 身份驗證時,如何返回用戶的計算機名稱?

據我所知,如果您已經啟用了匿名身份驗證,則意味着所有用戶都不會使用windows auth,它將使用您的IIS 匿名用戶作為用戶帳戶。

根據您的設置,用戶帳戶可以是特定用戶或身份池用戶。

在此處輸入圖片說明

如果您禁用匿名身份驗證,它將使用客戶端用戶的域用戶名,該用戶名可以由客戶端 uswer 設置來訪問您的 Web 應用程序。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM