29
votes

With the recent release of .NET Core 1.0, we're in the process of migrating our RC1 applications to the final release. The only piece we can't seem to figure out is how to integrate Active Directory authentication.

Previously in the RC1 applications, we had used the System.DirectoryServices.AccountManagement library to handle the LDAP authorization queries. However, we can no longer mix this library with .NET Core v1.

Generally, what is the best way to integrate Active Directory authentication into our applications using the libraries available for use in the .NET Core framework? IdentityServer, some other third party service like Auth0 or something else?

4
FWIW, group/name based Active Directory auth currently works, but there are other features still missing - see stackoverflow.com/questions/34746645/…Coruscate5

4 Answers

23
votes

The Novell.LDAP library has been ported to .NET Core you can find it in NuGet. There are numerous samples available, including a verify password sample.

8
votes

Best is subjective, really there's only one way right now, given the missing DirectoryServices namespace (which is planning for 1.1) - federation.

You'd have to install ADFS, and expose it to the internet. Then you configure it to act as an OAuth2 endpoint, and use the generic OAuth middleware to redirect logins to your ADFS server. You could also install the latest ADFS beta, which needs the latest Windows Server beta, and use OpenID Connect, but that's a lot of beta risks you may not find acceptable.

Or, if you just want the latest MVC pieces, run it on .NET Desktop, where you have full access to the directory services namespace.

3
votes

The System.DirectoryServices namespace is currently being implemented in .NET Core, work is ongoing. https://github.com/dotnet/corefx/issues/2089

1
votes

Just want to say that they just issued a pre-release of the Microsoft.Windows.Compatibility which contains the System.DirectoryServices components needed to integrating with Active Directory

https://www.nuget.org/packages/Microsoft.Windows.Compatibility/2.0.0-preview1-25914-04