PDA

View Full Version : AutoIntegrationFilter



templth
Nov 23rd, 2004, 10:09 AM
Hello,

I'd like to have more information about the AutoIntegrationFilter. If I don't put it in my configuration nothing work as I want...

Here is my web.xml:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http&#58;//java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp">
<display-name>TestSpringMVC</display-name>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-servlet.xml</param-value>
</context-param>

<filter>
<filter-name>Acegi Authentication Processing Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.ui.webapp.AuthenticationProce ssingFilter</param-value>
</init-param>
</filter>

<filter>
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.ui.AutoIntegrationFilter</param-value>
</init-param>
</filter>

<filter>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>Acegi Authentication Processing Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListe ner</listener-class>
</listener>

<servlet>
<servlet-name>mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>mvc</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>


<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>
</web-app>

and my mvc-servlet.xml:


<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http&#58;//www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundle MessageSource">
<property name="basenames">
<list>
<!--value>format</value>
<value>exceptions</value>
<value>windows</value-->
<value>binding</value>
</list>
</property>
</bean>

<bean id="handlerExceptionResolver" class="controleur.MyExceptionHandler">
<property name="order">
<value>1</value>
</property>
</bean>

<!-- Acegi -->
<bean id="memoryAuthenticationDao" class="net.sf.acegisecurity.providers.dao.memory.InMemory DaoImpl">
<property name="userMap">
<value>test=pwd,ROLE_ADMIN</value>
</property>
</bean>

<bean id="daoAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthenticati onProvider">
<property name="authenticationDao">
<ref local="memoryAuthenticationDao" />
</property>
</bean>

<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
<property name="providers">
<list>
<ref bean="daoAuthenticationProvider" />
</list>
</property>
</bean>

<bean id="authenticationProcessingFilter" class="net.sf.acegisecurity.ui.webapp.AuthenticationProce ssingFilter">
<property name="authenticationManager">
<ref bean="authenticationManager" />
</property>
<property name="authenticationFailureUrl">
<value>/login.jsp?login_error=1</value>
</property>
<property name="defaultTargetUrl">
<value>/</value>
</property>
<property name="filterProcessesUrl">
<value>/j_login</value>
</property>
</bean>

<bean id="authenticationProcessingFilter1" class="MyServletFilter" />

<bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter" />

<bean id="accessDecisionManager" class="net.sf.acegisecurity.vote.UnanimousBased">
<property name="allowIfAllAbstainDecisions">
<value>false</value>
</property>
<property name="decisionVoters">
<list>
<ref local="roleVoter" />
</list>
</property>
</bean>

<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter">
<property name="filterSecurityInterceptor">
<ref bean="filterInvocationInterceptor" />
</property>
<property name="authenticationEntryPoint">
<ref bean="authenticationEntryPoint" />
</property>
</bean>

<bean id="authenticationEntryPoint" class="net.sf.acegisecurity.ui.webapp.AuthenticationProce ssingFilterEntryPoint">
<property name="loginFormUrl">
<value>/login.jsp</value>
</property>
</bean>

<bean id="filterInvocationInterceptor" class="net.sf.acegisecurity.intercept.web.FilterSecurityI nterceptor">
<property name="authenticationManager">
<ref bean="authenticationManager" />
</property>
<property name="accessDecisionManager">
<ref bean="accessDecisionManager" />
</property>
<property name="objectDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/test*=ROLE_ADMIN
/form*=ROLE_ADMIN
</value>
</property>
</bean>

<bean id="autoIntegrationFilter" class="net.sf.acegisecurity.ui.AutoIntegrationFilter" />
<!-- Fin Aceci -->

<!--bean id="monService" class="service.Service" singleton="false"/-->

<bean id="monServiceTarget" class="service.Service" singleton="false" />

<bean id="monServicePool" class="org.springframework.aop.target.CommonsPoolTargetSo urce">
<property name="targetBeanName">
<value>monServiceTarget</value>
</property>
<property name="maxSize">
<value>25</value>
</property>
</bean>

<bean id="monService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>service.IService</value>
</property>
<property name="targetSource">
<ref local="monServicePool" />
</property>
</bean>

<!-- Ctrl simple -->
<bean id="springappController" class="controleur.SampleController">
<property name="service">
<ref local="monService" />
</property>
</bean>

<!-- Validator and Form Controller for the "Price Increase" page -->
<bean id="formValidator" class="controleur.FormValidator" />
<bean id="priceIncreaseForm" class="controleur.SampleFormController">
<property name="sessionForm">
<value>true</value>
</property>
<property name="commandName">
<value>monBean</value>
</property>
<property name="commandClass">
<value>bean.MonBean</value>
</property>
<property name="validator">
<ref bean="formValidator" />
</property>
<property name="formView">
<value>form</value>
</property>
<property name="successView">
<value>form</value>
</property>
<!--property name="productManager">
<ref bean="prodMan"/>
</property-->
</bean>

<bean id="actionResolver" class="org.springframework.web.servlet.mvc.multiaction.Pa rameterMethodNameResolver">
<property name="paramName">
<value>method</value>
</property>
<property name="defaultMethodName">
<value>list</value>
</property>
</bean>

<bean id="multipleCtrl" class="controleur.MultipleController">
<property name="methodNameResolver">
<ref bean="actionResolver" />
</property>
</bean>

<bean id="officeHoursInterceptor" class="intercepteurs.TestIntercepteur">
<property name="openingTime">
<value>9</value>
</property>
<property name="closingTime">
<value>18</value>
</property>
</bean>

<!-- Mapping & resolveview -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name="interceptors">
<list>
<ref local="officeHoursInterceptor" />
</list>
</property>
<property name="mappings">
<props>
<prop key="/test">springappController</prop>
<prop key="/form">priceIncreaseForm</prop>
<prop key="/multiple">multipleCtrl</prop>
</props>
</property>
</bean>

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResou rceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.JstlView</value>
</property>
<property name="prefix">
<value>/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>

</beans>

Thanks for your help,
Thierry

Ben Alex
Nov 23rd, 2004, 01:35 PM
This thread might give you some more info: http://forum.springframework.org/showthread.php?t=10530

What exactly would you like to know that isn't already in the JavaDocs?

templth
Nov 24th, 2004, 02:55 AM
Thanks Ben for your answer.
I'm newbie to Acegi and some of my questions are stange... :?
I read your reference documentation and I see some informations that help me to understand how it works ( with your link to the forum... ). :D
Thierry