3 # Copyright 2009 SARL BibLibre
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
22 # Here is an example of a simple phony webservice, returning "Hello World" if the user is authenticated
23 # The purpose is to show how CAS Proxy can work with koha
24 # In this configuration, this page acts as a CAS Client, instead of the user's browser.
25 # This page is meant to be called from a foreign application
32 The Proxy Ticket, needed for check_api_auth, that will try to make the CAS Server validate it.
40 binmode(STDOUT, ":encoding(UTF-8)");
42 use C4::Auth qw(check_api_auth);
49 print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8');
51 # The authentication : if $cgi contains a PT parameter, and CAS is enabled (casAuthentication syspref),
52 # a CAS Proxy authentication will take place
53 my ( $status, $cookie_, $sessionID ) = check_api_auth( $cgi, {circulate => 'override_renewals'});
55 if ($status ne 'ok') {
56 print "Authentication failed : $status";