| | |
| | | @Autowired |
| | | AuthService authService; |
| | | |
| | | @Value("${cn.mbcloud.gateway.permissions.basic}") |
| | | private Boolean isBasic = Boolean.FALSE; |
| | | |
| | | |
| | | private AntPathMatcher pathMatcher = new AntPathMatcher(); |
| | | |
| | | /** |
| | | * Redis Token 仓库前缀 |
| | | */ |
| | | private String REDIS_TOKEN_STORE_PREFIX = "oauth2_"; |
| | | |
| | | /** |
| | | * 账户 |
| | |
| | | } |
| | | |
| | | //校验参数签名 Verify parameter signature |
| | | ResultUtil resultUtil = preHandle(request); |
| | | if(resultUtil.getCode() != 200){ |
| | | log.info("签名异常"); |
| | | response.setRawStatusCode(resultUtil.getCode()); |
| | | byte[] bits = JSON.toJSONBytes(resultUtil); |
| | | DataBuffer buffer = response.bufferFactory().wrap(bits); |
| | | HttpHeaders headers = response.getHeaders(); |
| | | String first = headers.getFirst("Content-Type"); |
| | | if(StringUtils.isEmpty(first)){ |
| | | headers.add("Content-Type", "application/json;charset=UTF-8"); |
| | | } |
| | | |
| | | return response.writeWith(Mono.just(buffer)); |
| | | } |
| | | // ResultUtil resultUtil = preHandle(request); |
| | | // if(resultUtil.getCode() != 200){ |
| | | // log.info("签名异常"); |
| | | // response.setRawStatusCode(resultUtil.getCode()); |
| | | // byte[] bits = JSON.toJSONBytes(resultUtil); |
| | | // DataBuffer buffer = response.bufferFactory().wrap(bits); |
| | | // HttpHeaders headers = response.getHeaders(); |
| | | // String first = headers.getFirst("Content-Type"); |
| | | // if(StringUtils.isEmpty(first)){ |
| | | // headers.add("Content-Type", "application/json;charset=UTF-8"); |
| | | // } |
| | | // |
| | | // return response.writeWith(Mono.just(buffer)); |
| | | // } |
| | | |
| | | return chain.filter(exchange.mutate().request(request.mutate().build()).build()); |
| | | } |
| | |
| | | |
| | | } |
| | | //课程 |
| | | if (uri.startsWith(IGNORE_COURSE_URIS)) { |
| | | if (uri.startsWith(IGNORE_COURSE_PREFIX)) { |
| | | if(!StringUtils.isEmpty(IGNORE_COURSE_URIS)){ |
| | | String[] split = IGNORE_COURSE_URIS.split(","); |
| | | for (String s : split) { |