Skip to content

Add Implicit CorsConfigurationSource/PreFlightRequestHandler Detection to <cors> XML Namespace #19542

Description

@jzheaux

CorsConfigurer (the Java/lambda HttpSecurity.cors() DSL) auto-detects a
CorsConfigurationSource (via the mvcHandlerMappingIntrospector bean) or a
PreFlightRequestHandler bean when neither is configured explicitly (added
in #18926). The XML <cors> namespace element has no equivalent: without a
configuration-source-ref or ref attribute, CorsBeanDefinitionParser
throws a BeanCreationException.

Add a CorsFilterFactoryBean, used by CorsBeanDefinitionParser when
configuration-source-ref is omitted, that mirrors CorsConfigurer's
detection logic — so XML configuration has the same implicit-bean-detection
behavior as Java configuration.

Related to #18926.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: configAn issue in spring-security-configtype: enhancementA general enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions