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

(-)a/C4/Auth_with_cas.pm (-16 / +13 lines)
Lines 68-81 sub getMultipleAuth { Link Here
68
68
69
# Logout from CAS
69
# Logout from CAS
70
sub logout_cas {
70
sub logout_cas {
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
74
    my $logout_url = $cas->logout_url(url => $uri);
74
    # We don't want to keep triggering a logout, if we got here,
75
    $logout_url = _fix_logout_url($logout_url);
75
    # the borrower is already logged out of Koha
76
    print $query->redirect( $logout_url );
76
    $uri =~ s/\?logout\.x=1//;
77
78
    my $logout_url = $cas->logout_url( url => $uri );
79
    $logout_url =~ s/url=/service=/
80
      if C4::Context->preference('casServerVersion') eq '3';
81
82
    print $query->redirect($logout_url);
77
}
83
}
78
84
85
79
# Login to CAS
86
# Login to CAS
80
sub login_cas {
87
sub login_cas {
81
    my ($query, $type) = @_;
88
    my ($query, $type) = @_;
Lines 206-220 sub _get_cas_and_service { Link Here
206
    return ( $cas, $uri );
213
    return ( $cas, $uri );
207
}
214
}
208
215
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
218
# Get the current URL with parameters contained directly into URL (GET params)
216
# Get the current URL with parameters contained directly into URL (GET params)
219
# This method replaces $query->url() which will give both GET and POST params
217
# This method replaces $query->url() which will give both GET and POST params
220
sub _url_with_get_params {
218
sub _url_with_get_params {
221
- 

Return to bug 20854