spring-projects / spring-projects/spring-security
SEC-2496: Provide documentation explaining how to migrate from XML configuration to JavaConfig configuration
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Gerrit Hübbers (Migrated from SEC-2496) said:
I am in the process of migrating my application' usage of Spring Security's XML configuration to JavaConfig configuration.
From my experience, this migration is not trivial, and therefore the Spring Security documentation could have an additional section explaining how to migrate. Questions at StackOverflow seem to support my hypothesis that there is missing documentation.
In my particular case, issues I ran into during migration include:
- with XML configuration,
<remember-me .../>creates aRememberMeServicesbean automatically. JavaConfig configuration requires explicitRememberMeServicesandPersistentTokenRepositorybeans creation besides additional configuration insideconfigure(HttpSecurity http)withhttp.userDetailsService( userDetailsService() ).rememberMe().rememberMeServices( rememberMeServices() ). - XML configuration automatically creates a
RequestCachebean. JavaConfig configuration requires explicitRequestCachebean creation besides additional configuration insideconfigure(HttpSecurity http). - Out-of-the-box, the XML configuration did not require to consider CSRF-related aspects. Out-of-the-box, JavaConfig configuration does require to consider CSRF-related aspects - e.g., when migrating, in order to have my application to work as before, in
WebSecurityConfigurerAdapter.configure(HttpSecurity http), I had to explicitly disable CSRF withhttp.csrf().disable(). - The
springSecurityFilterChainbean seems to be created in both XML configuration and JavaConfig configuration.
For a documentation migration section, my idea is to provide a full-fledged XML configuration example, then show a 1:1 corresponding JavaConfig configuration.
Additionally, the documentation could contain subsection for each available Spring Security XML namespace element, and then show the corresponding required JavaConfig-based configuration.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing Spring Security documentation and the configuration entry points named in the issue, especially configure(HttpSecurity http) and WebSecurityConfigurerAdapter. Document an XML-to-JavaConfig migration covering remember-me, RequestCache, CSRF, and springSecurityFilterChain, then add mappings for the XML namespace elements. Done means the migration steps and corresponding configuration are clear and complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- documentation, security
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100