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 61-82 BEGIN { Link Here
61
        import C4::External::BakerTaylor qw(&image_url &link_url);
61
        import C4::External::BakerTaylor qw(&image_url &link_url);
62
    }
62
    }
63
}
63
}
64
my $logout='';
64
65
# CAS Single Sign Out
65
my $cas_logout_required = C4::Context->preference('casAuthentication')
66
if (C4::Context->preference('casAuthentication')){
66
  and C4::Auth_with_ldap::logout_required($query);
67
    # Check we havent been hit by a logout call
68
    my $xml = $query->param('logoutRequest');
69
    if ($xml) {
70
        my $dom = XML::LibXML->load_xml(string => $xml);
71
        my $ticket;
72
        foreach my $node ($dom->findnodes('/samlp:LogoutRequest')){
73
            $ticket = $node->findvalue('./samlp:SessionIndex');
74
        }
75
        $query->param(-name =>'logout.x', -value => 1);
76
        $query->param(-name =>'cas_ticket', -value => $ticket);
77
        $logout=1;
78
    }
79
}
80
67
81
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
68
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
82
    {
69
    {
Lines 88-94 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
88
    }
75
    }
89
);
76
);
90
77
91
if ($logout){
78
if ($cas_logout_required){
92
    print $query->header;
79
    print $query->header;
93
    exit;
80
    exit;
94
}
81
}
95
- 

Return to bug 19160