Skip to content

Commit

Permalink
recaptcha filter
Browse files Browse the repository at this point in the history
  • Loading branch information
suayb committed Aug 29, 2023
1 parent e31d75a commit a3fd078
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class SecurityConfig {
.authenticationEntryPoint(securityExceptionResolver)
.accessDeniedHandler(securityExceptionResolver)
}
.addFilterBefore(XSSFilter(), SecurityWebFiltersOrder.AUTHENTICATION)
.addFilterAt(XSSFilter(), SecurityWebFiltersOrder.HTTP_HEADERS_WRITER)
.addFilterBefore(RecaptchaFilter(recaptchaService), SecurityWebFiltersOrder.AUTHENTICATION)
// @formatter:on
return http.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import io.github.susimsek.springgraphqlsamples.exception.InvalidCaptchaException
import io.github.susimsek.springgraphqlsamples.exception.RECAPTCHA_INVALID_MSG_CODE
import io.github.susimsek.springgraphqlsamples.graphql.RECAPTCHA_HEADER_NAME
import kotlinx.coroutines.reactor.awaitSingleOrNull
import org.springframework.boot.autoconfigure.security.SecurityProperties
import org.springframework.core.annotation.Order
import org.springframework.web.server.CoWebFilter
import org.springframework.web.server.CoWebFilterChain
import org.springframework.web.server.ServerWebExchange
Expand All @@ -16,7 +14,6 @@ import reactor.core.publisher.Mono



@Order(SecurityProperties.DEFAULT_FILTER_ORDER-1)
class RecaptchaFilter(
private val recaptchaService: RecaptchaService,
): CoWebFilter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.springframework.web.server.CoWebFilter
import org.springframework.web.server.CoWebFilterChain
import org.springframework.web.server.ServerWebExchange

@Order(SecurityProperties.DEFAULT_FILTER_ORDER-2)
class XSSFilter: CoWebFilter() {

override suspend fun filter(exchange: ServerWebExchange, chain: CoWebFilterChain) {
Expand Down

0 comments on commit a3fd078

Please sign in to comment.