I learned acegi yesterday and found an exception.
Org. acegisecurity. authenticationcredentialsnotfoundexception: An authentication object was not found in the securitycontext <br/> at Org. acegisecurity. intercept. abstractsecurityinterceptor. credentialsnotfound (abstractsecurityinterceptor. java: 375) <br/> at Org. acegisecurity. intercept. abstractsecurityinterceptor. beforeinvocation (abstractsecurityinterceptor. java: 288) <br/> at Org. acegisecurity. intercept. web. filtersecurityinterceptor. invoke (filtersecurityinterceptor. java: 104) <br/> at Org. acegisecurity. intercept. web. filtersecurityinterceptor. dofilter (filtersecurityinterceptor. java: 72) <br/> at Org. acegisecurity. util. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. java: 275) <br/> at Org. acegisecurity. UI. logout. logoutfilter. dofilter (logoutfilter. java: 110) <br/> at Org. acegisecurity. util. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. java: 275) <br/> at Org. acegisecurity. UI. abstractprocessingfilter. dofilter (abstractprocessingfilter. java: 271) <br/> at Org. acegisecurity. util. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. java: 275) <br/> at Org. acegisecurity. context. httpsessioncontextintegrationfilter. dofilter (httpsessioncontextintegrationfilter. java: 249) <br/> at Org. acegisecurity. util. filterchainproxy $ virtualfilterchain. dofilter (filterchainproxy. java: 275) <br/> at Org. acegisecurity. util. filterchainproxy. dofilter (filterchainproxy. java: 149) <br/> at Org. acegisecurity. util. filtertobeanproxy. dofilter (filtertobeanproxy. java: 98) <br/> at Org. apache. catalina. core. applicationfilterchain. internaldofilter (applicationfilterchain. java: 235) <br/> at Org. apache. catalina. core. applicationfilterchain. dofilter (applicationfilterchain. java: 206) <br/> at Org. apache. catalina. core. standardwrappervalve. invoke (standardwrappervalve. java: 230) <br/> at Org. apache. catalina. core. standardcontextvalve. invoke (standardcontextvalve. java: 175) <br/> at Org. apache. catalina. core. standardhostvalve. invoke (standardhostvalve. java: 128) <br/> at Org. apache. catalina. valves. errorreportvalve. invoke (errorreportvalve. java: 104) <br/> at Org. apache. catalina. core. standardenginevalve. invoke (standardenginevalve. java: 109) <br/> at Org. apache. catalina. connector. coyoteadapter. service (coyoteadapter. java: 261) <br/> at Org. apache. coyote. http11.http11processor. process (http11processor. java: 844) <br/> at Org. apache. coyote. http11.http11protocol $ http11connectionhandler. process (http11protocol. java: 581) <br/> at org.apache.tomcat.util.net. jioendpoint $ worker. run (jioendpoint. java: 447) <br/> at java. lang. thread. run (thread. java: 619)
The source code is as follows:
If (securitycontextholder. getcontext (). getauthentication () = NULL) {<br/> credentialsnotfound (messages. getmessage ("abstractsecurityinterceptor. authenticationnotfound ", <br/>" an authentication object was not found in the securitycontext "), object, ATTR); <br/>}
We can see that the exception is thrown because getauthentication () is null, but from the doc point of view, if httpsessioncontextintegrationfilter is configured, you should set "before executing other filters, determine whether a securitycontext already exists in the user's session. If securitycontext exists, put it in securitycontextholder for use by other parts of spring security. If it does not exist, create a securitycontext and put it in securitycontextholder for other parts of spring security .". From the above, it should be that context is not null, but getauthentication () is null. It is because the authentication object without authorization is blank, but the exceptiontranslationfilter I configured. So this problem has not been solved yet. It took more than two hours last night.
This morning, I suddenly thought of it, because the exceptiontranslationfilter was configured before filterinvocationinterceptor, and the exception was not captured by the exceptiontranslationfilter, So I replaced the two with the following sequence and the result was done .. When this exception occurs, the authenticationentrypoint attribute configured in predictiontranslationfilter is automatically redirected.
Solve the problem ..