Skip to content

Commit be17799

Browse files
committed
Set allowed origins now that CORS exists.
Attempt to fix 200 on 403 by setting response error code
1 parent d0e138f commit be17799

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

core/src/main/kotlin/net/osable/core/SecurityConfiguration.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,15 @@ class SecurityConfiguration {
4343
http.exceptionHandling().accessDeniedHandler { request, response, accessDeniedException ->
4444
println("Access denied. Cause: ${accessDeniedException.cause} | Message: ${accessDeniedException.message}")
4545
accessDeniedException.printStackTrace()
46+
response.status = request.getErrorCode()
4647
}
4748

4849
http.cors().configurationSource {
49-
CorsConfiguration().applyPermitDefaultValues()
50+
CorsConfiguration()
51+
.applyPermitDefaultValues()
52+
.apply {
53+
allowedOrigins = listOf("https://osable.net")
54+
}
5055
}
5156

5257
return http.build()

core/src/main/kotlin/net/osable/core/web/FormController.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import org.springframework.web.bind.annotation.ResponseStatus
1414
import org.springframework.web.reactive.function.client.WebClient
1515

1616
@Controller
17-
// Allow cross-origin requests
18-
@CrossOrigin
1917
class FormController {
2018

2119
private val webClient = WebClient.builder()

0 commit comments

Comments
 (0)