Looking for some help here please...
I created a blank application [Blazor Web Application .Net 8] for test (No DB / Data / New Page added) using Radzen Blazor Studio 1.25.0
Next I added "WINDOWS" Authentication (again by using Radzen Blazor Studio). Next (just to validate windows Auth Functionality), I added the following in my MainLayout.razor.cs
using System.Security.Principal;
// Property to hold the Windows User ID
public string WindowsUserID { get; private set; }
// Inject IConfiguration for accessing app settings
[Inject]
public IConfiguration Configuration { get; set; }
// Property to hold the environment label
public string EnvironmentLabel { get; private set; }
// Property to hold the background color for the environment label
public string EnvironmentBackgroundColor { get; private set; }
protected override void OnInitialized()
{
// Get the Windows identity of the current user
WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();
// Extract the user ID from the Windows identity
WindowsUserID = windowsIdentity != null ? windowsIdentity.Name : "Unknown";
base.OnInitialized();
}
And also I added the following in MainLayout.razor.... (to just reflect windows ID)
<RadzenStack AlignItems="AlignItems.Center" Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.End" Gap="">
<RadzenLabel Style="font-style: italic">You logged in as: @WindowsUserID</RadzenLabel>
</RadzenStack>
~ Next I selected "Run" and then it indeed returning my windows id [DC1\AVIKMUKH] and then I "Published" in a folder and then moved that folder to my dev web server (new build Windows Server 2019). Over there I have IIS10 and also .Net runtime 8 etc... Currently All my Application pools are off and all sites (including IIS Default Web Site) are stopped.
So I created a new Application Pool - [AuthTest]. Created a new Site [AuthTest] and pointed to physical location of my site contents. It is running on port 8080.
The issue is - I am getting logged in As: IIS APPPOOL\AuthTest instead of my windows id [DC1\AVIKMUKH] despite I logged into the Server using my Windows ID. Also to note that my Windows ID is an Admin in Server location.
Next to that, I tried debugging in multiple ways
a) Changed port: 80 ; 85; 8082 etc etc... and same result everytime.
b) Tried changing Identity of AuthTest Application pool ti some other users, such as a service Account (admin) [DC1\SVC_ADMIN4478] ~ then that time, my site showing logged in as DC1\SVC_ADMIN4478
i.e. Whatever we put in Identity of App Pool that's what is used in the Site, instead of really getting Authenticated by Windows ID.
Any help would be highly appreciated... I was cluelessly browsing Microsoft's guideline for Windows
Auth in blazor. But not yet sure what I am missing?
Tried also to add the following segment in Web.config but no luck...
<system.web>
<identity impersonate="false" />
<authentication mode="Windows" />
<httpCookies httpOnlyCookies="true" requireSSL="true" />
<authorization>
<!-- uncomment to use windows auth -->
<deny users="?" />
</authorization>
</system.web>