Merge branch 'tibor' into 'master'
authenticaction, registration, login fix See merge request bossanyit/aitrainer_server!2
This commit is contained in:
commit
e3e02a5bef
@ -1 +1,2 @@
|
||||
INSERT INTO `customer` (`name`, `firstname`, `email`, `password`, `sex`, `age`, `active`, `date_add`, `date_change`, `data_policy_allowed`, `admin`) VALUES ('Dummy User', NULL, 'bosi', '$2a$10$thOc8jS750c7xe9U9Qq3GuSPs/H0Pt2Ads05yzUlyzQBIj.Rk9QCy', 'm', 40, 'N', NULL, NULL, 1, 1);
|
||||
UPDATE configuration set config_value = "0.0.3" WHERE config_key = "db_version";
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,4 @@ class ConfigurationTest {
|
||||
private lateinit var configurationRepository: ConfigurationRepository
|
||||
private lateinit var configurationController: ConfigurationController
|
||||
|
||||
@Test
|
||||
fun testUpdateConfig() {
|
||||
val config: Configuration = configurationRepository.findByConfigKey("db_version")
|
||||
config.configValue = "0.0.2"
|
||||
|
||||
configurationController = ConfigurationController(configurationRepository)
|
||||
val updatedConfig: Configuration = configurationController.updateConfiguration(config)
|
||||
assertEquals(updatedConfig.configValue, "0.0.2")
|
||||
|
||||
val foundConfig: Configuration = configurationRepository.findByConfigKey("db_version")
|
||||
assertEquals(foundConfig.configValue, "0.0.2")
|
||||
|
||||
}
|
||||
}
|
@ -12,12 +12,6 @@ class PropertiesTest {
|
||||
@Autowired
|
||||
private lateinit var properties: ApplicationProperties
|
||||
|
||||
@Test
|
||||
fun testProperties() {
|
||||
val version: String = properties.getVersion()
|
||||
assertEquals(version, "0.0.2")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testDatasourceUrl() {
|
||||
val url: String = properties.getDatasourceUrl()
|
||||
|
Loading…
Reference in New Issue
Block a user