-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Closed
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triagedtype: bugA general bugA general bug
Description
Describe the bug
After migrating to Spring Security 6 and replacing the deprecated authorizeRequests(...) method with authorizeHttpRequests(...), the hasIpAddress() method is no longer accessible, resulting in a compilation error.
To Reproduce
Steps to reproduce the behavior:
- Upgrade the Spring Security version to 6.x.
- Replace the usage of
authorizeRequests(...)withauthorizeHttpRequests(...)in the code. - Add a configuration that includes the
hasIpAddress()method withauthorizeHttpRequests(...). - Attempt to compile the code and observe the error.
Expected behavior
I expected to be able to use the hasIpAddress() method within the authorizeHttpRequests(...) configuration, without encountering any compilation errors.
Sample
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http
.csrf(csrf -> csrf.disable())
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/api/user/account/token/", "/api/user/account/register/").permitAll()
.requestMatchers("/pk/game/start/", "/pk/receive/bot/move/").hasIpAddress("127.0.0.1")
.requestMatchers(HttpMethod.OPTIONS).permitAll()
.anyRequest().authenticated()
)
.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
.build();
}Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triagedtype: bugA general bugA general bug