View | Details | Raw Unified | Return to bug 20854
Collapse All | Expand All

(-)a/C4/Auth_with_cas.pm (-1 / +12 lines)
Lines 71-77 sub logout_cas { Link Here
71
    my ($query, $type) = @_;
71
    my ($query, $type) = @_;
72
    my ( $cas, $uri ) = _get_cas_and_service($query, undef, $type);
72
    my ( $cas, $uri ) = _get_cas_and_service($query, undef, $type);
73
    $uri =~ s/\?logout\.x=1//; # We don't want to keep triggering a logout, if we got here, the borrower is already logged out of Koha
73
    $uri =~ s/\?logout\.x=1//; # We don't want to keep triggering a logout, if we got here, the borrower is already logged out of Koha
74
    print $query->redirect( $cas->logout_url(url => $uri));
74
    my $logout_url = $cas->logout_url(url => $uri);
75
    $logout_url = _fix_logout_url($logout_url);
76
    print $query->redirect( $logout_url );
75
}
77
}
76
78
77
# Login to CAS
79
# Login to CAS
Lines 204-209 sub _get_cas_and_service { Link Here
204
    return ( $cas, $uri );
206
    return ( $cas, $uri );
205
}
207
}
206
208
209
# Fix the logout URL when the cas server is 3.0 or superior
210
sub _fix_logout_url {
211
    my $url = shift;
212
    if (C4::Context->preference('casServerVersion') eq '3') {
213
        $url =~ s/url=/service=/;
214
    }
215
    return $url;
216
}
217
207
# Get the current URL with parameters contained directly into URL (GET params)
218
# Get the current URL with parameters contained directly into URL (GET params)
208
# This method replaces $query->url() which will give both GET and POST params
219
# This method replaces $query->url() which will give both GET and POST params
209
sub _url_with_get_params {
220
sub _url_with_get_params {
(-)a/installer/data/mysql/atomicupdate/Bug_20854.perl (+8 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
4
    $dbh->do( "INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('casServerVersion', '2', '2|3', 'Version of the CAS server Koha will connect to.', 'Choice');");
5
6
    # Always end with this (adjust the bug info)
7
    NewVersion( $DBversion, 20854, "Adds a casServerVersion system preference");
8
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 120-125 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
120
('casAuthentication','0','','Enable or disable CAS authentication','YesNo'),
120
('casAuthentication','0','','Enable or disable CAS authentication','YesNo'),
121
('casLogout','0','','Does a logout from Koha should also log the user out of CAS?','YesNo'),
121
('casLogout','0','','Does a logout from Koha should also log the user out of CAS?','YesNo'),
122
('casServerUrl','https://localhost:8443/cas','','URL of the cas server','Free'),
122
('casServerUrl','https://localhost:8443/cas','','URL of the cas server','Free'),
123
('casServerVersion','2', '2|3','Version of the CAS server Koha will connect to.','Choice'),
123
('CatalogModuleRelink','0',NULL,'If OFF the linker will never replace the authids that are set in the cataloging module.','YesNo'),
124
('CatalogModuleRelink','0',NULL,'If OFF the linker will never replace the authids that are set in the cataloging module.','YesNo'),
124
('CataloguingLog','1',NULL,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.','YesNo'),
125
('CataloguingLog','1',NULL,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.','YesNo'),
125
('ChargeFinesOnClosedDays','0',NULL,'Charge fines on days the library is closed.','YesNo'),
126
('ChargeFinesOnClosedDays','0',NULL,'Charge fines on days the library is closed.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+6 lines)
Lines 148-153 Administration: Link Here
148
        -
148
        -
149
            - "URL of the CAS Authentication Server: "
149
            - "URL of the CAS Authentication Server: "
150
            - pref: casServerUrl
150
            - pref: casServerUrl
151
        -
152
            - pref: casServerVersion
153
              choices:
154
                2: 'CAS 2 or inferior'
155
                3: 'CAS 3 or superior'
156
            - Version of the CAS server Koha will connect to.
151
    SSL client certificate authentication:
157
    SSL client certificate authentication:
152
        -
158
        -
153
            - "Field to use for SSL client certificate authentication: "
159
            - "Field to use for SSL client certificate authentication: "
(-)a/t/db_dependent/Auth_with_cas.t (-2 / +7 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 4;
20
use Test::More tests => 5;
21
use CGI;
21
use CGI;
22
22
23
use t::lib::Mocks;
23
use t::lib::Mocks;
Lines 62-64 $ENV{SCRIPT_NAME} = '/cgi-bin/koha/circ/circulation-home.pl'; Link Here
62
is(C4::Auth_with_cas::_url_with_get_params($cgi, 'intranet'),
62
is(C4::Auth_with_cas::_url_with_get_params($cgi, 'intranet'),
63
    "$staff_base_url/cgi-bin/koha/circ/circulation-home.pl?bar=baz",
63
    "$staff_base_url/cgi-bin/koha/circ/circulation-home.pl?bar=baz",
64
   "Intranet URL should be returned when using intranet login (Bug 13507)");
64
   "Intranet URL should be returned when using intranet login (Bug 13507)");
65
- 
65
66
# logout parameter
67
t::lib::Mocks::mock_preference('casServerVersion','3');
68
is(C4::Auth_with_cas::_fix_logout_url('https://mycasserver.url/logout/?url=https://mykoha.url'),
69
    'https://mycasserver.url/logout/?service=https://mykoha.url',
70
    'service parameter should be used on logout when Cas server is 3.0 or superior (Bug 20854)');

Return to bug 20854