ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
proxy.php
Go to the documentation of this file.
1 <?php
2 require 'tickets.php';
3 
4 /*
5  * Incoming parameters:
6  * targetService
7  * ptg
8  *
9  */
10 
11 if (array_key_exists('targetService', $_GET)) {
12  $targetService = $_GET['targetService'];
13  $pgt = $_GET['pgt'];
14 } else {
15  throw new Exception('Required URL query parameter [targetService] not provided. (CAS Server)');
16 }
17 
19 
20 $legal_service_urls = $casconfig->getValue('legal_service_urls');
21 
22 if (!checkServiceURL($targetService, $legal_service_urls))
23  throw new Exception('Service parameter provided to CAS server is not listed as a legal service: [service] = ' . $service);
24 
25 $path = $casconfig->resolvePath($casconfig->getValue('ticketcache', 'ticketcache'));
26 
27 $ticket = retrieveTicket($pgt, $path, false);
28 if ($ticket['validbefore'] > time()) {
29  $pt = str_replace( '_', 'PT-', SimpleSAML\Utils\Random::generateID() );
30  storeTicket($pt, $path, array(
31  'service' => $targetService,
32  'forceAuthn' => false,
33  'attributes' => $ticket['attributes'],
34  'proxies' => $ticket['proxies'],
35  'validbefore' => time() + 5)
36  );
37 
38 print <<<eox
39 <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
40  <cas:proxySuccess>
41  <cas:proxyTicket>$pt</cas:proxyTicket>
42  </cas:proxySuccess>
43 </cas:serviceResponse>
44 eox;
45 } else {
46 print <<<eox
47 <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
48  <cas:proxyFailure code="INVALID_REQUEST">
49  Proxygranting ticket to old - ssp casserver only supports shortlived (30 secs) pgts.
50  </cas:proxyFailure>
51 </cas:serviceResponse>
52 eox;
53 }
File written to
checkServiceURL($service, array $legal_service_urls)
Definition: tickets.php:36
$_GET["client_id"]
$service
Definition: login.php:15
retrieveTicket($ticket, $path, $unlink=true)
Definition: tickets.php:15
Attribute-related utility methods.
$casconfig
Definition: proxy.php:18
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
Create styles array
The data for the language used.
storeTicket($ticket, $path, $value)
Definition: tickets.php:3
$legal_service_urls
Definition: proxy.php:20
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.