mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-24 13:02:13 +00:00
SEC-2749: CsrfConfigurer.requireCsrfProtectionMatcher correct null check
This commit is contained in:
parent
c36cc88ac4
commit
db66843e0b
@ -97,7 +97,7 @@ public final class CsrfConfigurer<H extends HttpSecurityBuilder<H>> extends Abst
|
|||||||
* @return the {@link CsrfConfigurer} for further customizations
|
* @return the {@link CsrfConfigurer} for further customizations
|
||||||
*/
|
*/
|
||||||
public CsrfConfigurer<H> requireCsrfProtectionMatcher(RequestMatcher requireCsrfProtectionMatcher) {
|
public CsrfConfigurer<H> requireCsrfProtectionMatcher(RequestMatcher requireCsrfProtectionMatcher) {
|
||||||
Assert.notNull(csrfTokenRepository, "requireCsrfProtectionMatcher cannot be null");
|
Assert.notNull(requireCsrfProtectionMatcher, "requireCsrfProtectionMatcher cannot be null");
|
||||||
this.requireCsrfProtectionMatcher = requireCsrfProtectionMatcher;
|
this.requireCsrfProtectionMatcher = requireCsrfProtectionMatcher;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -464,6 +464,13 @@ class CsrfConfigurerTests extends BaseSpringSpec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def 'SEC-2749: requireCsrfProtectionMatcher null'() {
|
||||||
|
when:
|
||||||
|
new CsrfConfigurer<>().requireCsrfProtectionMatcher(null)
|
||||||
|
then:
|
||||||
|
thrown(IllegalArgumentException)
|
||||||
|
}
|
||||||
|
|
||||||
def clearCsrfToken() {
|
def clearCsrfToken() {
|
||||||
request.removeAllParameters()
|
request.removeAllParameters()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user