Shiro framework interface anonymous access settings are invalid/return 403 pit

We all know that shiro can configure all url access permissions in shiroConfig, or release some resources or interfaces, and can access anonymously, but sometimes we find that "anon" anonymous access is configured, but the interface is still inaccessible. There may be two problems in it.

First: filterChainDefinitionMap must be an ordered LinkedHashMap

 Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
        filterChainDefinitionMap.put("/static/**", "anon");

In many cases, some brothers set this as a HashMap, which is unordered, and the previous values ​​may be overwritten later, so this setting must be made orderly.

Second: There is no problem with the settings, but when postman calls the interface, it returns 403

In this case, it is possible that the system has set csrf interception

 Here, csrf verification will be performed on all urls, and 403 will be returned if it fails. . .

Guess you like

Origin blog.csdn.net/a619602087/article/details/130821396