2017-01-23 90 views
0

我正在開發一個在Spring上開發的應用程序,並嘗試與LDAP Direcotory建立連接。 我有一個服務帳戶可以訪問LDAP目錄,但是我的配置有問題。使用服務帳戶對LDAP目錄進行Spring身份驗證

  • 我的服務帳戶:登錄/密碼>>服務/ servcicepass LDAP目錄

  • 一個用戶帳戶registred:登錄/密碼>>
    用戶1/PASS1

當我嘗試使用登錄界面上的用戶帳戶登錄時出現錯誤,但通過輸入登錄名/密碼E服務賬戶我登錄

用戶coontext.xml文件是:

> <!-- LDAP -->   <security:ldap-server 
> url="ldap://192.168.1.68:389/o=digital" />  <bean 
> id="ldapAuthProvider" 
> class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider"> 
>  <constructor-arg>   <bean 
> class="org.springframework.security.ldap.authentication.BindAuthenticator"> 
>    <constructor-arg ref="contextSource" /> 
>    <property name="userDnPatterns"> 
>     <list> 
>      <value>uid={0}</value> 
>     </list> 
>    </property>    </bean>   </constructor-arg>  <constructor-arg>   <bean 
> class="edu.mit.kit.userdetails.MappedLdapAuthoritiesPopulator"> 
>    <property name="admins"> 
>     <set> 
>      <!-- list admin usernames here --> 
>     </set> 
>    </property>    </bean>   </constructor-arg> </bean> 
>   <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"> 
>  <property name="url" value="ldap://192.168.1.68:389/">  <property 
> name="base" value="o=digital,ou=TechnicalAccount,ou=Comp" /> </bean> 
> 
> <bean id="ldapTemplate" 
> class="org.springframework.ldap.core.LdapTemplate">  <constructor-arg 
> name="contextSource" ref="contextSource" /> </bean>   <bean 
> id="ldapUserInfoRepository" primary="true" 
> class="edu.mit.kit.repository.impl.LdapUserInfoRepository"> 
>  <property name="ldapTemplate" ref="ldapTemplate" />  </bean> 

><!-- end LDAP --> 

你能幫忙嗎?

回答

0

我找到了答案,我想與你分享:

變化的配置和投入:

安全:LDAP服務器的URL =「LDAP://192.168.1.68:389/o = digital「 manager-dn =」uid = service,ou = TechnicalAccounts「 manager-password =」servicepass「/>

相關問題