0

maybe I am thinking to complicated. I want to make a website available inside of the company and doing the authentication through the Active Directory:

services.AddAuthentication(IISDefaults.AuthenticationScheme);

This works and when I use a special admin user I can only access the correct sub-site.

[Authorize(Roles = "ADAdminGroup")]

But now, after a while, I noticed that this doesn’t make much sense because the user is not using his or hers special admin user but instead the normal user account. What I would like to achieve is, when you click on a link where the normal user has no access to that the browser login window pops up. I think / hope this will be easier to realize than a complete separated login process? Or maybe checking the role members?

Is this possible, can you give me maybe some buzzwords? So far I could only find issue where the login window appeared unwanted.

Thanks

Stephan


Update: After playing other 2 hours with it I installed on my personal laptop Visual Studio and the same setting works on IISExpress launched by Visual Studio. I also had to activate as Anonymous access it was written here: Asp.Net Core Windows Authentication Not Working in IIS I tried it again on my working laptop which is domain joined and I don't get the Windows Authentication prompt, but I think it has something to do with IIS (Windows Server 2019)...

Stephan
  • 335
  • 3
  • 12
  • You didn't get prompt just because web browser will send user credential in intranet network. Since windows authentication are just token based authentication. You can't change auth user dynamically. I think you need to allow anonymous authentication and windows authentication at the same time. So that you can use different authorize filter for different authentication. – Jokies Ding May 19 '20 at 08:38
  • Hi, yes, I tried this, but still do not get request prompt. Probably I just have to live it or try to implement a login process. – Stephan May 21 '20 at 12:29
  • Have you tried to set "prompt for user name and password always" in IE intranet custom level? – Jokies Ding Jun 02 '20 at 10:06

0 Answers0