Open spring-projects-issues opened 10 years ago
Rob Winch said:
Thanks for the feedback abdull. I agree we need better documentation See SEC-2363 A few things that may help your points:
There are currently tests that document the mapping of the XML namespace to the Java Configuration equivalent. They start with Namespace and end in Tests. For example see https://github.com/spring-projects/spring-security/blob/3.2.1.RELEASE/config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/NamespaceRememberMeTests.groovy These mappings should be in the documentation, but in the mean time it should help to know that they exist
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:
<remember-me .../>
creates aRememberMeServices
bean automatically. JavaConfig configuration requires explicitRememberMeServices
andPersistentTokenRepository
beans creation besides additional configuration insideconfigure(HttpSecurity http)
withhttp.userDetailsService( userDetailsService() ).rememberMe().rememberMeServices( rememberMeServices() )
.RequestCache
bean. JavaConfig configuration requires explicitRequestCache
bean creation besides additional configuration insideconfigure(HttpSecurity http)
.WebSecurityConfigurerAdapter.configure(HttpSecurity http)
, I had to explicitly disable CSRF withhttp.csrf().disable()
.springSecurityFilterChain
bean 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.