public static final String[] EXCLUDE_URI = {AJAX_LOGIN_URI, "/common/**", "/favicon.ico",
// "/account/register"
"/account/register?**"
};
public boolean hasPermission(String requestUrl, String[] urls) {
// 路径匹配器
AntPathMatcher antPathMatcher = new AntPathMatcher();
for (String url : urls) {
if (antPathMatcher.match(url, requestUrl)) {
return true;
}
}
return false;
}
“/account/register” 这个没有通配符,需要 “/account/register?**”
因为 register 后面带着一个key,所以要 匹配符号
requestUrl /account/register?key=1111111 2022-08-08 20:13:51 [qtp66972878-17] INFO io.mvvm.handler.UrlRolesFilterHandler - SecurityConstant.EXCLUDE_URI [/ajax/login, /common/**, /favicon.ico, /account/register?**]
不过注册应该不需要后面的参数。。这是我前端写错了,不过加个通配符之后 万一前端传了path参数 至少能走进后端逻辑。。