invalid service error when passing parameters like returnto

Created on 1 March 2019, over 5 years ago
Updated 17 April 2024, 5 months ago

I have been getting the error invalid service when the request and ticket validation includes the returnto parameter in the service parameter.

like this
"http://local.sso.com/cas/login?service=http%3A//local.he.com/casservice%3Freturnto%3D/exclusives/changing-subsea-boosting-application-landscape-177304"

After digging on this issue for a bit I came up with a solution.
1. Before the service is validated the service parameter has all parameters removed from its url.
2. The serives parameters are stored in an array.
3. For login request the parameters are re-applied before the cas server returns to the cas powered website. This is not done for the ticket validation since that makes use of a different process.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cjokinen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia elc

    Changing branch for fork and begin merging into current HEAD.

  • Status changed to Needs review 8 months ago
  • πŸ‡¦πŸ‡ΊAustralia elc

    Thank you for your efforts. I ended up going a different path, with some future changes in mind in handling the service url query parameters.

    This is actually ready for review, but does include the contents of ✨ Restrict CAS log in to roles Needs review completely as the first commit - this obviously needs to be removed once that is merged first. My apologies for making this more difficult to review that it needs to be, but there are conflicting changes.

    As the method signature is changing for ConfigHelper::matchServiceAgainstConfig(), it now deprecated in favour of ConfigHelper::loadServiceFromUri(). This both parses the service url and stores the results for later use. It seems folly to be running regex on the same string multiple times on the same request.

    The service url is parsed using \Drupal\Component\Utility\UrlHelper::parse() to separate all of the parts. The path part is used for matching against the service entities, and the original url is used when redirected an authenticated user back to whence they came.

    Could you please confirm that this will work for your situation?

    • ELC β†’ committed 2d5c4d26 on 2.0.x
      Issue #3036892 by ELC, joshua.roberson, cjokinen: Improve service url...
  • Status changed to Fixed 6 months ago
  • πŸ‡¦πŸ‡ΊAustralia elc

    Tests included in patch. Ready for next release.

  • Issue was unassigned.
  • πŸ‡¦πŸ‡ΊAustralia elc

    De-assign.

    • ELC β†’ committed 2d5c4d26 on 2.1.x
      Issue #3036892 by ELC, joshua.roberson, cjokinen: Improve service url...
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024