title: Active Directory authentication WCF service for multiple domains - how?
body: <p>I am working on a WCF service (not externally available) that will authenticate users against Active Directory in two domains for users of our .NET 2.0 WinForm application. The authentication portion is mostly working, but I'm having some problems modifying Active Directory. Here are the basics on the situation and the requirements.</p>
  
  <ol>
  <li>Some external users of our application will log in to a Citrix server on a different domain within our DMZ. That has to be the only time they have to enter their credentials. So, an authenticated user in that domain has to be accepted as already authenticated, and application rights are loaded based on the user ID.</li>
  <li>There is a one-way trust relationship set up between the DMZ domain and our internal domain.</li>
  <li>Most external users install the application on their computers. We use .NET remoting to connect to our servers from the app. Authentication is user ID/password via remoting against information stored in SQL Server on our domain.</li>
  <li>Internal users, while in our domain, will be in a similar situation. They will launch the app and not need to enter any credentials, assuming they are logged in.</li>
  <li>All users - Active Directory or not - are still set up in our tables, which is where our rights management information is stored. There is a flag on the user table indicating whether the user is AD or not and fields indicating their domain and AD user ID (if different than their original one).</li>
  <li>If users are set up in Active Directory, either in the external domain or the internal domain, if they run the application installed on a computer not currently on the domain (i.e., from a laptop on the road), they would be authenticated against Active Directory. The remoted objects that handle authentication in #2 connect to the WCF service to get authentication.</li>
  <li>The same applies to users of our Web site (which uses the same credentials). If they are marked as Active Directory users, they are authenticated against it, not against our normal system.</li>
  <li>Some internal users that have the correct rights need to be able to set up users in Active Directory, modify them, unlock them and enable/disable them - in the external domain only.</li>
  </ol>
  
  <p>The main questions I have are:</p>
  
  <ol>
  <li>What domain should that WCF service be in: External or Internal?</li>
  <li>What user should that service be running under to be able to accomplish all of the above, i.e., External\SVC-ADAuthentication, Internal\SVC-ADAuthentication, something else?</li>
  </ol>
  
  <p>From my testing:</p>
  
  <ol>
  <li>When I run the service on External as External\SVC-ADAuthentication, I can modify AD information and authenticate against the External domain. Authentication against the Internal domain fails with "A referral was returned from the server"</li>
  <li>External as Internal\SVC-ADAuthentication: I can authenticate against both domains, but I cannot modify users on the External domain.</li>
  <li>Internal as Internal\SVC-ADAuthentication: I can authenticate against the internal domain only.</li>
  <li>Internal as External\SVC-ADAuthentication: Won't run (I'm assuming because of the one-way trust relationship).</li>
  </ol>