Thanks, Ben.
I tried using two separate SecurityEnforcementFilters but the second one -- using the basic auth entry point -- doesn't seem to work. Looking at the log, it looks like the filter interceptor is never getting triggered.
Perhaps my configuration is incorrect, so please find the relevant parts below:
web.xml:
Code:
<filter>
<filter-name>Acegi HTTP BASIC Authorization 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.basicauth.BasicProcessingFilter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
<url-pattern>*.rss</url-pattern>
</filter-mapping>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.rss</url-pattern>
</servlet-mapping>
applicationContext.xml:
Code:
<bean id="rssFilterSecurityInterceptor"
class="net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager">
<ref bean="authenticationManager"/>
</property>
<property name="accessDecisionManager">
<ref bean="accessDecisionManager"/>
</property>
<property name="objectDefinitionSource">
<value><![CDATA[
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/feeds/*.rss=ROLE_USER
]]></value>
</property>
</bean>
<bean id="basicSecurityEnforcementFilter"
class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
<property name="filterSecurityInterceptor">
<ref bean="rssFilterSecurityInterceptor"/>
</property>
<property name="authenticationEntryPoint">
<ref bean="basicAuthenticationEntryPoint"/>
</property>
</bean>
<bean id="basicProcessingFilter"
class="net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter">
<property name="authenticationManager">
<ref bean="authenticationManager"/>
</property>
<property name="authenticationEntryPoint">
<ref bean="basicAuthenticationEntryPoint"/>
</property>
</bean>
<bean id="basicAuthenticationEntryPoint"
class="net.sf.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
<property name="realmName">
<value>My Domain</value>
</property>
</bean>
And my log file:
Code:
2005-01-27 16:04:24,906 DEBUG [net.sf.acegisecurity.ui.AbstractIntegrationFilter] - <Authentication added to ContextHolder from container>
2005-01-27 16:04:24,908 DEBUG [net.sf.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap] - <Converted URL to lowercase, from: 'org.apache.catalina.connector.RequestFacade@1ed957d'; to: '/feeds/alerts.rss'>
2005-01-27 16:04:24,908 DEBUG [net.sf.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap] - <Candidate is: '/feeds/alerts.rss'; pattern is /app/**; matched=false>
2005-01-27 16:04:24,908 DEBUG [net.sf.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap] - <Candidate is: '/feeds/alerts.rss'; pattern is /admin/**; matched=false>
2005-01-27 16:04:24,908 DEBUG [net.sf.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap] - <Candidate is: '/feeds/alerts.rss'; pattern is /servlet/**; matched=false>
2005-01-27 16:04:24,909 DEBUG [net.sf.acegisecurity.intercept.web.PathBasedFilterInvocationDefinitionMap] - <Candidate is: '/feeds/alerts.rss'; pattern is /errors/**; matched=false>
2005-01-27 16:04:24,909 DEBUG [net.sf.acegisecurity.intercept.AbstractSecurityInterceptor] - <Public object - authentication not attempted>
2005-01-27 16:04:24,909 DEBUG [net.sf.acegisecurity.intercept.AbstractSecurityInterceptor] - <Authentication object detected and tagged as unauthenticated>
2005-01-27 16:04:24,909 DEBUG [net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter] - <Authorization header: null