Migrate to Spring Security 6.0

MSAL

Migrate applications to the latest Spring Security 6.0 release. This recipe will modify an application's build files, make changes to deprecated/preferred APIs, and migrate configuration settings that have changes between versions.

org.openrewrite.java.spring.security6.UpgradeSpringSecurity_6_0
mod run . --recipe=org.openrewrite.java.spring.security6.UpgradeSpringSecurity_6_0

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Migrate to Spring Security 5.8
  2. Upgrade Gradle or Maven dependency versions org.springframework.security:*:6.0.x
  3. Upgrade Gradle or Maven dependency versions org.springframework.security:spring-security-oauth2-authorization-server:1.0.x
  4. Remove explicit configuration of SHA-256 as encoding and matching algorithm for TokenBasedRememberMeServices
  5. Remove calls matching AuthenticationEntryPointFailureHandler.setRethrowAuthenticationServiceException(true)
  6. Remove explicit SecurityContextConfigurer.requireExplicitSave(true) opt-in
  7. Keep the Spring Security 5 RequestCache querying behavior
  8. Remove unnecessary use-authorization-manager for message security in Spring Security 6
  9. Remove the useAuthorizationManager=true attribute from @EnableReactiveMethodSecurity
  10. Remove unnecessary filterSecurityInterceptorOncePerRequest(false) when upgrading to Spring Security 6