From 4ac8711267b68a7f8b314022dfa56caba362ddc6 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 9 Oct 2023 18:16:41 +0800 Subject: [PATCH 1/4] Remove ${JAVA_OPTS} in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5f96fac..2dca17c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,4 @@ COPY ${EXTRACTED}/snapshot-dependencies/ / RUN true COPY ${EXTRACTED}/application/ / -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=file:data/", "${JAVA_OPTS}"] \ No newline at end of file +ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=file:data/"] \ No newline at end of file -- 2.49.1 From 88341b50fd63573b98366458477c10610bc1da48 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Mon, 9 Oct 2023 18:17:06 +0800 Subject: [PATCH 2/4] Optimized username not found message --- src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt b/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt index 5e742e1..c4abedb 100644 --- a/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt +++ b/src/main/kotlin/top/fatweb/api/handler/ExceptionHandler.kt @@ -40,7 +40,7 @@ class ExceptionHandler { is InternalAuthenticationServiceException -> { log.debug(e.localizedMessage, e) - ResponseResult.fail(ResponseCode.SYSTEM_USERNAME_NOT_FOUND, e.localizedMessage, null) + ResponseResult.fail(ResponseCode.SYSTEM_USERNAME_NOT_FOUND, "Username not found", null) } is BadCredentialsException -> { -- 2.49.1 From b34b7cd9e0b5c4ba2bae3db7b7f868de261173cf Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Tue, 10 Oct 2023 14:48:38 +0800 Subject: [PATCH 3/4] Remove add user test --- .../top/fatweb/api/FatWebApiApplicationTests.kt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/test/kotlin/top/fatweb/api/FatWebApiApplicationTests.kt b/src/test/kotlin/top/fatweb/api/FatWebApiApplicationTests.kt index 6d0c220..5ed443f 100644 --- a/src/test/kotlin/top/fatweb/api/FatWebApiApplicationTests.kt +++ b/src/test/kotlin/top/fatweb/api/FatWebApiApplicationTests.kt @@ -20,15 +20,4 @@ class FatWebApiApplicationTests { val jwt = JwtUtil.createJwt("User") assertEquals("User", jwt?.let { JwtUtil.parseJwt(it).subject }) } - - /* - @Test - fun addUser(@Autowired userService: IUserService, @Autowired passwordEncoder: PasswordEncoder) { - val username = "admin" - val rawPassword = "admin" - val encodedPassword = passwordEncoder.encode(rawPassword) - val user = User(username, encodedPassword) - userService.save(user) - } - */ } -- 2.49.1 From b1044b8beb2d4db1ef5eb9a3743d99e4524cdc23 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Tue, 10 Oct 2023 15:45:04 +0800 Subject: [PATCH 4/4] Change authentication request path --- src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt | 2 +- .../api/controller/permission/AuthenticationController.kt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt b/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt index 5836f3d..4ab79bc 100644 --- a/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt +++ b/src/main/kotlin/top/fatweb/api/config/SecurityConfig.kt @@ -58,7 +58,7 @@ class SecurityConfig( authorizeHttpRequests // Allow anonymous access .requestMatchers( - "/api/v*/login", + "/login", "/error/thrown", "/doc.html", "/swagger-ui/**", diff --git a/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt b/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt index 63f68b4..2dd6960 100644 --- a/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt +++ b/src/main/kotlin/top/fatweb/api/controller/permission/AuthenticationController.kt @@ -14,8 +14,6 @@ import top.fatweb.api.service.permission.IAuthenticationService import top.fatweb.api.util.WebUtil @Tag(name = "身份认证", description = "身份认证相关接口") -@Suppress("MVCPathVariableInspection") -@RequestMapping("/api/{apiVersion}") @ApiVersion(2) @RestController class AuthenticationController(val authenticationService: IAuthenticationService, val userConverter: UserConverter) { -- 2.49.1