0

I have built a base web app using aps.net core 7. I am using windows auth. all is working but I am getting an alert popup to sign into the web app at top of browser window.

This is functionally ok but I would prefer to have a login form. Is this possible with this configuration?

Thanks

All is working functionally but I dont know where to start to configure a login form.

2
  • Hi Anthony, welcome to Stack! I think if you could give a few more details, it could help us give you some direction. Can you tell us if this is scaffolded code or something you wrote? Perhaps share some of the code you are having a problem with? What are some things you have tried so far that haven't worked? Commented Mar 10, 2023 at 15:42
  • Hi Ben thanks for reply. So I have built many intranet MVC apps with asp.net core. They follow basic guides on microsoft site, usual controller veiws, entity framework etc. I integrate with AD On prem using windows auth and usually get a browser popup for username and password. I now have a requirement to add in a login form to catch the username and password. The issue is that using windows auth boiler plate code is very simple but now I have to customise and I dont really know where to start. Commented Mar 11, 2023 at 11:26

1 Answer 1

0

while being curious on why you are required to move the login details from the browser-popup to a page I feel like you might be taking a wrong turn here. Please let me elaborate on that:

An advantage of Windows auth is that you do not need to explicitly authenticate yourself again against e. g. internal web-apps. You are already running your favorite browser in the context of your authenticated windows user. My guess is that you are getting the login-popup from your browser because there is no group-policy or setting in place that marks your web-apps URL as trusted. For details on getting rid of the login-popup from your browser you might want to start here.

If you are interested in non-windows-auth mechanisms (where you would use your requested login page) I would advise you to have a look at the Introduction to Identity on ASP.NET Core article. You can also easily create a new web-app using Individual User Accounts as Authentication type to get some boilerplate code with the login-functionality you were asking for. But again - this is not the windows-auth way of doing things but a different auth-concept.

If you want to stick with windows-auth and reach the point where you need fine-grained permissions you might consider using Directory Services if you want to manage permissions via the Active Directory (Ref.: How to add Roles to Windows Authentication in ASP.NET Core) or dive into something like JWT with your own structure behind it.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi thanks for your feedback. It is not up to me regarding the pop up. It's a requirement from business so I am stuck with it. Is there any way to say use cookie auth from Web app to user and then validate user against AD on prem on back end ? Cheers
I do not see the point in doing that for Windows Authentication implies that you already are authenticated. By logging in to Windows. But you can go with Anonymous Authentication on your web-server and implement a custom login form and validate against your AD using Directory Services if that is what you want.
ok thanks for your input and I defo see your point. Thanks for help on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.