This commit is contained in:
William Brawner 2020-02-14 23:11:38 -07:00
parent d8faa66a1c
commit bb160448be

View file

@ -15,7 +15,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
import org.springframework.security.crypto.password.PasswordEncoder import org.springframework.security.crypto.password.PasswordEncoder
import org.springframework.security.provisioning.JdbcUserDetailsManager import org.springframework.security.provisioning.JdbcUserDetailsManager
import org.springframework.security.web.header.writers.StaticHeadersWriter import org.springframework.web.cors.CorsConfiguration
import javax.sql.DataSource import javax.sql.DataSource
@ -62,14 +62,13 @@ open class SecurityConfig(
.and() .and()
.httpBasic() .httpBasic()
.and() .and()
.cors()
.configurationSource {
CorsConfiguration().applyPermitDefaultValues()
}
.and()
.csrf() .csrf()
.disable() .disable()
.headers()
.addHeaderWriter(StaticHeadersWriter("Access-Control-Allow-Origin", "*"))
.addHeaderWriter(StaticHeadersWriter("Access-Control-Allow-Methods", "GET", "POST", "PUT", "DELETE"))
.addHeaderWriter(StaticHeadersWriter("Access-Control-Max-Age", "3600"))
.addHeaderWriter(StaticHeadersWriter("Access-Control-Allow-Credentials", "true"))
.addHeaderWriter(StaticHeadersWriter("Access-Control-Allow-Headers", "Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization"));
} }
} }