0 Replies Latest reply on Oct 10, 2011 11:45 AM by Djed Pfeiler

    Inject with "Spring Security Filter" not working

    Djed Pfeiler Newbie

      I ran a normal Servlet Filter with an injected SessionScope bean without problems.
      But within a SpringSecurity-LoginFilter the injected bean has only null value.


      Spring Security config goes like this:


      web.xml



      <filter>
              <filter-name>filterChainProxy</filter-name>
              <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      </filter>
      <filter-mapping>
              <filter-name>filterChainProxy</filter-name>
              <url-pattern>/*</url-pattern>
      </filter-mapping>





      security.xml (Spring config)



      <bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy">
              <sec:filter-chain-map path-type="ant">
                      <sec:filter-chain pattern="/*.xhtml" filters="loginFilter" />
              </sec:filter-chain-map>
      </bean>
      <bean id="loginFilter" class="com.test.filter.LoginFilter" />





      LoginFilter.java



      @Inject
      private ModelBean modelBean;
      




      modelBean is null when Filter is triggered.



      Has someone got this working? CDI / Spring Security / DelegatingFilterProxy


      Thanks a lot in advance!