From 9523dd590809cb351bcbe0137cfcc750c1dd4a39 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Fri, 14 Feb 2020 21:11:33 -0700 Subject: [PATCH] Fix CORS --- .../com/wbrawner/budgetserver/config/SecurityConfig.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/wbrawner/budgetserver/config/SecurityConfig.kt b/src/main/kotlin/com/wbrawner/budgetserver/config/SecurityConfig.kt index d08c3e6..1e3d747 100644 --- a/src/main/kotlin/com/wbrawner/budgetserver/config/SecurityConfig.kt +++ b/src/main/kotlin/com/wbrawner/budgetserver/config/SecurityConfig.kt @@ -2,7 +2,6 @@ package com.wbrawner.budgetserver.config import com.wbrawner.budgetserver.passwordresetrequest.PasswordResetRequestRepository import com.wbrawner.budgetserver.user.UserRepository -import org.springframework.boot.web.servlet.FilterRegistrationBean import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration import org.springframework.core.env.Environment @@ -52,7 +51,7 @@ open class SecurityConfig( get() = BCryptPasswordEncoder() @Bean - open fun corsFilter(): FilterRegistrationBean<*>? { + open fun corsFilter(): CorsFilter? { val source = UrlBasedCorsConfigurationSource() val config = CorsConfiguration() config.allowCredentials = true @@ -60,9 +59,7 @@ open class SecurityConfig( config.addAllowedHeader("*") config.addAllowedMethod("*") source.registerCorsConfiguration("/**", config) - val bean: FilterRegistrationBean<*> = FilterRegistrationBean(CorsFilter(source)) - bean.order = 0 - return bean + return CorsFilter(source) } public override fun configure(auth: AuthenticationManagerBuilder?) {