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 under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
22 # Here is an exemple 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
30 The Proxy Ticket, needed for check_api_auth, that will try to make the CAS Server validate it.
37 binmode(STDOUT, ":utf8");
39 use C4::Auth qw(check_api_auth);
46 print CGI::header('-type'=>'text/plain', '-charset'=>'utf-8');
48 # The authentication : if $cgi contains a PT parameter, and CAS is enabled (casAuthentication syspref),
49 # a CAS Proxy authentication will take place
50 my ( $status, $cookie_, $sessionID ) = check_api_auth( $cgi, {circulate => 'override_renewals'});
52 if ($status ne 'ok') {
53 print "Authentication failed : $status";