sitecoresitecore8sitecore-mvc

Sitecore Feature ActiveDirectory - adding AD domain to the domainManager doesn't work


I'm using Habitat Sitecore. It comes with a bunch of foundation and feature projects. One of the feature projects is Sitecore.Feature.ActiveDirectory. I'm trying to configure domains from patch files. It is outlined by Kam in this blog.

In the /App_config/Include/Feature/Feature.ActiveDirectory.config, I added the following:

<?xml version="1.0" encoding="utf-8"?>

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
  <sitecore>
    <switchingProviders>
      <membership>
        <provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
      </membership>
      <roleManager>
        <provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
      </roleManager>
    </switchingProviders>
    <domainManager>
      <domains>
        <domain id="ad" type="Sitecore.Security.Domains.Domain, Sitecore.Kernel" patch:after="domain[@id='default']">
          <param desc="name">$(id)</param>
          <ensureAnonymousUser>false</ensureAnonymousUser>
          <locallyManaged>false</locallyManaged>
          <isDefault>false</isDefault>
        </domain>
      </domains>
    </domainManager>
  </sitecore>
</configuration>

However, I get the following Exception: A domain specified in the Sitecore.Security.SwitchingRoleProvider provider/domain map could not be found. Domain name: ad in

<add name="switcher" type="Sitecore.Security.SwitchingRoleProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/roleManager" />

What am I doing wrong?


Solution

  • Domains must be added directly to to Domains.config, located in App_Config\Security. It is not able to be patched. Make it part of your build train.