Conversation
…g-security' into spring-7
Adds an encode2() method with a default implementation to call encode().
|
The two failing tests are related to the multi-factor authentication support that has been added to Spring Security v7. The change introduces the progressive authorization concept and notes that multi-factor authentication now returns an additional authority, I assume that one solution might be to remove any |
Refer to Spring documentation at: * https://docs.spring.io/spring-security/reference/api/java/org/springframework/security/core/authority/FactorGrantedAuthority.html * https://docs.spring.io/spring-security/reference/servlet/authentication/mfa.html#emfa * https://spring.io/blog/2025/10/21/multi-factor-authentication-in-spring-security-7#how-spring-security-models-mfa-through-progressive-authorization THis is a simple attempt to allow the creation of an incremental build that can be used for more testing with plugin BOM and the acceptance test harness.
|
I've removed the new FactorGrantedAuthority.PASSWORD_AUTHORITY entry from the list of authorities in the failing tests so that the build can proceed and be used for further testing with plugin BOM and the acceptance test harness. The addition of multi-factor authentication support in Spring Security v7 needs more evaluation, but that can be one step at a time with the help of the plugin BOM and the acceptance test harness. |
There was a problem hiding this comment.
Pull request overview
This PR updates Jenkins to use Spring Framework 7.0.5 and Spring Security 7.0.3, upgrading from version 6.x of both frameworks. The changes adapt to breaking changes in Spring Security 7, particularly where the BCryptPasswordEncoder.encode() method became final, preventing the previous approach of overriding it to provide custom error messages. The solution introduces an encode2() method in the internal PasswordHashEncoder interface that wraps the final encode() method, allowing custom error handling for password validation. Additionally, tests are updated to filter out the new PASSWORD_AUTHORITY that Spring Security 7 automatically adds to indicate password-based authentication factors.
Changes:
- Updated Spring Framework BOM from 6.2.16 to 7.0.5 and Spring Security BOM from 6.5.8 to 7.0.3
- Added
encode2()method to work aroundBCryptPasswordEncoder.encode()becoming final in Spring Security 7 - Updated authentication tests to filter out
PASSWORD_AUTHORITYautomatically added by Spring Security 7
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| bom/pom.xml | Updated Spring Framework and Spring Security dependency versions to 7.x |
| core/src/main/java/hudson/security/PasswordHashEncoder.java | Added encode2() default method to enable custom error handling despite encode() being final |
| core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | Updated JBCryptEncoder to override encode2() for custom error messages; updated validation paths to call encode2() |
| core/src/test/java/hudson/security/HudsonPrivateSecurityRealmTest.java | Updated existing tests to use encode2() and added test documenting encode() behavior |
| test/src/test/java/jenkins/security/LastGrantedAuthoritiesPropertyTest.java | Added filtering of PASSWORD_AUTHORITY in authority assertions |
| test/src/test/java/hudson/security/TokenBasedRememberMeServices2Test.java | Added filtering of PASSWORD_AUTHORITY in authority assertions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pull requests: * jenkinsci/jenkins#26346 * jenkinsci/jenkins#11304 * jenkinsci/jenkins#11292 Testing done * `PLUGINS=google-oauth-plugin,gitlab-oauth,github-oauth,oic-auth LINE=weekly TEST=InjectedTest bash ./local-test.sh`
Pull requests: * jenkinsci/jenkins#26346 * jenkinsci/jenkins#11304 * jenkinsci/jenkins#11292 * jenkinsci/bom#6392 Testing done * None. Rely on ci.jenkins.io for the testing
|
The Spring Framework Wiki describes supported versions as:
Since open source support for Spring Framework 6.2.x ends in June 2026, we should move to Spring Framework 7.x as soon as we can do it safely and confidently. |
|
I've summarized the choices for the release of Spring v7 support in Jenkins to the Jenkins developer mailing list. Discussions are probably best held there with the details included in that email message |
Test Spring v7 updates
Testing changes for pull requests:
Includes my attempt to adapt to the
encode()method becoming final when we extended it to provide a better error message.Testing done
Screenshots (UI changes only)
Before
After
Proposed changelog entries
Proposed changelog category
/label skip-changelog
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
N/A
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered.