4

I’m implementing asp.net core 3. I want to create a login page for users who are in the active directory using LDAP.I can not find any exhausting guidance for asp.net core 3 through which I can get help for implementing it. I appreciate if any one suggests me a tutorial or any relevant sample.

Gabriel Luci
  • 38,328
  • 4
  • 55
  • 84
hrz
  • 193
  • 5
  • 17
  • Have you check out the [official docs](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio#kestrel) ? – itminus Feb 28 '20 at 02:52
  • 1
    Thank you very much for your response. You suggested me a link for windows authentication bu I need to implement ASP.NET Core 3.0 LDAP Active Directory Authentication – hrz Feb 28 '20 at 06:20
  • If your computer belongs to a domain, the above link also works fine for AD Authentication :) – itminus Feb 29 '20 at 07:18

1 Answers1

4

Ideally, you can use Windows Authentication. This is best for an intranet application. If the user's log into their computers with the same account that they need to authenticate to your website, then as long as the website is trusted (added to the Trusted Sites in Internet Options in Windows) then their credentials will be automatically sent and they will not have to put in their username and password themselves.

However, if your situation does not meet the criteria for that to work, then you need to build your own authentication. You're taking a username and password from the user and validating it, just like you would if you had your own database of users. The only difference is how you validate them.

The answers to this question might help get you started: ASP.NET Core 2.0 LDAP Active Directory Authentication

Or there are other examples if you search Google for "asp.net core ldap auth".

Gabriel Luci
  • 38,328
  • 4
  • 55
  • 84
  • Thank you for your great response. So you think for ASP.NET Core 3.0 LDAP Active directory Authentication, there is no any resource? – hrz Mar 04 '20 at 07:55
  • There are resources if you click on the last link in my answer. – Gabriel Luci Mar 04 '20 at 12:21
  • The first result of the google search brings you here. you should add explicit links for future visitors. – Paul Totzke Jun 28 '21 at 18:31
  • @PaulTotzke I was expecting people to browse through the results and find the example that most meets their needs. My first link to the Microsoft documentation is probably the most useful, I think. – Gabriel Luci Jun 29 '21 at 00:23
  • I'm referring to the "other examples" part of your answer: "Or there are other examples if you search Google for "asp.net core ldap auth"." That's what visitors are typing to arrive at this post - first result. Search results change over time and future readers might be looking for info related to those top search's for when this post is answered. – Paul Totzke Jun 29 '21 at 18:30
  • @PaulTotzke Yes, that's what I was referring to as well. Even though this is the first result, there are others. I didn't want to link to any one specific example since people have different needs. – Gabriel Luci Jun 29 '21 at 22:53