2

spring security 3.0 を使用するアプリケーションがあります。アプリケーションは、会社の Active Directory をログインに使用します。ネット上の例からいくつかのコードを借りたところ、バインドを正常に実行できるようになりました。しかし、記憶機能は機能していません。具体的に言うと、アプリケーションにサインインできますが、ブラウザを閉じてアプリケーションを開くと、再びログイン ページにリダイレクトされます。誰でも私の設定で何が間違っているのか教えてください。

Security.xml

<http path-type="regex" use-expressions="true" auto-config="true">  
      <form-login 

      login-page="/Login.html" 

      login-processing-url="/j_spring_security_check" 

      default-target-url="/home.html" 

      authentication-failure-url = "/Login.html?login_error=1"        

 />

<logout logout-success-url="/Login.html" invalidate-session="true"
        delete-cookies="JSESSIONID" />

  <intercept-url pattern="\A/Login\Z" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
  <intercept-url pattern="\A/(?!Login).*\Z" access="isAuthenticated()" />

  <remember-me key="_spring_security_remember_me" token-validity-seconds="3600" user-service-ref="ldapUserDetailsService"/>

</http>


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

<beans:bean class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider" id="ldapAuthProvider">
    <beans:constructor-arg ref="ldapBindAuthenticator"/>
    <beans:property name="userDetailsContextMapper" ref="ldapUserDetailsContextMapper"/>
</beans:bean>

<beans:bean class="org.springframework.security.ldap.DefaultSpringSecurityContextSource" id="ldapServer">
    <!-- MS Active Directory -->
    <beans:constructor-arg value="ldap://hostname/DC=myCompany,DC=com"/>
    <beans:property name="userDn" value="CN=user,OU=Users,DC=mycompany,DC=com"/>
    <beans:property name="password" value="xxxxxx"/>
</beans:bean>

<beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator" id="ldapBindAuthenticator">
    <beans:constructor-arg ref="ldapServer"/>
    <beans:property name="userSearch" ref="ldapSearchBean"/>
</beans:bean>

<beans:bean class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch" id="ldapSearchBean">

    <beans:constructor-arg value="OU=Users"/>
    <beans:constructor-arg value="(sAMAccountName={0})"/>
    <beans:constructor-arg ref="ldapServer"/>
</beans:bean>


<beans:bean class="org.springframework.security.ldap.userdetails.InetOrgPersonContextMapper" id="ldapUserDetailsContextMapper"/>

<beans:bean id="ldapUserDetailsService" class="org.springframework.security.ldap.userdetails.LdapUserDetailsService">
        <beans:constructor-arg index="0">
            <beans:ref local="ldapSearchBean" />
        </beans:constructor-arg>
    </beans:bean>   



<!-- Bean used for LDAP querying. -->
<beans:bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
    <beans:constructor-arg ref="ldapServer" />
</beans:bean>

<beans:bean class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler" id="expressionHandler"/>

4

0 に答える 0