Skip to content

Remove deprecated setIgnoreDefaultModelOnRedirect#3868

Merged
strehle merged 8 commits intocloudfoundry:developfrom
gdgenchev:remove-deprecated-ignore-default-model
May 8, 2026
Merged

Remove deprecated setIgnoreDefaultModelOnRedirect#3868
strehle merged 8 commits intocloudfoundry:developfrom
gdgenchev:remove-deprecated-ignore-default-model

Conversation

@gdgenchev
Copy link
Copy Markdown
Contributor

@gdgenchev gdgenchev commented Apr 23, 2026

This method was deprecated in Spring Framework 6.x without replacement. The default model is now always ignored on redirect. The method was removed in Spring Framework 7.x.

This requires changes to some controllers where model.addAttribute() was used that now won't be delegated. We need to use redirectAttributes.addAttribute()

https://github.com/spring-projects/spring-framework/blob/cf727bd7c80881864a941933fa6fb890b37de470/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java#L488-L503

This method was removed in Spring Framework 6.0 without replacement.
The default model is now always ignored on redirect.

This requires changes to some controllers where model.addAttribute() was used that now won't be delegated. We need to use redirectAttributes.addAttribute().
@gdgenchev gdgenchev force-pushed the remove-deprecated-ignore-default-model branch from 2a19b9e to 09e513e Compare April 23, 2026 21:49
@gdgenchev gdgenchev changed the title Remove deprecated setIgnoreDefaultModelOnRedirect call and adapt problematic redirects Remove deprecated RequestMappingHandlerAdapter.setIgnoreDefaultModelOnRedirect and adapt redirects Apr 23, 2026
@gdgenchev gdgenchev changed the title Remove deprecated RequestMappingHandlerAdapter.setIgnoreDefaultModelOnRedirect and adapt redirects Remove deprecated setIgnoreDefaultModelOnRedirect Apr 23, 2026
@duanemay duanemay requested a review from Copilot April 28, 2026 21:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Removes usage of Spring MVC’s deprecated setIgnoreDefaultModelOnRedirect(false) and updates redirect flows to explicitly use RedirectAttributes so request parameters reliably propagate on redirects under Spring Framework 7.x behavior.

Changes:

  • Removed RequestMappingHandlerAdapter#setIgnoreDefaultModelOnRedirect(false) initialization from app and multiple MVC test configurations.
  • Updated LoginInfoEndpoint#discoverIdentityProvider to use RedirectAttributes for redirect parameters (email/username/login_hint/discoveryPerformed).
  • Updated InvitationsController error redirect path to use RedirectAttributes for redirect parameters.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
server/src/test/java/org/cloudfoundry/identity/uaa/login/ResetPasswordControllerViewZonePathTests.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/ResetPasswordControllerTest.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/ProfileControllerMockMvcZonePathTests.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/ProfileControllerMockMvcTests.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/LoginInfoEndpointTests.java Updates tests to pass RedirectAttributes for discovery redirects.
server/src/test/java/org/cloudfoundry/identity/uaa/login/HomeControllerViewZonePathTests.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/HomeControllerViewTests.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/ChangeEmailControllerTest.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/login/AccountsControllerTest.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/invitations/InvitationsControllerZonePathTest.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/invitations/InvitationsControllerTest.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/account/ChangePasswordControllerViewZonePathTests.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/account/ChangeEmailControllerViewZonePathTests.java Removes test-only configuration that changed redirect model behavior.
server/src/test/java/org/cloudfoundry/identity/uaa/account/AccountsControllerViewZonePathTests.java Removes test-only configuration that changed redirect model behavior.
server/src/main/java/org/cloudfoundry/identity/uaa/web/WebConfig.java Removes application-level setIgnoreDefaultModelOnRedirect(false) configuration.
server/src/main/java/org/cloudfoundry/identity/uaa/login/LoginInfoEndpoint.java Uses RedirectAttributes to carry redirect parameters explicitly.
server/src/main/java/org/cloudfoundry/identity/uaa/invitations/InvitationsController.java Uses RedirectAttributes to carry redirect parameters on error reload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

this is used in other places. Maybe it is better all to be refactored to redirectAttributes, but let's not do this now.
@gdgenchev gdgenchev force-pushed the remove-deprecated-ignore-default-model branch from 5aaaaa6 to 3940385 Compare May 1, 2026 18:16
@strehle strehle requested a review from Copilot May 3, 2026 07:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

@fhanik
Copy link
Copy Markdown
Contributor

fhanik commented May 5, 2026

Review copilot feedback

gdgenchev added 2 commits May 6, 2026 22:24
- Remove unconditional loginHint Model population in discoverIdentityProvider
- Only add loginHint to Model when returning view (UAA password page)
- Keep RedirectAttributes for redirect query parameters
- Prevents unit tests from validating wrong mechanism since Spring 7+ ignores Model on redirects

Fixes issue where Model attributes were being set but ignored on redirect responses.
`discoverIdentityProviderCarriesLoginHintIfProvided` is already covered by `discoverIdentityProvider_addsAllRedirectAttributesOnFallthrough` that also verifies the other attributes
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Comment thread server/src/main/java/org/cloudfoundry/identity/uaa/login/LoginInfoEndpoint.java Outdated
gdgenchev added 3 commits May 6, 2026 23:57
`discoverIdentityProviderCarriesEmailIfProvided` is already covered by the combined test `discoverIdentityProvider_addsAllRedirectAttributesOnFallthrough`
Indeed, we are guaranteed to be in the UAA case, so we can remove it..
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

@strehle strehle requested a review from Copilot May 7, 2026 16:09
@strehle strehle requested review from duanemay and fhanik May 7, 2026 16:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

@strehle strehle merged commit 13688b2 into cloudfoundry:develop May 8, 2026
39 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants