Bug 19373

Summary: CAS login for staff interface always goes back to home
Product: Koha Reporter: Gwendal JONCOUR <gwendal.joncour>
Component: AuthenticationAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: dpavlin, jonathan.druart, katrin.fischer, m.de.rooy, matthias.meusburger
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16818
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 13507    
Bug Blocks:    
Attachments: Bug 19373: CAS logout - Redirect to the previous page (Intranet)
Bug 19373: Update tests
Bug 19373: Update tests
Bug 19373: CAS logout - Redirect to the previous page (Intranet)
Bug 19373: Update tests
Bug 19373: CAS logout - Redirect to the previous page (Intranet)

Description Gwendal JONCOUR 2017-09-27 14:13:49 UTC
When I'm disconnected from the staff interface for inactivity, I noticed that CAS login always go back to homepage while local login sends me to the correct page (for example a borrower page). 

When I checked the CAS login URL, I see that the service part is composed of the base url followed-up directly by the query part of the page. The script part is absent. Then, I checked C4/Auth_with_cas.pm and see in the sub _url_with_get_params that get_script_name() is only called for the OPAC login.

Is there a specific reason for that or can we call get_script_name() for both context ?
Comment 1 Jonathan Druart 2017-09-27 16:53:57 UTC
I guess it is an oversight, this behaviour exists since bug 13507.
Comment 2 Jonathan Druart 2017-09-27 16:58:45 UTC
Created attachment 67405 [details] [review]
Bug 19373: CAS logout - Redirect to the previous page (Intranet)
Comment 3 Jonathan Druart 2017-09-27 16:59:00 UTC
I have not tested this patch.
Comment 4 Gwendal JONCOUR 2017-10-10 14:49:06 UTC
Tested on our 16.11 preproduction version and it works pretty good.
Comment 5 Marcel de Rooy 2017-10-11 12:27:47 UTC
not ok 4 - Intranet URL should be returned when using intranet login (Bug 13507)
#   Failed test 'Intranet URL should be returned when using intranet login (Bug 13507)'
#   at t/db_dependent/Auth_with_cas.t line 62.
#          got: 'localhost:8080/cgi-bin/koha/opac-user.pl?bar=baz'
#     expected: 'localhost:8080?bar=baz'
Comment 6 Jonathan Druart 2017-10-11 15:15:38 UTC
Created attachment 67963 [details] [review]
Bug 19373: Update tests
Comment 7 Jonathan Druart 2017-10-11 15:16:34 UTC
Matts, could you take a look at these changes?
Comment 8 Matthias Meusburger 2017-10-13 14:06:24 UTC
I'm ok with this patch, and I successfully tested it on my local instance with BibLibre's CAS Test server.

I'm signing it off.
Comment 9 Matthias Meusburger 2017-10-13 14:11:26 UTC
Created attachment 68077 [details] [review]
Bug 19373: Update tests

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 10 Matthias Meusburger 2017-10-13 14:11:56 UTC
Created attachment 68078 [details] [review]
Bug 19373: CAS logout - Redirect to the previous page (Intranet)

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>
Comment 11 Marcel de Rooy 2017-10-16 06:54:44 UTC
Created attachment 68171 [details] [review]
Bug 19373: Update tests

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 12 Marcel de Rooy 2017-10-16 06:54:49 UTC
Created attachment 68172 [details] [review]
Bug 19373: CAS logout - Redirect to the previous page (Intranet)

Signed-off-by: Matthias Meusburger <matthias.meusburger@biblibre.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Jonathan Druart 2017-10-16 13:01:27 UTC
Pushed to master for 17.11, thanks to everybody involved!