使用sitecore配置活动目录模块

时间:2014-09-10 15:53:11

标签: asp.net active-directory ldap sitecore ldapconnection

我正在尝试为sitecore配置活动目录模块。

我安装了AD模块的软件包,并验证了sitecore中包含的各种文件。

我使用

进行了以下配置
    1.  Connection string
    <add name="ADConnString" connectionString="LDAP://ldapserver.corp.pk.com:389,DC=corp,DC=pk,DC=com" />

    2.  Membership provider

    <membership defaultProvider="sitecore" hashAlgorithmType="SHA1">
          <providers>
            <clear />
            <add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="switcher" providerWildcard="%" raiseEvents="true" />
            <add name="sql" type="System.Web.Security.SqlMembershipProvider" connectionStringName="core" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="256" />
            <add name="switcher" type="Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/membership" />
            <add name="ad" type="LightLDAP.SitecoreADMembershipProvider" connectionStringName="ADConnString" applicationName="sitecore" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" connectionUsername="****" connectionPassword="****" connectionProtection="Secure" attributeMapUsername="sAMAccountName" enableSearchMethods="true" customfilter="(memberOf=CN=SitecoreUsers,OU=Groups,DC=corp,DC=pk,DC=com)" />
          </providers>
        </membership>

    3. Role provider
            <roleManager defaultProvider="sitecore" enabled="true">
              <providers>
                <clear />
                <add name="sitecore" type="Sitecore.Security.SitecoreRoleProvider, Sitecore.Kernel" realProviderName="switcher" raiseEvents="true" />
                <add name="sql" type="System.Web.Security.SqlRoleProvider" connectionStringName="core" applicationName="sitecore" />
                <add name="switcher" type="Sitecore.Security.SwitchingRoleProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/roleManager" />
                <add name="ad" type="LightLDAP.SitecoreADRoleProvider" connectionStringName="ADConnString" applicationName="sitecore" username="ldapuser" password=" ldappw" attributeMapUsername="sAMAccountName" cacheSize="2MB" />
              </providers>
            </roleManager>
4. Added domain in App_config/Security/Domains.config
<domain name="ad" ensureAnonymousUser="false" />

5. Added swtiching providers for membership and role providers

<switchingProviders>
      <membership>
        <provider providerName="sql" storeFullNames="true" wildcard="%" domains="*" />
       <provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
      </membership>
      <roleManager>
        <provider providerName="sql" storeFullNames="true" wildcard="%" domains="*" ignoredUserDomains="" allowedUserDomains="" />
       <provider providerName="ad" storeFullNames="false" wildcard="*" domains="ad" />
      </roleManager>
    </switchingProviders>

我确实浏览了ProvidersStatus页面,我看到使用sitecore正确设置了活动目录模块

ADN configured correctly

当我浏览到sitecore Desktop时 - &gt;安全工具 - &gt;用户经理..我没有看到列表中的用户,但在域名部分,我看到新域名&#39; ad&#39;

enter image description here

当我查看日志时...我看到以下错误

ERROR Active Directory existing checking exception: System.DirectoryServices.DirectoryServicesCOMException (0x8007052E): The user name or password is incorrect.

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_NativeObject()
   at LightLDAP.MembershipResolver.DirectoryEntryExists(String path, String username, String password, AuthenticationTypes types)
 ERROR The AD membership provider couldn't be initialized: The user name or password is incorrect.

Exception: System.DirectoryServices.DirectoryServicesCOMException
Message: The user name or password is incorrect.

我验证了连接到Active Directory服务器的用户名和密码,它们似乎是正确的..我不知道为什么我根本无法看到用户:(

感谢任何帮助。 感谢。

2 个答案:

答案 0 :(得分:1)

请务必在您的membership.providers条目中为您的用户帐户提供域名,例如connectionUsername="domain\username"我最近遇到了这个问题;即使我可以在外部浏览器(Softerra&#39; s)中浏览LDAP树而不指定域,但除非指定了域,否则Sitecore将无法连接。

如果你像我一样,你就不会知道&#34;域名&#34; name - 因为它现在是一个LDAP树。尝试使用连接字符串中的根值构建域名。对我来说,它是前两个DC: 连接字符串:

<add name="ad" connectionString="LDAP://mycompany.gbl:389/OU=Users,DC=mycompany,DC=gbl"/>

翻译为:

connectionUsername="mycompany.gbl\myconnectaccount"

答案 1 :(得分:0)

我注意到您已将自定义过滤器应用于成员资格提供程序。我的第一个调试步骤是删除该自定义过滤器,看看你是否开始让用户回来。可能是过滤器正在返回用户无权访问的对象。

否则,有关验证用户帐户权限的现有注释是否正确。日志消息表示用户名/密码问题。您可以尝试使用AD Explorer等工具进行诊断。指定您正在使用的凭据和连接数据,并查看是否可以连接到存储库。