日期:2014-05-20  浏览次数:20814 次

为什么我基于 Acegi 的登陆没反应?
在下是一 Acegi 菜鸟,刚学习没多久。仿照网上的资料做了一个 Acegi 登陆的测试页面,但好像不起作用,对要保护的资源确实进行了过滤,不经登陆不能访问,但是我现在登陆不了,输入登陆信息后总是被返回到登陆页面。大家能否帮忙看看究竟是哪里出了问题?  
我的 Acegi 配置信息如下:
XML code
<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="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-2.0.xsd">
 
  <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
    <property name="authenticationManager" ref="authenticationManager" />
    <property name="authenticationFailureUrl" value="/login.html" />
    <property name="defaultTargetUrl" value="/admin/admin.html" />
    <property name="filterProcessesUrl" value="j_acegi_security_check" />
  </bean>
  
  <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
    <property name="providers">
      <list>
        <ref local="daoAuthenticationProvider" />
      </list>
    </property>
  </bean>
  
  <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
    <property name="userDetailsService" ref="inMemoryDaoImpl" />
  </bean>
  
  <bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
    <property name="userMap">
      <value>
        demo=demo,ROLE_USER
        user=user,ROLE_USER
        admin=admin,ROLE_SUPERVISOR
      </value>
    </property>
  </bean>
  
  <bean id="exceptionTranslationFilter" class="org.acegisecurity.ui.ExceptionTranslationFilter">
    <property name="authenticationEntryPoint">
      <bean class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
        <property name="loginFormUrl" value="/login.html" />
        <property name="forceHttps" value="false" />
      </bean>
    </property>
    <property name="accessDeniedHandler">
      <bean class="org.acegisecurity.ui.AccessDeniedHandlerImpl">
        <property name="errorPage" value="/accessDenied.html" />
      </bean>
    </property>
  </bean>
  
  <bean id="filterSecurityInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
    <property name="authenticationManager" ref="authenticationManager" />
    <property name="accessDecisionManager" ref="accessDecisionManager" />
    <property name="objectDefinitionSource">
      <value>
        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
        PATTERN_TYPE_APACHE_ANT
        /admin/** = ROLE_SUPERVISOR
      </value>
    </property>
  </bean>
  
  <bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
    <property name="allowIfAllAbstainDecisions" value="false" />
    <property name="decisionVoters">
      <list>
        <bean class="org.acegisecurity.vote.RoleVoter" />
      </list>
    </property>
  </bean>
  
  <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
    <property name="filterInvocationDefinitionSource">
      <value>
        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
        PATTERN_TYPE_APACHE_ANT
        /** = authenticationProcessingFilter, exceptionTranslationFilter, filterSecurityInterceptor
      </value>
    </property>
  </bean>
  
</beans>