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

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 86-92 BEGIN { Link Here
86
        }
86
        }
87
    }
87
    }
88
    if ($cas) {
88
    if ($cas) {
89
        import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url);
89
        import C4::Auth_with_cas qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_required);
90
    }
90
    }
91
91
92
}
92
}
(-)a/C4/Auth_with_cas.pm (+17 lines)
Lines 228-233 sub _url_with_get_params { Link Here
228
    return $uri_base_part . $uri_params_part;
228
    return $uri_base_part . $uri_params_part;
229
}
229
}
230
230
231
sub logout_required {
232
    my ( $query ) = @_;
233
    # Check we havent been hit by a logout call
234
    my $xml = $query->param('logoutRequest');
235
    if ($xml) {
236
        my $dom = XML::LibXML->load_xml(string => $xml);
237
        my $ticket;
238
        foreach my $node ($dom->findnodes('/samlp:LogoutRequest')){
239
            $ticket = $node->findvalue('./samlp:SessionIndex');
240
        }
241
        $query->param(-name =>'logout.x', -value => 1);
242
        $query->param(-name =>'cas_ticket', -value => $ticket);
243
        return 1;
244
    }
245
    return 0;
246
}
247
231
1;
248
1;
232
__END__
249
__END__
233
250
(-)a/opac/opac-user.pl (-18 / +4 lines)
Lines 60-81 BEGIN { Link Here
60
        import C4::External::BakerTaylor qw(&image_url &link_url);
60
        import C4::External::BakerTaylor qw(&image_url &link_url);
61
    }
61
    }
62
}
62
}
63
my $logout='';
63
64
# CAS Single Sign Out
64
my $cas_logout_required = C4::Context->preference('casAuthentication')
65
if (C4::Context->preference('casAuthentication')){
65
  and C4::Auth_with_ldap::logout_required($query);
66
    # Check we havent been hit by a logout call
67
    my $xml = $query->param('logoutRequest');
68
    if ($xml) {
69
        my $dom = XML::LibXML->load_xml(string => $xml);
70
        my $ticket;
71
        foreach my $node ($dom->findnodes('/samlp:LogoutRequest')){
72
            $ticket = $node->findvalue('./samlp:SessionIndex');
73
        }
74
        $query->param(-name =>'logout.x', -value => 1);
75
        $query->param(-name =>'cas_ticket', -value => $ticket);
76
        $logout=1;
77
    }
78
}
79
66
80
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
67
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
81
    {
68
    {
Lines 87-93 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
87
    }
74
    }
88
);
75
);
89
76
90
if ($logout){
77
if ($cas_logout_required){
91
    print $query->header;
78
    print $query->header;
92
    exit;
79
    exit;
93
}
80
}
94
- 

Return to bug 19160