In your web.xml you have to define the filters :
Code:
<!-- Obtains Authentication from HttpSession attribute, puts it into -->
<!-- ContextHolder for request duration, proceeds with request, then -->
<!-- copies Authentication from ContextHolder back into HttpSession -->
<filter>
<filter-name>Acegi Security System for Spring HttpSession Integration Filter</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>org.acegisecurity.context.HttpSessionContextIntegrationFilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi Authentication Processing Filter</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>org.acegisecurity.ui.basicauth.BasicProcessingFilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>ACEGI-HTTP-REQUEST-SECURITY-FILTER</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>org.acegisecurity.intercept.web.SecurityEnforcementFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Acegi Security System for Spring HttpSession Integration Filter</filter-name>
<url-pattern>/remoting/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Acegi Authentication Processing Filter</filter-name>
<url-pattern>/remoting/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ACEGI-HTTP-REQUEST-SECURITY-FILTER</filter-name>
<url-pattern>/remoting/*</url-pattern>
</filter-mapping>
PS : you does better this with a chain filter... but is not necessary
And in your security.xml :
Code:
<!-- Integration filter declaration -->
<!-- responsible for communicating with the user's session -->
<!-- to store the user's authentication in the ContextHolder. -->
<bean id="httpSessionIntegrationFilter" class="org.acegisecurity.context.HttpSessionContextIntegrationFilter">
<property name="context">
<value>org.acegisecurity.context.SecurityContextImpl</value>
</property>
</bean>
<!-- Basic processing filter declaration -->
<!-- processes an HTTP request's BASIC authorization headers, placing the result into the ContextHolder. -->
<bean id="basicProcessingFilter"
class="org.acegisecurity.ui.basicauth.BasicProcessingFilter">
<property name="authenticationManager">
<ref local="authenticationManager"/>
</property>
<property name="authenticationEntryPoint">
<ref local="basicProcessingFilterEntryPoint"/>
</property>
</bean>
<bean id="basicProcessingFilterEntryPoint"
class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
<property name="realmName">
<value>ATDL3 realm</value>
</property>
</bean>
<!-- Security enforcement filter -->
<!-- wraps requests to the FilterSecurityInterceptor, which defines the URLs that roles can access -->
<bean id="securityEnforcementFilter" class="org.acegisecurity.intercept.web.SecurityEnforcementFilter">
<property name="filterSecurityInterceptor">
<ref bean="filterInvocationInterceptor"/>
</property>
<property name="authenticationEntryPoint">
<ref bean="basicProcessingFilterEntryPoint"/>
</property>
</bean>
<bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
<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
/**=ROLE_USER,ROLE_SUPERVISOR
</value>
</property>
</bean>
<!-- ========== Access decision manager and voters ============================= -->
<bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions">
<value>false</value>
</property>
<property name="decisionVoters">
<list>
<ref local="roleVoter"/>
</list>
</property>
</bean>
<bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter"/>
Now you may choose the filters you want (see the API)...