Olá pessoal,
Estou com problemas para estender um filtro do Spring Security 3.
Meu filtro:
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
public class JsonUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter {
@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
System.out.println("entrou");
return super.attemptAuthentication(request, response);
}
}
applicationContext.xml
<beans:bean id="customFormLoginFilter" class="br.com.k2studio.spring.filter.JsonUsernamePasswordAuthenticationFilter" />
<http>
<form-login login-page="/" authentication-failure-url="/?error=invalido" default-target-url="/secure/home"/>
<intercept-url pattern="/secure/**" access="ROLE_SECURE" />
<custom-filter position="FORM_LOGIN_FILTER" ref="customFormLoginFilter" />
</http>
Erro:
10:39:05,032 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Filter beans '<customFormLoginFilter>' and 'Root bean: class [org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null' have the same 'order' value. When using custom filters, please make sure the positions do not conflict with default filters. Alternatively you can disable the default filters by removing the corresponding child elements from <http> and avoiding the use of <http auto-config='true'>.
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) [:3.0.3.RELEASE]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) [:3.0.3.RELEASE]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:72) [:3.0.3.RELEASE]
....
Alguma dica de onde está o erro?
[]'s
Daniel