Latest in branch 5.7
5.7.14
Released 18 Nov 2024
(1 year ago)
SoftwareSpring Security
Branch5.7
Supported
Java/Jakarta EE
Java 8+
Servlet 3.0+
Initial release5.7.0
16 May 2022
(4 years ago)
Latest release5.7.14
18 Nov 2024
(1 year ago)
End of
OSS support
30 Jun 2023
(Ended 2 years, 10 months ago)
End of
enterprise support
30 Jun 2029
(Ends in 3 years, 1 month)
Release noteshttps://github.com/spring-projects/spring-security/releases/tag/5.7.14
Source codehttps://github.com/spring-projects/spring-security/tree/5.7.14
Downloadhttps://github.com/spring-projects/spring-security/releases/tag/5.7.14
Spring Security 5.7 ReleasesView full list

What Is New in Spring Security 5.7

Category Highlights
New Features AuthorityAuthorizationManager optimization, reactive session cache option, auto-detect UserDetailsService for remember-me and X509, improved sample verification.
Bug Fixes @EnableMethodSecurity proxy handling, Kotlin DSL dispatcher type flag, AuthorizationManagerWebInvocationPrivilegeEvaluator servlet context, requestMatcher ordering fix.

Can @EnableMethodSecurity now secure methods declared on interfaces?

Yes - the proxy-based method security now correctly resolves security annotations placed on interface methods.

  • Prior to 5.7, annotations on an interface were ignored when the bean was proxied, leading to unsecured calls.
  • In practice, this means you can keep your service contracts clean (e.g., public interface OrderService { @PreAuthorize("hasRole('ADMIN')") void cancel(Long id); }) without adding duplicate annotations on the implementation.
  • Migration tip: no code change is required; just upgrade and run your existing tests to confirm the security checks fire.

How does Spring Security 5.7 improve reactive session handling?

Spring Security 5.7 adds a Mono.cache option to WebSessionServerSecurityContextRepository for efficient reuse of the security context.

@Bean
public ServerSecurityContextRepository securityContextRepository() {
    return new WebSessionServerSecurityContextRepository()
            .setCacheMono(true); // enables Mono.cache()
}
  • This reduces repeated lookups of the security context during a single request lifecycle.
  • Most teams will see lower latency in high-throughput WebFlux applications.
  • Watch out for memory pressure if you enable caching for long-lived sessions; configure a reasonable timeout.

What enhancements were made to remember-me and X509 authentication?

Both mechanisms now automatically detect a UserDetailsService bean, removing the need for explicit configuration.

  • Previously you had to wire RememberMeServices or X509AuthenticationProvider with a reference to your UserDetailsService.
  • In production this simplifies security configuration files and reduces boilerplate.
  • Example (remember-me): http.rememberMe() will now pick up the existing UserDetailsService bean automatically.

How was AuthorityAuthorizationManager optimized for large authority sets?

AuthorityAuthorizationManager now uses a Set<String> of authority strings instead of iterating an inner loop.

  • This change dramatically improves performance when evaluating permissions against users with many roles.
  • In practice, you'll notice faster authorization decisions in micro-service environments where JWTs contain dozens of scopes.
  • No API change; existing code that calls .hasAuthority(...) continues to work.

Why do multiple .requestMatchers().mvcMatchers() no longer override each other?

Spring Security 5.7 fixes the matcher ordering bug so that each matcher is evaluated in the order it is declared.

http
    .authorizeHttpRequests(authorize -> authorize
        .requestMatchers("/admin/**").hasRole("ADMIN")
        .mvcMatchers("/admin/reports/**").hasAuthority("REPORT_VIEW")
        .anyRequest().authenticated());
  • Before this release, the later mvcMatchers could unintentionally replace earlier requestMatchers, causing security gaps.
  • Now you can safely combine different matcher types without worrying about hidden overrides.
  • Most teams will only need to run their integration tests to verify the intended access rules.

Frequently Asked Questions

Does Spring Security 5.7 automatically wire a UserDetailsService for remember-me?
Yes, the remember-me configuration now detects any UserDetailsService bean in the context without extra setup.

Can @EnableMethodSecurity secure methods defined on interfaces?
Yes, after upgrading to 5.7 the proxy will honor security annotations placed on interface methods.

How do I enable caching for WebSessionServerSecurityContextRepository?
Call setCacheMono(true) on the repository bean, for example: new WebSessionServerSecurityContextRepository().setCacheMono(true).

Is there a new way to configure authority checks with AuthorityAuthorizationManager?
The API remains the same but the internal Set optimization makes checks faster for large role collections.

What should I do about the requestMatcher ordering issue in Spring Security 5.7?
Review your security config to ensure matchers are declared in the desired order; the bug fix now respects that order.

Releases In Branch 5.7

VersionRelease date
5.7.1418 Nov 2024
(1 year ago)
5.7.1321 Oct 2024
(1 year ago)
5.7.1218 Mar 2024
(2 years ago)
5.7.1118 Sep 2023
(2 years ago)
5.7.1017 Jul 2023
(2 years ago)
5.7.919 Jun 2023
(2 years ago)
5.7.817 Apr 2023
(3 years ago)
5.7.721 Feb 2023
(3 years ago)
5.7.619 Dec 2022
(3 years ago)
5.7.531 Oct 2022
(3 years ago)
5.7.417 Oct 2022
(3 years ago)
5.7.315 Aug 2022
(3 years ago)
5.7.220 Jun 2022
(3 years ago)
5.7.118 May 2022
(4 years ago)
5.7.016 May 2022
(4 years ago)
5.7.0-RC118 Apr 2022
(4 years ago)
5.7.0-M321 Mar 2022
(4 years ago)
5.7.0-M221 Feb 2022
(4 years ago)
5.7.0-M114 Jan 2022
(4 years ago)