New Posts New Posts RSS Feed: Authenticating against Active Directory
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Authenticating against Active Directory

 Post Reply Post Reply
Author
btitular View Drop Down
Newbie
Newbie
Avatar

Joined: 08-Oct-2009
Location: CA
Posts: 20
Post Options Post Options   Quote btitular Quote  Post ReplyReply Direct Link To This Post Topic: Authenticating against Active Directory
    Posted: 05-Nov-2009 at 3:09pm

Does anyone have a sample of a silverlight client app authenticating against an active directory? I've found a few articles on MSDN that demonstrate that it's possible, but I'm a little lost as to how to accomplish this with the DevForce LoginAsync() method.

Back to Top
btitular View Drop Down
Newbie
Newbie
Avatar

Joined: 08-Oct-2009
Location: CA
Posts: 20
Post Options Post Options   Quote btitular Quote  Post ReplyReply Direct Link To This Post Posted: 05-Nov-2009 at 5:33pm

I was able to get the authentication working with active directory.

Here were the references that I used:

http://msdn.microsoft.com/en-us/library/ms998360.aspx
http://blog.jumptree.com/2008/active-directory-and-aspnet-forms-authentication

In the web.config file, the following modifications were made:

1. In the connectionStrings element, I added:

    <add name ="ADConnectionString"
         connectionString="LDAP://mydomain.com/DC=mydomain,DC=com"/>

    where mydomain would be your own domain name.
 
2. In the system.web element, the following were added:

 <authentication mode="Forms">
       <forms name=".ADAuthCookie"
              timeout="10"/>
 </authentication>

  
 <membership defaultProvider="MyADMembershipProvider">
       <providers>
         <add name="MyADMembershipProvider"
              type="System.Web.Security.ActiveDirectoryMembershipProvider,
              System.Web, Version=2.0.0.0,
              Culture=neutral,
              PublicKeyToken=b03f5f7f11d50a3a"
              connectionStringName="ADConnectionString"
              connectionUsername="yourusername"
              connectionPassword="yourpassword"
              attributeMapUsername="sAMAccountName"/>
       </providers>
 </membership>

where yourusername is a valid user that can access the active directory and yourpassword is the corresponding password for that user.

The key item for me to get it working correctly was that my user's don't have to enter a domain name. In order for the authentication to work, I had to add the:

 attributeMapUsername="sAMAccountName"

to the providers element.

Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2009 at 3:10pm
Thanks for posting that, btitular.  That should be helpful to other users trying to do the same.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down