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 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) { 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 -> { 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) - } - */ }