-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: spring 3.3.5 + configuration du firewall
- Loading branch information
1 parent
ba4eb6f
commit d867d39
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
shared/src/main/kotlin/com/egm/stellio/shared/config/FirewallConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.egm.stellio.shared.config | ||
|
||
import org.springframework.beans.BeansException | ||
import org.springframework.beans.factory.config.BeanPostProcessor | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.security.web.server.WebFilterChainProxy | ||
import org.springframework.security.web.server.firewall.StrictServerWebExchangeFirewall | ||
|
||
@Configuration | ||
class FirewallConfig { | ||
|
||
@Bean | ||
fun beanPostProcessor(): BeanPostProcessor { | ||
return object : BeanPostProcessor { | ||
@Throws(BeansException::class) | ||
override fun postProcessBeforeInitialization(bean: Any, beanName: String): Any { | ||
if (bean is WebFilterChainProxy) { | ||
val firewall = StrictServerWebExchangeFirewall() | ||
firewall.setAllowUrlEncodedSlash(true) | ||
firewall.setAllowUrlEncodedDoubleSlash(true) | ||
firewall.setAllowSemicolon(true) | ||
bean.setFirewall(firewall) | ||
} | ||
return bean | ||
} | ||
} | ||
} | ||
} |