Results 1 to 5 of 5

Thread: Bean based configuration and filters="none"

  1. #1
    Join Date
    Aug 2010
    Posts
    26

    Default Bean based configuration and filters="none"

    Hello All-
    I recently switched from <http auto-config='true'...> to bean based configuration.

    Background:
    I have a pre-auth scenario (Apache + Shibboleth)

    All the css, js and images are under /resources

    I would like to use filters="none" for /resources (as I used to when using <http>), however it results in:
    Code:
    Bean 'fsi'; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: The attribute 'filters' isn't allowed here.
    Code:
    <bean id="fsi"
    		class="org.springframework.security.web.access.intercept.FilterSecurityInterceptor">
    		<property name="authenticationManager" ref="authenticationManager" />
    		<property name="accessDecisionManager" ref="httpRequestAccessDecisionManager" />
    		<property name="securityMetadataSource">
    			<security:filter-security-metadata-source
    				use-expressions="true">
    				<security:intercept-url pattern="/resources/**"
    					filters="none" />
    				<security:intercept-url pattern="/login*"
    					access="permitAll" />
    				<security:intercept-url pattern="/logout*"
    					access="permitAll" />
    				<security:intercept-url pattern="/newlogin"
    					access="hasRole('ROLE_USER')" />
    				<security:intercept-url pattern="/**"
    					access="hasRole('ROLE_USER')" />
    			</security:filter-security-metadata-source>
    		</property>
    	</bean>
    I do have WebExpressionVoter defined:

    Code:
    <bean id="httpRequestAccessDecisionManager"
    		class="org.springframework.security.access.vote.AffirmativeBased">
    		<property name="allowIfAllAbstainDecisions" value="false" />
    		<property name="decisionVoters">
    			<list>
    				<ref bean="roleVoter" />
    				<ref bean="webExpVoter" />
    			</list>
    		</property>
    	</bean>
    
    <bean id="webExpVoter"
    		class="org.springframework.security.web.access.expression.WebExpressionVoter" />
    Is it not possible in bean based configurations?
    Any help will be highly appreciated.
    Thanks.

  2. #2
    Join Date
    Dec 2008
    Location
    New York City
    Posts
    134

    Default

    The version for spring security matters with regards to your question. For more recent versions, you should change "filters="none"" to "access="permitAll""
    Andrew Thompson - Linked In

  3. #3
    Join Date
    Aug 2010
    Posts
    26

    Default

    I'm using Spring Security 3.0.5.

    I was under the impression
    Code:
    filters="none"
    is a bit more efficient (especially for static resources, such as css & js) than
    Code:
    access="permitAll"
    as the former completely circumvents authorization as opposed to the latter where authorization still happens with a true for all.

    Is this not correct?

  4. #4
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    You are confusing configuration of the FilterSecurityInterceptor with the FilterChainProxy. The latter maintains the filter chains which requests are mapped to - you should configure an empty filter chain for the pattern you wish to have omitted from Spring Security's handling.

    Using filters="none" within the FilterSecurityInterceptor configuration does not make any sense, as it is a single filter within the security filter chain.
    Spring - by Pivotal
    twitter @tekul

  5. #5
    Join Date
    Aug 2010
    Posts
    26

    Default

    Changed the filterChain to
    Code:
    <beans:bean id="springSecurityFilterChain"
    		class="org.springframework.security.web.FilterChainProxy">
    		<filter-chain-map path-type="ant">
    			<filter-chain pattern="/resources/**" filters="none" />
    			<filter-chain pattern="/**"
    				filters="sif,shibbolethFilter,logoutFilter,etf,fsi" />
    
    		</filter-chain-map>
    	</beans:bean>
    Thanks a lot for explaining.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •