shiro learns the filter-AnonymousFilter provided by 21-shiro

I don't know what you think. Anyway, I didn't see the use of this class when I first came up. An anonymous filter, that is, a filter that does not need to add an intercepted path, still needs to be written. If you don't configure this path in shiroFilterFactoryBean , it will be over. , and his onPreHandle directly returns true without any judgment operation. It was not until I read his javadoc that I understood the author's intention-to achieve filtering in a wider range.

The meaning in the Javadoc is this: Assuming we have such a requirement, all paths starting with /user must be logged in, then I can configure /user/**=authc in this way , that is, all operations for the user must be logged in verification , but for the user's login page /user/login is an exception, this anonymousFilter can be used at this time , which can match more accurately, so that the matching of this path is not limited to the above authc filter .

 

This class is so simple that it is not used in practice, because in practice, I write the path as complete as possible, so that it can be configured more flexibly at runtime.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327086430&siteId=291194637