Fix CORS
This commit is contained in:
parent
e4b2466f40
commit
9523dd5908
1 changed files with 2 additions and 5 deletions
|
@ -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?) {
|
||||||
|
|
Loading…
Reference in a new issue