3. What’s New in Spring Security 5.1

Spring Security 5.1 provides a number of new features. Below are the highlights of the release.

3.1 New Features

  • Chapter 11, Testing Method Security

    • Support for customizing when the SecurityContext is setup in the test For example, @WithMockUser(setupBefore = TestExecutionEvent.TEST_EXECUTION) will setup a user after JUnit’s @Before and before the test executes.
    • @WithUserDetails now works with ReactiveUserDetailsService
  • Section 10.4, “Jackson Support” - added support for BadCredentialsException
  • Section 39.3, “@AuthenticationPrincipal”

    • Supports resolving beans in WebFlux (was already supported in Spring MVC)
    • Supports resolving errorOnInvalidType in WebFlux (was already supported in Spring MVC)