Authenticate and GetRoles of ActiveDirectory users in a disconnected WPF application via MembershipProvider

I have a project requirement where I need to authenticate against ActiveDirectory in a remote/disconnected WPF application.

There is probably several ways to attempt to do this, but what would be the best approach using ActiveDirectory's MembershipProvider?

I need to:

  1. Authenticate that the user exists.
  2. obtain the AD user's groups and roles.

This needs to happen from a remote location, outside of the network Active Directory resides on.

Answers


From within a WinForms or WPF application you can now take advantage of "Client Application Services" (thanks MS for a very generic name, searching for help is now very painful!).

This allows you to connect to a WCF service that can validate the logins. The link above has a walkthrough that shows how easy it is to get it all working, once you have a working app you can modify your config to point to a different MembershipProvider and/or RoleProvider.

It's worth noting that the out-of-the-box solution includes a MembershipProvider named ActiveDirectoryMembershipProvider, but there's no RoleProvider for Active Directory.

If you do require the ability to get Roles (or Groups) and you are working with .NET 4.0 then you can take advantage of the new Active Directory API added that makes everything much easier, namely System.DirectoryServices.AccountManagement. For the most basic of Membership and Role services you'll want to have the following to create your own basic MembershipProvider and RoleProvider:

You can implement as little or as much of the API as needed, you should find everything you need in the new AccountManagement namespace to do this.


Need Your Help

How can I get all singleton instances from a Guice Injector?

java dependency-injection guice

Is there an easy way to enumerate all the singleton instances already created by a Guice Injector? Or alternately a way to get all singletons that implement a specific interface?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.