Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
/**
4
 * Licensed to Jasig under one or more contributor license
5
 * agreements. See the NOTICE file distributed with this work for
6
 * additional information regarding copyright ownership.
7
 *
8
 * Jasig licenses this file to you under the Apache License,
9
 * Version 2.0 (the "License"); you may not use this file except in
10
 * compliance with the License. You may obtain a copy of the License at:
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 *
20
 * PHP Version 7
21
 *
22
 * @file     CAS/ProxiedService/Http/Get.php
23
 * @category Authentication
24
 * @package  PhpCAS
25
 * @author   Adam Franco <afranco@middlebury.edu>
26
 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
27
 * @link     https://wiki.jasig.org/display/CASC/phpCAS
28
 */
29
 
30
/**
31
 * This class is used to make proxied service requests via the HTTP GET method.
32
 *
33
 * Usage Example:
34
 *
35
 *	try {
36
 *		$service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_GET);
37
 *		$service->setUrl('http://www.example.com/path/');
38
 *		$service->send();
39
 *		if ($service->getResponseStatusCode() == 200)
40
 *			return $service->getResponseBody();
41
 *		else
42
 *			// The service responded with an error code 404, 500, etc.
43
 *			throw new Exception('The service responded with an error.');
44
 *
45
 * 	} catch (CAS_ProxyTicketException $e) {
46
 *	    if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE)
47
 *			return "Your login has timed out. You need to log in again.";
48
 *		else
49
 *			// Other proxy ticket errors are from bad request format
50
 *          // (shouldn't happen) or CAS server failure (unlikely)
51
 *          // so lets just stop if we hit those.
52
 *			throw $e;
53
 *	} catch (CAS_ProxiedService_Exception $e) {
54
 *		// Something prevented the service request from being sent or received.
55
 *		// We didn't even get a valid error response (404, 500, etc), so this
56
 *		// might be caused by a network error or a DNS resolution failure.
57
 *		// We could handle it in some way, but for now we will just stop.
58
 *		throw $e;
59
 *	}
60
 *
61
 * @class    CAS_ProxiedService_Http_Get
62
 * @category Authentication
63
 * @package  PhpCAS
64
 * @author   Adam Franco <afranco@middlebury.edu>
65
 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
66
 * @link     https://wiki.jasig.org/display/CASC/phpCAS
67
 */
68
class CAS_ProxiedService_Http_Get
69
extends CAS_ProxiedService_Http_Abstract
70
{
71
 
72
    /**
73
     * Add any other parts of the request needed by concrete classes
74
     *
75
     * @param CAS_Request_RequestInterface $request request interface
76
     *
77
     * @return void
78
     */
79
    protected function populateRequest (CAS_Request_RequestInterface $request)
80
    {
81
        // do nothing, since the URL has already been sent and that is our
82
        // only data.
83
    }
84
}
85
?>