c# - Creating Active Directory of usernames for LDAP access -
i newbie ldap , active directories.
i need build active directory of users eligible access particular conputer. when user enters username , password in web interface(created in c#) sent active directory via ldap query active directory. ad return users email address if login successful.
is possible setup active directory achieve above scenario locally? using windows 7 ultimate. have installed adam ldap access.
regards,
john.
since you're on .net 3.5 , up, should check out system.directoryservices.accountmanagement
(s.ds.am) namespace. read here:
managing directory security principals in .net framework 3.5
basically, can define domain context , find users and/or groups in ad:
// set domain context principalcontext ctx = new principalcontext(contexttype.domain); // validate username/password combo if (ctx.validatecredentials(username, password)) { // if valid - find user userprincipal user = userprincipal.findbyidentity(ctx, username); if (user != null) { return user.emailaddress; } }
the new s.ds.am makes easy play around users , groups in ad!
for adam (or ad lds it's called today), use
principalcontext ctx = new principalcontext(contexttype.applicationdirectory);
to establish context adam directory - not sure, have supply form of additional information know application directory use (i've never played on adam). , also: i'm not sure if can validate credentials against adam store .... you'll have see , try!
Comments
Post a Comment