Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议LoginAuthenticationFilter 属性authFilterExcludeUrls配置支持uri: /xx/** #1967

Closed
xiaoxb opened this issue Jan 15, 2021 · 4 comments · Fixed by #1971
Closed

建议LoginAuthenticationFilter 属性authFilterExcludeUrls配置支持uri: /xx/** #1967

xiaoxb opened this issue Jan 15, 2021 · 4 comments · Fixed by #1971
Labels
area/dashboard Issues or PRs about Sentinel Dashboard good first issue Good for newcomers

Comments

@xiaoxb
Copy link

xiaoxb commented Jan 15, 2021

Issue Description

Type: bug report or feature request

Describe what happened (or what feature you want)

url只能精准匹配
if(authFilterExcludeUrls.contains(servletPath)) {
chain.doFilter(request, response);
return;
}

Describe what you expected to happen

// Exclude the urls which needn't auth
for (String authFilterExcludeUrl : authFilterExcludeUrls) {
if (isMatch(authFilterExcludeUrl, servletPath)) {
chain.doFilter(request, response);
return;
}
}

// 判断url是否与规则配置: ? 表示单个字符; * 表示一层路径内的任意字符串,不可跨层级; ** 表示任意层路径;
public Boolean isMatch(String pattern, String url) {
AntPathMatcher matcher = new AntPathMatcher();
return matcher.match(pattern, url);
}

private static final AntPathMatcher PATH_MATCHER = new AntPathMatcher();

if (authFilterExcludeUrls.stream().anyMatch(s -> PATH_MATCHER.match(s, servletPath))) {
chain.doFilter(request, response);
return;
}

How to reproduce it (as minimally and precisely as possible)

Tell us your environment

master

Anything else we need to know?

@sczyh30 sczyh30 added the area/dashboard Issues or PRs about Sentinel Dashboard label Jan 15, 2021
@sczyh30
Copy link
Member

sczyh30 commented Jan 15, 2021

Would you like to contribute a PR to fix it?

@sczyh30 sczyh30 added the good first issue Good for newcomers label Jan 15, 2021
@brotherlu-xcq
Copy link
Collaborator

I want to solve it If there's no one.

@xiaoxb
Copy link
Author

xiaoxb commented Jan 18, 2021 via email

@sczyh30
Copy link
Member

sczyh30 commented Jan 27, 2021

Resolved in #1971

@sczyh30 sczyh30 closed this as completed Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dashboard Issues or PRs about Sentinel Dashboard good first issue Good for newcomers
Projects
None yet
3 participants