2009-07-30 34 views
1

外部DB権限のカスタムLDAP認証を行うことができます。Ldap無効な資格情報が認証失敗URLをロードしない

<http auto-config="false" access-decision-manager-ref="accessDecisionManager" access-denied-page="/accessDenied.jsp"> 
    <!-- Restrict access to ALL other pages --> 
    <intercept-url pattern="/index.jsp" filters="none" /> 
    <!-- Don't set any role restrictions on login.jsp --> 
    <intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> 
    <intercept-url pattern="/service/**" access="PRIV_Report User, PRIV_305" /> 

    <logout logout-success-url="/index.jsp" /> 
    <form-login authentication-failure-url="/index.jsp?error=1" default-target-url="/home.jsp" /> 
    <anonymous/> 
</http> 

<b:bean id="accessDecisionManager" class="org.springframework.security.vote.AffirmativeBased"> 
    <b:property name="decisionVoters"> 
     <b:list> 
      <b:ref bean="roleVoter" /> 
      <b:ref bean="authenticatedVoter" /> 
     </b:list> 
    </b:property> 
</b:bean> 

<b:bean id="roleVoter" class="org.springframework.security.vote.RoleVoter"> 
    <b:property name="rolePrefix" value="PRIV_" /> 
</b:bean> 
<b:bean id="authenticatedVoter" class="org.springframework.security.vote.AuthenticatedVoter"> 
</b:bean> 

<b:bean id="contextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource"> 
    <b:constructor-arg value="ldap://mydomain:389" /> 
</b:bean> 
<b:bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"> 
    <b:constructor-arg ref="contextSource" /> 
</b:bean> 

<b:bean id="ldapAuthenticationProvider" 
     class="com.zo.sas.gwt.security.login.server.SASLdapAuthenticationProvider"> 
     <b:property name="authenticator" ref="ldapAuthenticator" /> 
     <custom-authentication-provider /> 
</b:bean> 

<b:bean id="ldapAuthenticator" 
     class="com.zo.sas.gwt.security.login.server.SASAuthenticator"> 
     <b:property name="contextSource" ref="contextSource" /> 
     <b:property name="userDnPatterns"> 
      <b:value>uid={0},OU=People</b:value> 
     </b:property> 
</b:bean> 

そして、私の例外のログ:しかし、私は認証失敗URL間違ったパスワードをテストしようとしていたときに私のブラウザはdetails.Belowが私securitycontext.xmlと例外が与えられて例外を出力します代わりに表示されていない

 
org.springframework.ldap.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials] 
    org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:180) 
    org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:266) 
    org.springframework.ldap.core.support.AbstractContextSource.getContext(AbstractContextSource.java:106) 
    com.zo.sas.gwt.security.login.server.SASAuthenticator.authenticate(SASAuthenticator.java:55) 
    com.zo.sas.gwt.security.login.server.SASLdapAuthenticationProvider.authenticate(SASLdapAuthenticationProvider.java:45) 
    org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:188) 
    org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46) 
    org.springframework.security.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:82) 
    org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:258) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) 
    org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) 
    org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235) 
    org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) 
    org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) 
    org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175) 
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:183) 
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138) 

これはあまり言いませんログインし、私のindex.jspを

<html> 
<script type="text/javascript" language="javascript"> 
    var dictionary = { 
      loginErr: "${SPRING_SECURITY_LAST_EXCEPTION.message}", 
      error: "${param.error}" 
      }; 
</script> 

    <head> 
    </head> 
    <body > 
     <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe> 

     <script type="text/javascript" language="javascript" src="com.zo.sas.gwt.sasworkflow.home.Home.nocache.js"></script> 
    </body> 
</html> 

答えて

1

です。 org.springframeworkをログに入れてDEBUGレベルにして、何が起こっているのかを見てください。
"nullを含むようにSecurityContextHolderを更新しました。""認証要求に失敗しました:"、その後、index.jspへのリダイレクトが必要です。
index.jspのコードは何ですか?

+0

返信いただきありがとうございますが、これらのメッセージが届いていません。 そして失敗した場合、私のURLはhttp:// localhost/sas/j_spring_security_checkになります。これはhttpステータス500と、以前に貼り付けたものを含むエラーログを表示します。 –

0

これは正しいエラーメッセージです.LDAP:エラーコード49 - 無効な資格情報ですが、希望のフォーマットではない可能性があります。

LDAPサーバが理由でサブコードを渡す必要があり、Active Directoryは、リストがあります:
AD LDAP 49 codesをし、eDirectoryが悪いDNのための601の不正なパスワードのため、通常は669エラーを送信します。私はそれがバージョンの最後のカップルで変わったと思うが、それらはすべて、eDirectory上で669のエラーとして表示されるので、攻撃者が実際のユーザー名を決定するのを助けるものではない。

関連する問題