I like the way permissions and groups work in Active Directory, but I don't want to actually tie my application in with AD.
Is there an existing library out there that contains the same sort of functionality that AD has? In particular, the ability to create groups, assign users to groups, add permissions to groups, and view a user or group's applied permissions?
May be you can use Microsoft-s AzMan-Authorization Manager as a wrapper for Active directory.
It contains an API to program against to ask for permissions
and a gui (azman.msc) where you can define roles and map rights and store them in an xml-file.
It can be configured against Active Directory.
The ActiveDirectoryMembershipProvider class inherits MembershipProvider.
That means that you don't have to tie your application to AD per se, but to the MembershipProvider model. This model is used throughout .net and works well with built in controls and classes.
Here is a sample
//Any of these will work
ActiveDirectoryMembershipProvider provider = new ActiveDirectoryMembershipProvider();
//SqlMembershipProvider provider = new SqlMembershipProvider();
//MyCustomMemebershipProvider provider = new MyCustomMemebershipProvider();
MembershipProvider membershipProvider = provider;
if (membershipProvider.ValidateUser("username", "password"))
{
MembershipUser user = membershipProvider.GetUser("username", true);
}
else
{
//Do something
}
I am no expert on this model, but have had some experience sub classing MembershipProvider and implementing IPrincipal, IIdentity etc. Doing this is really flexible and maintains a consistent architecture
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With