authenticaction, registration, login fix
This commit is contained in:
@@ -23,9 +23,15 @@ class AuthenticationControllerAspect {
|
||||
private lateinit var properties: ApplicationProperties
|
||||
|
||||
@Before("execution(* com.aitrainer.api.security.JwtAuthenticationController.*(..))")
|
||||
fun customerControllerAspect(joinPoint: JoinPoint) {
|
||||
fun authControllerAspect(joinPoint: JoinPoint) {
|
||||
println("auth controller join")
|
||||
Singleton.checkDBUpdate(configurationRepository, properties)
|
||||
}
|
||||
|
||||
@Before("execution(* com.aitrainer.api.security.JwtSecurityConfig.*(..))")
|
||||
fun securityControllerAspect(joinPoint: JoinPoint) {
|
||||
println("JwtSecurity config join")
|
||||
Singleton.checkDBUpdate(configurationRepository, properties)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,10 +40,14 @@ class JwtAuthenticationController {
|
||||
private fun authenticate(username: String, password: String) {
|
||||
try {
|
||||
authenticationManager!!.authenticate(UsernamePasswordAuthenticationToken(username, password))
|
||||
println("authenticating....")
|
||||
} catch (e: DisabledException) {
|
||||
throw Exception("USER_DISABLED", e)
|
||||
} catch (e: BadCredentialsException) {
|
||||
throw Exception("INVALID_CREDENTIALS", e)
|
||||
} catch( e: Exception) {
|
||||
println("Auth exception " + e.message)
|
||||
throw Exception("Other Exception", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user