Closed (fixed)
Project:
CAS
Version:
2.x-dev
Component:
CAS
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2020 at 21:37 UTC
Updated:
9 Sep 2026 at 20:06 UTC
Jump to comment: Most recent
There are some links, which contain "destination" parameter. It is not handled correctly, as result a user redirected to destination path, instead of login page on the cas server.
Steps to reproduce
0) Create content type with comments
1) Create a node
2) Open the node
3) Add a comment
4) Open the node
5) In the comment section click on the login link
So, all the links created with "destination" parameter will behave such way.
If I replace destination with returnto. It works as it should
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
lobsterr commentedComment #3
lobsterr commentedComment #4
lobsterr commentedI forgot to mention, that we replace the standard user.login path with cas.login path, but it doesn't change anything if we pass destination to cas.login it doesn't redirect us to login url.
Comment #5
bkosborneYea this is a known issue, that's why I added support for "returnto" as an alternate way to redirect users after login. But that doesn't work when other systems in Drupal generate links with the destination param in them.
I think we can actually fix this and deprecate the "returnto" parameter. I did a little proof of concept and all we should need to do is remove the "destination" parameter from the request object before our controllers return the redirect to the CAS server. That way core's RedirectResponseSubscriber won't see it and redirect users there instead. Though, not sure why I didn't go with that approach initially. Maybe there's a reason...
Comment #6
lobsterr commented@bkosborne, that what I am doing right. I redirect it first my controller, switch destination to returnto. Then I redirect it to cas module.
Yes, if it would be done on cas level. It will solve such cases
Comment #7
bkosborneChanging this to a feature request
Comment #8
claudiu.cristea@bkosborne, could you, please, share your PoC, mentioned in #5, as a MR so we can look into?
Comment #9
claudiu.cristeaMoving to 2.x
Comment #11
bkosborneMR opened. It's really just a one line addition to the force login controller. This would allow users to create links like /cas?destination=/some/path. I removed an unused test in the MR as well as cleaned up some comments.
Adding the line didn't break any tests, but I think it may need some new ones.
Comment #12
claudiu.cristeaThank you. I'll look into
Comment #13
WebbehComment #14
bkosborne^ thanks, not sure how I did that!
Comment #15
claudiu.cristeaAssigning to work on it.
Comment #16
claudiu.cristeaEverything seems in place. However, I'm waiting for the cas_mock_server update to be merged.
Comment #17
pfrenssenUpstream changes to cas_mock_server are merged! Thanks for working on this!
Comment #18
bkosborneI'll give this a review today. Thank you
Comment #19
claudiu.cristeaI see there are coding standards failures. My proposal is fix & enforce coding standards in #3231319: Enforce coding standards.
Comment #20
bkosborneI re-based this against 2.x after merging #3231319: Enforce coding standards and resolved one minor conflict, though I quickly realized that doing so may not be a best practice, as you now cannot easily do a git pull on your local. You have to fetch and then reset --hard to the origin branch, sorry about that. Maybe you would have preferred I simply merged in 2.x.
Setting to needs work for my comment above about PHP 7.1, but other than that this looks good.
Comment #21
claudiu.cristeaThat's a good point. Either we postpone or we add 7.1 in CAS composer.json. With the later, sites still on 7.0 should pin 2.0.0-beta2.
But what if we remove the strict typing of the param instead of making it nullable? I think we don't break BC.
Comment #22
claudiu.cristeaThe last commit is a tentative to support PHP 7.0.8
Comment #23
claudiu.cristeaComment #24
bkosborneLooks good to me. Good to merge in!
Comment #26
claudiu.cristeaFixing credits. Thank you all.
Comment #28
xem8vfdh commentedI am confused by this
I user to use "?returnto=/some/path" and it worked up until somehwat recently.
This module's documentation is confusing on the matter
Was "returnto" the old way and now we should use "destination"? does the value of the param need to be a full uri or just a drupal path? url encoded?
Comment #29
bkosborneSorry about that, I've corrected the outdated documentation.
You should be using the "destination" param now, not "returnto". The value should be a Drupal path, and I believe should be encoded as any other query string parameter would be.
Comment #30
xem8vfdh commentedthanks!