You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
XML configuration with multiple security:http register multiple requestDataValueProcessorΒ #6423
We use multiple XML configuration for different realms. If CSRF is not disabled, the application startup fails beause of multiple registrations of requestDataValueProcessor bean.
Actual Behavior
see org.springframework.security.config.http.CsrfBeanDefinitionParser.parse()
boolean webmvcPresent = ClassUtils.isPresent(DISPATCHER_SERVLET_CLASS_NAME,
getClass().getClassLoader());
if (webmvcPresent) {
RootBeanDefinition beanDefinition = new RootBeanDefinition(
CsrfRequestDataValueProcessor.class);
BeanComponentDefinition componentDefinition = new BeanComponentDefinition(
beanDefinition, REQUEST_DATA_VALUE_PROCESSOR);
pc.registerBeanComponent(componentDefinition);
}
You are right that the CsrfBeanDefinitionParser should only register a new requestDataValueProcessor if it is not already found. Would you be interested in submitting a Pull Request?
You can work around this by providing the following setting spring.main.allow-bean-definition-overriding=true which is the default for non Spring Boot applications.
Activity
rwinch commentedon Jan 14, 2019
Thank you for the report. Can you please provide a minimal and complete sample to reproduce the problem?
mtraut commentedon Jan 15, 2019
Here you are....
rwinch commentedon Jan 16, 2019
You are right that the
CsrfBeanDefinitionParsershould only register a newrequestDataValueProcessorif it is not already found. Would you be interested in submitting a Pull Request?You can work around this by providing the following setting
spring.main.allow-bean-definition-overriding=truewhich is the default for non Spring Boot applications.ankurpathak commentedon Jan 17, 2019
Pull request for issue:
#6451
ankurpathak commentedon Jan 17, 2019
@rwinch @mtraut its working with sample.
mtraut commentedon Jan 17, 2019
thx for helping. I've never created a pull request before.
2 remaining items
Improve CsrfBeanDefinitionParser xml parsing
Improve CsrfBeanDefinitionParser xml parsing
Improve CsrfBeanDefinitionParser xml parsing
Improve CsrfBeanDefinitionParser xml parsing
Improve CsrfBeanDefinitionParser xml parsing
Fix CsrfBeanDefinitionParserTests Merge