Closed (fixed)
Project:
SAML Authentication
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Nov 2017 at 19:57 UTC
Updated:
20 Apr 2019 at 20:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
partdigital commentedThis works for me and resolves the nasty Logic Exception. Rather than using return though is there a way we can continue to use destination?
Comment #3
heddnDifferent approach. It reverts some of the changes done in #2863340: Fix/unify usage of redirects. But I think that is a good thing. We don't want to get caught into an infinite loop inside of Drupal around redirects, and this is the easiest way to do that. No interdiff, because different approach.
Comment #4
damiankloip commentedComment #5
heddnThe alternative approach is seen in #2986046: Infinite redirect if you do not have access to the page.. The patch there around disabling RedirectResponseSubscriber is another way to address this for SAML. But it seems an overly complicated approach. And until recently, SAML was using the upstream library's redirect. There's nothing magic about a redirect. The only downside I see is that it makes things harder if you want to alter the URL. Which we probably didn't want anyway.
Comment #6
metzlerd commentedI have applied and tested this patch against current dev branch. Forgive me if RTBC is something reserved for maintainers here, but this works as designed and is a relatively small patch.
This appears to preserve the functionality of saml/login?desination=foo, which I think will be important if require_login module integration is desired.
Comment #8
roderikURLs!!! *shakes fist at sky*
I found and read https://www.lullabot.com/articles/early-rendering-a-lesson-in-debugging-... and the links from there, and I think I have a better handle on the issue around cacheability metadata/early rendering and URLs now. (#2863340: Fix/unify usage of redirects was my second attempt at it... and only half succeeded. It's unfortunate one apparently needs to know so many details, in order to create a simple URL string for an uncached redirect response.)
Also, it's... weird that I don't seem to have tested 'destination' redirects properly before committing #2863340.
So... two intermingled things:
1) The use of 'destination'. I agree we want to keep using 'destination', especially because it is somewhat reserved/special in Drupal. We want to implement the 'standard destination functionality'... with the twist that we have a few redirects in between.
2) The LogicException.
The one line that @johnjw59 points out / fixes is buggy, and this one-line change is the only thing needed to fix the exception.
The fix from @heddn also cancels out the unwanted redirect that happens because of the 'destination' parameter. Thanks for pointing to your alternative approach, that gave me more context.
It feels nicer to me, to keep returning a Response object to the controller, rather than let the PHP-Saml library issue a redirect response. Still, I don't want to introduce the kind of overhead in that alternative approach, just in order to keep doing that. So I almost implemented the @heddn patch...
...except I think we can fix the redirection more easily than that. Redirect happens because a 'destination' parameter is present in the original request. Can't we just remove that, then? See the commit I just pushed.
Comment #9
roderikFurther obsessing over code comments was done in https://cgit.drupalcode.org/samlauth/commit/?h=8.x-3.x&id=2c84a1383a90eb... (which is now 8.x-3.0-alpha1).
(Before fixing more stuff and working toward a stable version, I might spend some time suggesting some tiny DX improvements to Core surrounding Url::toString(). Because really...)
Comment #11
roderikJust for the record:
The 'tiny DX improvements' I spent some time on proposing, ended up being:
So... yeah...
After having read #2638686: Correctly handle cache data instead of throwing an Exception in EarlyRenderingControllerWrapperSubscriber() and #2450993-107: Rendered Cache Metadata created during the main controller request gets lost until 133 (and Wim Leers' answer on https://www.lullabot.com/articles/early-rendering-a-lesson-in-debugging-...) and analyzing some Drupal Core code...
I'm still considering doing that, but I'll hold off at least until there's movement until the Core issues.
(...and now to finally further clean up this module...)