fix:添加loadbalancer依赖解决资源访问无权限问题

This commit is contained in:
haoxr 2021-04-03 00:16:01 +08:00
parent aa0540da35
commit 0b14992d38
2 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ public interface AuthConstants {
/**
* 后台管理接口路径匹配
*/
String ADMIN_URL_PATTERN = "/api.admin/**";
String ADMIN_URL_PATTERN = "**/api.admin/**";
String LOGOUT_PATH = "/youlai-auth/oauth/logout";

View File

@ -39,7 +39,7 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
ServerHttpRequest request = authorizationContext.getExchange().getRequest();
// Restful接口权限设计 @link https://www.cnblogs.com/haoxianrui/p/14396990.html
String restPath = request.getMethodValue() + "_" + request.getURI().getPath();
log.info("请求路径={}", restPath);
log.info("请求路径{}", restPath);
PathMatcher pathMatcher = new AntPathMatcher();
// 对应跨域的预检请求直接放行
if (request.getMethod() == HttpMethod.OPTIONS) {
@ -48,7 +48,7 @@ public class AuthorizationManager implements ReactiveAuthorizationManager<Author
// 非管理端路径无需鉴权直接放行
if (!pathMatcher.match(AuthConstants.ADMIN_URL_PATTERN, restPath)) {
log.info("请求无需鉴权,请求路径={}", restPath);
log.info("请求无需鉴权,请求路径{}", restPath);
return Mono.just(new AuthorizationDecision(true));
}