Moved password required for submissions to external configuration file.

This commit is contained in:
neviyn 2018-10-10 10:09:28 +01:00
parent 1f8f5889cc
commit bd2aa557b4
2 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package uk.co.neviyn.observationdatabase
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.core.env.Environment
import org.springframework.http.HttpMethod
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
import org.springframework.security.config.annotation.web.builders.HttpSecurity
@ -25,12 +26,14 @@ class CustomWebSecurityConfigurerAdapter : WebSecurityConfigurerAdapter() {
@Autowired
lateinit var authenticationEntryPoint: MyBasicAuthenticationEntryPoint
@Autowired
lateinit var environment: Environment
@Autowired
@Throws(Exception::class)
fun configureGlobal(auth: AuthenticationManagerBuilder) {
auth.inMemoryAuthentication()
.withUser("admin").password(passwordEncoder().encode("admin"))
.withUser("admin").password(passwordEncoder().encode(environment.getProperty("obsdb.password")))
.authorities("ROLE_USER")
}

View File

@ -1,3 +1,4 @@
spring.jpa.properties.jadira.usertype.autoRegisterUserTypes = true
spring.datasource.url=jdbc:h2:file:./database
spring.jpa.hibernate.ddl-auto=update
obsdb.password=observation