Skip to content

Commit 489919e

Browse files
committed
remove cors confgis
1 parent 0436e05 commit 489919e

File tree

6 files changed

+0
-22
lines changed

6 files changed

+0
-22
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ The project requires a set of environment variables to be configured for some se
9595
| SPOTIFY_CLIENT_SECRET | Backend | Taken from Spotify developer dashboard |
9696
| DEFAULT_SUCCESS_URL | Backend | Redirect for a user after a successful login |
9797
| LOGIN_URL | Backend | Redirect for a user after a failed login |
98-
| CORS_ALLOWED_ORIGINS | Backend | CORS allowed origins for security |
9998
| SERVER_SERVLET_SESSION_COOKIE_DOMAIN | Backend | Base domain for frontend and backend |
10099
| SERVER_SERVLET_SESSION_COOKIE_NAME | Backend | Cookie name for frontend and backend, for ex. JSESSIONID-STAGE |
101100
| OPENAI_API_KEY | Backend | Taken from OpenAI platform organisation |

artist-insight-service/src/main/kotlin/org/taonity/artistinsightservice/mvc/security/SecurityConfig.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe
1111
import org.springframework.security.web.SecurityFilterChain
1212
import org.springframework.security.web.authentication.HttpStatusEntryPoint
1313
import org.springframework.security.web.csrf.*
14-
import org.springframework.web.cors.CorsConfiguration
15-
import org.springframework.web.cors.UrlBasedCorsConfigurationSource
1614
import java.util.*
1715

1816

@@ -23,7 +21,6 @@ class SecurityConfig(
2321
private val oAuth2AuthenticationFailureHandler: OAuth2AuthenticationFailureHandler,
2422
private val spaCsrfTokenRequestHandler: SpaCsrfTokenRequestHandler,
2523
@Value("\${app.default-success-url}") private val defaultSuccessUrl: String,
26-
@Value("\${app.cors-allowed-origins}") private val corsAllowedOrigins: String,
2724
@Value("\${app.csrf-cookie-name}") private val csrfCookieName: String
2825
) {
2926

@@ -66,22 +63,8 @@ class SecurityConfig(
6663
.failureHandler(oAuth2AuthenticationFailureHandler)
6764
}
6865
.oauth2Client(Customizer.withDefaults())
69-
.cors { }
7066

7167
return http.build()
7268
}
73-
74-
// TODO: verify effectiveness
75-
// @Bean
76-
fun corsConfigurationSource(): UrlBasedCorsConfigurationSource {
77-
val configuration = CorsConfiguration()
78-
configuration.allowCredentials = true
79-
configuration.allowedOrigins = listOf(corsAllowedOrigins)
80-
configuration.allowedMethods = listOf("*")
81-
configuration.allowedHeaders = listOf("*")
82-
val source = UrlBasedCorsConfigurationSource()
83-
source.registerCorsConfiguration("/**", configuration)
84-
return source
85-
}
8669
}
8770

artist-insight-service/src/main/resources/application-prod-spotify.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ spring:
2424
app:
2525
default-success-url: ${DEFAULT_SUCCESS_URL:http://localhost:3000}
2626
login-url: ${LOGIN_URL:http://localhost:3000/login}
27-
cors-allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000}
2827

2928
spotify:
3029
api-base-url: https://api.spotify.com/v1

artist-insight-service/src/main/resources/application-stub-spotify.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ spring:
2424
app:
2525
default-success-url: ${DEFAULT_SUCCESS_URL:http://localhost:3000}
2626
login-url: ${LOGIN_URL:http://localhost:3000/login}
27-
cors-allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000}
2827

2928
spotify:
3029
api-base-url: http://localhost:8100/v1

artist-insight-service/src/test/resources/application.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ openai:
3030

3131
app:
3232
default-success-url: /
33-
cors-allowed-origins: http://localhost:8100
3433
minimised-http-servlet-logging: false
3534
initial-user-gpt-usages: 10
3635
initial-global-gpt-usages: 50

templates/docker/.test-env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ POSTGRES_ADDRESS=db
1010
SPOTIFY_CLIENT_ID=
1111
SPOTIFY_CLIENT_SECRET=
1212
DEFAULT_SUCCESS_URL=http://localhost:3002
13-
CORS_ALLOWED_ORIGINS=http://host.docker.internal:3002
1413
SPRING_PROFILES_ACTIVE=postgres,prod-spotify,stub-openai,stub-kofi,local
1514

1615
LOCAL_BACKEND_URL: http://app:9016

0 commit comments

Comments
 (0)