Bug 10029 - CAS authentication fails in OPAC reserve
authorFridolyn SOMERS <fridolyn.somers@biblibre.com>
Thu, 11 Apr 2013 14:46:23 +0000 (16:46 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 2 Jul 2013 14:13:05 +0000 (07:13 -0700)
If OPAC reserve page is accessed without being logged-in, login form is displayed as well as a CAS authentication link (if enabled). A click on this link will lead to CAS server but one comming back to Koha, page shows an error : "ERROR: No biblionumber received".
This is because CAS link only contains the query path "/cgi-bin/koha/opac-reserve.pl", not the query parameters.

This patch adds query parameters to URI sent to CAS.

Test plan :
- Enable CAS
- Go to opac without been logged-in
- Try to place hold on a record
=> You get to /cgi-bin/koha/opac-reserve.pl?biblionumber=XXX showing authentication page
=> Check that CAS link contains query param "biblionumber"
- Click on CAS link and log in
=> Check you return well logged-in to reserve page with biblionumber param

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I have followed the test plan as far as I could and the links
contain the biblionumber now, which they didn't before.
I couldn't check the CAS login, but my normal login worked
as expected.
All tests and the QA script pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Auth_with_cas.pm

index d8e5040..f841449 100644 (file)
@@ -91,10 +91,8 @@ sub login_cas {
 sub login_cas_url {
 
     my ($query, $key) = @_;
-    my $uri = C4::Context->preference('OPACBaseURL') . $query->script_name();
+    my $uri = C4::Context->preference('OPACBaseURL') . $query->url( -absolute => 1, -query => 1 );
     my $casparam = $query->param('cas');
-    # FIXME: This should be more generic and handle whatever parameters there might be
-    $uri .= "?cas=" . $casparam if (defined $casparam);
     $casparam = $defaultcasserver if (not defined $casparam);
     $casparam = $key if (defined $key);
     my $cas = Authen::CAS::Client->new($casservers->{$casparam});