2013-06-26 119 views
0

我已成功設置基於LDAPS容器的身份驗證,並且現在正嘗試使用Spring安全性來處理它,因爲我還需要執行查找/查詢。WAS 6.1上使用Spring Security的LDAP SSL

在我有所有的端點使用正確的密鑰庫(WC_DefaulHost除外)。另外,我還爲ldaps,主機,端口設置了動態端點配置。

當我嘗試登錄時,我剛剛收到「spring_security_login?login_error」並且沒有system.out異常。

我錯過了什麼嗎?端點配置是否不夠?任何方式,我可以得到更多的信息來解決問題?

<?xml version="1.0" encoding="UTF-8"?> 
<beans:beans xmlns="http://www.springframework.org/schema/security" 
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> 

    <authentication-manager> 
     <authentication-provider ref="ldapAuthProvider" /> 
    </authentication-manager> 

    <beans:bean id="contextSource" 
     class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"> 
     <!-- AD authenticator -->  
     <beans:constructor-arg value="ldaps://host:port/DC=" /> 
     <beans:property name="userDn" value="CN=,OU=,DC=" /> 
     <beans:property name="password" value="" /> 
    </beans:bean> 

    <beans:bean id="ldapAuthProvider" 
     class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider"> 
     <beans:constructor-arg> 
      <beans:bean id="wimLdapAuthenticator" 
       class="org.springframework.security.ldap.authentication.BindAuthenticator"> 
       <beans:constructor-arg ref="contextSource" /> 
       <beans:property name="userSearch"> 
        <beans:bean id="userSearch" 
         class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch"> 

         <beans:constructor-arg index="0" value="" /> 
         <beans:constructor-arg index="1" value="CN={0}" /> 
         <beans:constructor-arg index="2" ref="contextSource" /> 
        </beans:bean> 
       </beans:property> 
      </beans:bean> 
     </beans:constructor-arg> 
    </beans:bean> 

    <http auto-config="true" pattern="/**"> 
     <!-- Security zones --> 
     <intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" /> 
     <intercept-url pattern="/spring_security_login" access="IS_AUTHENTICATED_ANONYMOUSLY" /> 
    </http> 

</beans:beans> 

回答

0

它的工作現在..好像這不是一個SSL的問題......我換了攔截的URL的順序,以便/ **是最後一個,並添加自定義登錄表單..

<form-login login-page="/login" default-target-url="/viewAllTeams" authentication-failure-url="/loginfailed" /> 
<logout logout-success-url="/logout" /> 
<form-login default-target-url="/viewAllTeams"/> 
<intercept-url pattern="/login" access="IS_AUTHENTICATED_ANONYMOUSLY" /> 
<intercept-url pattern="/loginfailed" access="IS_AUTHENTICATED_ANONYMOUSLY" /> 
<intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" /> 

我還發現,您可以使用顯示例外情況如下:

<div class="errorblock"> 
    Your login attempt was not successful, try again.<br /> Caused : 
    ${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message} 
</div>