authenticaction, registration, login fix

This commit is contained in:
Bossanyi Tibor
2020-06-10 17:26:47 +02:00
parent c685dfb71c
commit 077f7e10e6
5 changed files with 12 additions and 20 deletions
@@ -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)
}
}
}