Upgrade phpCAS
[piwik-CASLogin.git] / CAS / CAS / ProxiedService / Http / Get.php
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 5
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 (shouldn't happen)
50  *                                      // or CAS server failure (unlikely) so lets just stop if we hit those.
51  *                                      throw $e;
52  *                      } catch (CAS_ProxiedService_Exception $e) {
53  *                              // Something prevented the service request from being sent or received.
54  *                              // We didn't even get a valid error response (404, 500, etc), so this
55  *                              // might be caused by a network error or a DNS resolution failure.
56  *                              // We could handle it in some way, but for now we will just stop.
57  *                              throw $e;
58  *                      }
59  *
60  * @class    CAS_ProxiedService_Http_Get
61  * @category Authentication
62  * @package  PhpCAS
63  * @author   Adam Franco <afranco@middlebury.edu>
64  * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
65  * @link     https://wiki.jasig.org/display/CASC/phpCAS
66  */
67 class CAS_ProxiedService_Http_Get
68 extends CAS_ProxiedService_Http_Abstract
69 {
70
71     /**
72      * Add any other parts of the request needed by concrete classes
73      *
74      * @param CAS_Request_RequestInterface $request request interface
75      *
76      * @return void
77      */
78     protected function populateRequest (CAS_Request_RequestInterface $request)
79     {
80         // do nothing, since the URL has already been sent and that is our
81         // only data.
82     }
83 }
84 ?>