Skip to content

Commit be24b00

Browse files
committed
Debugging in prod, woo
Enable CORS at controller level Enable CSRF debug logging (just in case)
1 parent 1baf01b commit be24b00

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ class SecurityConfiguration {
3838
}.oauth2Client()
3939

4040

41-
// Useful for debugging CSRF
42-
if (environment.activeProfiles.contains("development")) {
43-
http.exceptionHandling().accessDeniedHandler { request, response, accessDeniedException ->
44-
println("Access denied. Cause: ${accessDeniedException.cause} | Message: ${accessDeniedException.message}")
45-
accessDeniedException.printStackTrace()
46-
}
41+
http.exceptionHandling().accessDeniedHandler { request, response, accessDeniedException ->
42+
println("Access denied. Cause: ${accessDeniedException.cause} | Message: ${accessDeniedException.message}")
43+
accessDeniedException.printStackTrace()
4744
}
4845

4946
return http.build()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ 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
1719
class FormController {
1820

1921
private val webClient = WebClient.builder()
@@ -26,8 +28,6 @@ class FormController {
2628
@PostMapping("/questions", consumes = [MediaType.MULTIPART_FORM_DATA_VALUE], headers = ["Host=api.osable.net"])
2729
// Method has a void return type, spring MVC tries to find a /questions page to redirect to without this annotation
2830
@ResponseStatus(HttpStatus.OK)
29-
// Allow cross-origin requests from ourselves
30-
@CrossOrigin(origins = ["https://osable.net"])
3131
fun questionsContactRoute(@ModelAttribute contactRequest: ContactRequest) {
3232
webClient.post()
3333
.uri(webhookURL)

0 commit comments

Comments
 (0)