1. 菜单支持外部跳转

2. 修改访问日志过滤器,排除监控请求
3. Swagger 安全验证Oauth2模式支持,追加test客户端,用于接口测试,跳过密码加密环节
This commit is contained in:
b2baccline
2019-11-22 18:38:57 +08:00
parent fbfb604b5f
commit 4b6dec13d0
16 changed files with 113 additions and 49 deletions

View File

@@ -21,9 +21,9 @@ import org.springframework.context.annotation.Configuration;
@ConditionalOnWebApplication
public class FilterConfig {
@Value("${monitor.secret-id: ballcat-monitor}")
@Value("${monitor.secret-id:ballcat-monitor}")
private String secretId;
@Value("${monitor.secret-key: =BallCat-Monitor}")
@Value("${monitor.secret-key:=BallCat-Monitor}")
private String secretKey;
@Bean

View File

@@ -1,5 +1,6 @@
package com.hccake.ballcat.commom.log.access.filter;
import cn.hutool.core.util.StrUtil;
import com.hccake.ballcat.commom.log.access.service.AccessLogHandlerService;
import com.hccake.ballcat.common.core.filter.RepeatBodyRequestWrapper;
import lombok.AllArgsConstructor;
@@ -34,6 +35,11 @@ public class AccessLogFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
// 排除监控请求 TODO 可配置
if (StrUtil.containsAnyIgnoreCase(request.getRequestURI(),"/actuator")){
filterChain.doFilter(request, response);
return;
}
RepeatBodyRequestWrapper requestWrapper = new RepeatBodyRequestWrapper(request);
@@ -67,4 +73,5 @@ public class AccessLogFilter extends OncePerRequestFilter {
}
}
}

View File

@@ -15,8 +15,19 @@
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>

View File

@@ -1,8 +1,9 @@
package com.hccake.ballcat.common.swagger;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
@@ -21,11 +22,12 @@ import java.util.List;
* @version 1.0
* @date 2019/11/1 19:43
*/
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
@ConditionalOnMissingBean
@ConfigurationProperties("swagger")
public SwaggerProperties swaggerProperties() {
return new SwaggerProperties();
}
@@ -71,7 +73,6 @@ public class SwaggerConfiguration {
.build());
}
private OAuth securitySchema() {
ArrayList<AuthorizationScope> authorizationScopeList = new ArrayList<>();
swaggerProperties().getAuthorization().getAuthorizationScopeList().forEach(authorizationScope -> authorizationScopeList.add(new AuthorizationScope(authorizationScope.getScope(), authorizationScope.getDescription())));

View File

@@ -2,8 +2,6 @@ package com.hccake.ballcat.common.swagger;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@@ -14,8 +12,6 @@ import java.util.List;
* @date 2019/11/1 19:37
*/
@Data
@Component
@ConfigurationProperties("swagger")
public class SwaggerProperties {
/**
* 是否开启swagger