Spring 3 : Can't find AuthenticationProcessingFilter

我与影子孤独终老i 提交于 2019-12-07 01:21:21

问题


I'm not able to find AuthenticationProcessingFilter when migrating from Spring 2 to Spring 3 (using spring-core)


回答1:


This class has been renamed to UsernamePasswordAuthenticationFilter in Spring security 3.x.

ref : http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/authentication/AuthenticationProcessingFilter.html




回答2:


If you're looking for constants which were available in spring 3 in AbstractAuthenticationProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY That is no longer available in that class.

Alternative is spring has added WebAttributes class org.springframework.security.web.WebAttributes in which you can get the same exception using the below code - session[WebAttributes.AUTHENTICATION_EXCEPTION]

In WebAttributes AUTHENTICATION_EXCEPTION is string defined as below WebAttributes.AUTHENTICATION_EXCEPTION = "SPRING_SECURITY_LAST_EXCEPTION_KEY"

Hopefully this helps.



来源:https://stackoverflow.com/questions/10536030/spring-3-cant-find-authenticationprocessingfilter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!