Change authentication request path #8
@@ -10,4 +10,4 @@ COPY ${EXTRACTED}/snapshot-dependencies/ /
|
|||||||
RUN true
|
RUN true
|
||||||
COPY ${EXTRACTED}/application/ /
|
COPY ${EXTRACTED}/application/ /
|
||||||
|
|
||||||
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=file:data/", "${JAVA_OPTS}"]
|
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--spring.config.additional-location=file:data/"]
|
||||||
@@ -58,7 +58,7 @@ class SecurityConfig(
|
|||||||
authorizeHttpRequests
|
authorizeHttpRequests
|
||||||
// Allow anonymous access
|
// Allow anonymous access
|
||||||
.requestMatchers(
|
.requestMatchers(
|
||||||
"/api/v*/login",
|
"/login",
|
||||||
"/error/thrown",
|
"/error/thrown",
|
||||||
"/doc.html",
|
"/doc.html",
|
||||||
"/swagger-ui/**",
|
"/swagger-ui/**",
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import top.fatweb.api.service.permission.IAuthenticationService
|
|||||||
import top.fatweb.api.util.WebUtil
|
import top.fatweb.api.util.WebUtil
|
||||||
|
|
||||||
@Tag(name = "身份认证", description = "身份认证相关接口")
|
@Tag(name = "身份认证", description = "身份认证相关接口")
|
||||||
@Suppress("MVCPathVariableInspection")
|
|
||||||
@RequestMapping("/api/{apiVersion}")
|
|
||||||
@ApiVersion(2)
|
@ApiVersion(2)
|
||||||
@RestController
|
@RestController
|
||||||
class AuthenticationController(val authenticationService: IAuthenticationService, val userConverter: UserConverter) {
|
class AuthenticationController(val authenticationService: IAuthenticationService, val userConverter: UserConverter) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class ExceptionHandler {
|
|||||||
|
|
||||||
is InternalAuthenticationServiceException -> {
|
is InternalAuthenticationServiceException -> {
|
||||||
log.debug(e.localizedMessage, e)
|
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 -> {
|
is BadCredentialsException -> {
|
||||||
|
|||||||
@@ -20,15 +20,4 @@ class FatWebApiApplicationTests {
|
|||||||
val jwt = JwtUtil.createJwt("User")
|
val jwt = JwtUtil.createJwt("User")
|
||||||
assertEquals("User", jwt?.let { JwtUtil.parseJwt(it).subject })
|
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)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user