This commit is contained in:
William Brawner 2020-02-14 21:11:33 -07:00
parent e4b2466f40
commit 9523dd5908

View file

@ -2,7 +2,6 @@ package com.wbrawner.budgetserver.config
import com.wbrawner.budgetserver.passwordresetrequest.PasswordResetRequestRepository import com.wbrawner.budgetserver.passwordresetrequest.PasswordResetRequestRepository
import com.wbrawner.budgetserver.user.UserRepository import com.wbrawner.budgetserver.user.UserRepository
import org.springframework.boot.web.servlet.FilterRegistrationBean
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Configuration
import org.springframework.core.env.Environment import org.springframework.core.env.Environment
@ -52,7 +51,7 @@ open class SecurityConfig(
get() = BCryptPasswordEncoder() get() = BCryptPasswordEncoder()
@Bean @Bean
open fun corsFilter(): FilterRegistrationBean<*>? { open fun corsFilter(): CorsFilter? {
val source = UrlBasedCorsConfigurationSource() val source = UrlBasedCorsConfigurationSource()
val config = CorsConfiguration() val config = CorsConfiguration()
config.allowCredentials = true config.allowCredentials = true
@ -60,9 +59,7 @@ open class SecurityConfig(
config.addAllowedHeader("*") config.addAllowedHeader("*")
config.addAllowedMethod("*") config.addAllowedMethod("*")
source.registerCorsConfiguration("/**", config) source.registerCorsConfiguration("/**", config)
val bean: FilterRegistrationBean<*> = FilterRegistrationBean(CorsFilter(source)) return CorsFilter(source)
bean.order = 0
return bean
} }
public override fun configure(auth: AuthenticationManagerBuilder?) { public override fun configure(auth: AuthenticationManagerBuilder?) {