fix: migrate WebSecurityConfig from deprecated WebSecurityConfigurerAdapter to SecurityFilterChain bean for Java 17#553
Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
Conversation
…dapter to SecurityFilterChain bean - Remove extends WebSecurityConfigurerAdapter (deprecated in Spring Security 5.7+) - Replace configure(HttpSecurity) override with @bean SecurityFilterChain method - Add http.build() return statement for the new bean-based approach - Import SecurityFilterChain instead of WebSecurityConfigurerAdapter This change prepares the api layer for Java 17 compatibility by removing usage of the deprecated WebSecurityConfigurerAdapter pattern in favor of the recommended component-based security configuration approach. Co-Authored-By: shayan <shayan@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates
WebSecurityConfigfrom the deprecatedWebSecurityConfigurerAdapterpattern to the newer component-basedSecurityFilterChainbean approach, as part of a Java 17 readiness review of theapilayer.Changes:
extends WebSecurityConfigurerAdapterfromWebSecurityConfigconfigure(HttpSecurity)override →@Bean SecurityFilterChain securityFilterChain(HttpSecurity)return http.build()to produce the filter chainWebSecurityConfigurerAdapter→SecurityFilterChainOther files reviewed (no changes needed):
All 18 files under
src/main/java/io/spring/api/were reviewed for:Subject.doAs(), illegal reflection access, Nashorn usage,SecurityManager, and removed JDK APIs. Thejavax.validationandjavax.servletimports are provided by third-party dependencies (Hibernate Validator, embedded Tomcat) — not the JDK — so they remain correct for Spring Boot 2.6.x on Java 17.Review & Testing Checklist for Human
SecurityFilterChainbean approach is compatible with the project's Spring Security 5.6.x (Spring Boot 2.6.3). The bean-based approach works in 5.6.x, butWebSecurityConfigurerAdapterwasn't formally deprecated until 5.7 — confirm this migration is desired now.jwtTokenFilter()directly insidesecurityFilterChain()still returns the Spring-managed singleton (both are@Beanmethods in the same@Configurationclass, so CGLIB proxying should handle this)../gradlew test) to verify no regressions in authentication/authorization behavior —compileJavapassed but tests were not executed in this session.Notes
spotlessCheckfails on master with anIllegalAccessErrorfromgoogle-java-formatunder Java 17 due to module encapsulation (jdk.compilerdoes not export internals). This is a pre-existing build config issue unrelated to this change.Link to Devin session: https://app.devin.ai/sessions/1dbb3d71e84342b79705f3640e06db06
Requested by: @shayanshafii