Browse Source

整理swagger配置

master
xsx 2 years ago
parent
commit
1c98ccf3f9
  1. 4
      im-client/pom.xml
  2. 9
      im-commom/pom.xml
  3. 13
      im-platform/pom.xml
  4. 11
      im-platform/src/main/java/com/bx/implatform/config/MvcConfig.java
  5. 6
      im-platform/src/main/java/com/bx/implatform/config/SwaggerConfig.java
  6. 2
      im-platform/src/main/java/com/bx/implatform/controller/LoginController.java
  7. 2
      im-platform/src/main/java/com/bx/implatform/controller/UserController.java
  8. 2
      im-platform/src/main/java/com/bx/implatform/controller/WebrtcGroupController.java
  9. 2
      im-platform/src/main/java/com/bx/implatform/controller/WebrtcPrivateController.java
  10. 2
      im-platform/src/main/java/com/bx/implatform/interceptor/AuthInterceptor.java
  11. BIN
      im-platform/src/main/resources/static/favicon.ico
  12. 11
      im-server/pom.xml
  13. 35
      pom.xml

4
im-client/pom.xml

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>box-im</artifactId> <artifactId>box-im</artifactId>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<version>2.0.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -15,7 +15,7 @@
<dependency> <dependency>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<artifactId>im-commom</artifactId> <artifactId>im-commom</artifactId>
<version>2.0.0</version> <version>3.0.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

9
im-commom/pom.xml

@ -5,16 +5,11 @@
<parent> <parent>
<artifactId>box-im</artifactId> <artifactId>box-im</artifactId>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<version>2.0.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>im-commom</artifactId> <artifactId>im-commom</artifactId>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>

13
im-platform/pom.xml

@ -5,18 +5,16 @@
<parent> <parent>
<artifactId>box-im</artifactId> <artifactId>box-im</artifactId>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<version>2.0.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>im-platform</artifactId> <artifactId>im-platform</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<artifactId>im-client</artifactId> <artifactId>im-client</artifactId>
<version>2.0.0</version> <version>3.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -53,11 +51,6 @@
<groupId>org.aspectj</groupId> <groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId> <artifactId>aspectjweaver</artifactId>
</dependency> </dependency>
<!-- 引入redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId> <artifactId>spring-security-crypto</artifactId>
@ -99,14 +92,12 @@
<version>${knife4j.version}</version> <version>${knife4j.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>3.3.1</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

11
im-platform/src/main/java/com/bx/implatform/config/MvcConfig.java

@ -19,13 +19,10 @@ public class MvcConfig implements WebMvcConfigurer {
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(xssInterceptor) registry.addInterceptor(xssInterceptor).addPathPatterns("/**").excludePathPatterns("/error");
.addPathPatterns("/**") registry.addInterceptor(authInterceptor).addPathPatterns("/**")
.excludePathPatterns("/error"); .excludePathPatterns("/login", "/logout", "/register", "/refreshToken", "/swagger/**", "/v3/api-docs/**",
registry.addInterceptor(authInterceptor) "/swagger-resources/**", "/swagger-ui.html", "/swagger-ui/**", "/doc.html");
.addPathPatterns("/**")
.excludePathPatterns("/login", "/logout", "/register", "/refreshToken",
"/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
} }
@Bean @Bean

6
im-platform/src/main/java/com/bx/implatform/config/SwaggerConfig.java

@ -16,7 +16,7 @@ public class SwaggerConfig {
public GroupedOpenApi userApi() { public GroupedOpenApi userApi() {
String[] paths = {"/**"}; String[] paths = {"/**"};
String[] packagedToMatch = {"com.bx"}; String[] packagedToMatch = {"com.bx"};
return GroupedOpenApi.builder().group("BoxIM") return GroupedOpenApi.builder().group("IM-Platform")
.pathsToMatch(paths) .pathsToMatch(paths)
.packagesToScan(packagedToMatch).build(); .packagesToScan(packagedToMatch).build();
} }
@ -26,8 +26,8 @@ public class SwaggerConfig {
Contact contact = new Contact(); Contact contact = new Contact();
contact.setName("Blue"); contact.setName("Blue");
return new OpenAPI().info(new Info() return new OpenAPI().info(new Info()
.title("Box-IM") .title("盒子IM")
.description("盒子IM") .description("盒子IM业务平台服务")
.contact(contact) .contact(contact)
.version("3.0") .version("3.0")
.termsOfService("https://www.boxim.online") .termsOfService("https://www.boxim.online")

2
im-platform/src/main/java/com/bx/implatform/controller/LoginController.java

@ -13,7 +13,7 @@ import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@Tag(name = "用户登录和注册") @Tag(name = "注册登陆")
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
public class LoginController { public class LoginController {

2
im-platform/src/main/java/com/bx/implatform/controller/UserController.java

@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@Tag(name = "用户") @Tag(name = "用户相关")
@RestController @RestController
@RequestMapping("/user") @RequestMapping("/user")
@RequiredArgsConstructor @RequiredArgsConstructor

2
im-platform/src/main/java/com/bx/implatform/controller/WebrtcGroupController.java

@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
* @date: 2024-06-01 * @date: 2024-06-01
* @version: 1.0 * @version: 1.0
*/ */
@Tag(name = "webrtc视频多人通话") @Tag(name = "多人通话")
@RestController @RestController
@RequestMapping("/webrtc/group") @RequestMapping("/webrtc/group")
@RequiredArgsConstructor @RequiredArgsConstructor

2
im-platform/src/main/java/com/bx/implatform/controller/WebrtcPrivateController.java

@ -9,7 +9,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@Tag(name = "webrtc视频单人通话") @Tag(name = "单人通话")
@RestController @RestController
@RequestMapping("/webrtc/private") @RequestMapping("/webrtc/private")
@RequiredArgsConstructor @RequiredArgsConstructor

2
im-platform/src/main/java/com/bx/implatform/interceptor/AuthInterceptor.java

@ -37,7 +37,7 @@ public class AuthInterceptor implements HandlerInterceptor {
} }
String strJson = JwtUtil.getInfo(token); String strJson = JwtUtil.getInfo(token);
UserSession userSession = JSON.parseObject(strJson, UserSession.class); UserSession userSession = JSON.parseObject(strJson, UserSession.class);
//验证 token // 验证 token
if (!JwtUtil.checkSign(token, jwtProperties.getAccessTokenSecret())) { if (!JwtUtil.checkSign(token, jwtProperties.getAccessTokenSecret())) {
log.error("token已失效,用户:{}", userSession.getUserName()); log.error("token已失效,用户:{}", userSession.getUserName());
log.error("token:{}", token); log.error("token:{}", token);

BIN
im-platform/src/main/resources/static/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

11
im-server/pom.xml

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>box-im</artifactId> <artifactId>box-im</artifactId>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<version>2.0.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -16,27 +16,20 @@
<dependency> <dependency>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<artifactId>im-commom</artifactId> <artifactId>im-commom</artifactId>
<version>2.0.0</version> <version>3.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
<version>4.1.42.Final</version> <version>4.1.42.Final</version>
</dependency> </dependency>
<!-- 引入redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<version>3.3.1</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>

35
pom.xml

@ -7,7 +7,7 @@
<artifactId>box-im</artifactId> <artifactId>box-im</artifactId>
<groupId>com.bx</groupId> <groupId>com.bx</groupId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>2.0.0</version> <version>3.0.0</version>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
@ -70,37 +70,6 @@
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>${hutool.version}</version> <version>${hutool.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.10.RELEASE</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -116,4 +85,6 @@
</snapshots> </snapshots>
</repository> </repository>
</repositories> </repositories>
</project> </project>
Loading…
Cancel
Save