How to use Active Directory Authentication in ASP.NET Core?

夙愿已清 提交于 2020-04-05 15:24:14

问题


I am using the ASP.NET Core 2.1 React SPA Microsoft template.

I want to use Active Directory for user authentication. Our server runs on a corporate network using Active Directory domain identities.

How can I do it?


回答1:


The best way is to use Windows authentication. However, that will only work if the server you run this on is joined to the domain (or a trusted domain).

If not, then you will have to use Forms Authentication, where the user enters their username and password, and you authenticate against AD in your code via LDAP. There are two ways to do this in .NET Core:

  1. If you will only run this on a Windows server, then you can install and use the Microsoft.Windows.Compatibility NuGet package.
  2. Use the third-party Novell.Directory.Ldap.NETStandard.

There are two answers on this question that describe how to implement both solutions.



来源:https://stackoverflow.com/questions/53707820/how-to-use-active-directory-authentication-in-asp-net-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!