Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 0300cf3

Browse files
committed
Initial commit
Original help queue
0 parents  commit 0300cf3

File tree

131 files changed

+27328
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+27328
-0
lines changed

CAS-1.3.4/CAS.php

+1,958
Large diffs are not rendered by default.
+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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/AuthenticationException.php
23+
* @category Authentication
24+
* @package PhpCAS
25+
* @author Joachim Fritschi <[email protected]>
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 interface defines methods that allow proxy-authenticated service handlers
32+
* to interact with phpCAS.
33+
*
34+
* Proxy service handlers must implement this interface as well as call
35+
* phpCAS::initializeProxiedService($this) at some point in their implementation.
36+
*
37+
* While not required, proxy-authenticated service handlers are encouraged to
38+
* implement the CAS_ProxiedService_Testable interface to facilitate unit testing.
39+
*
40+
* @class CAS_AuthenticationException
41+
* @category Authentication
42+
* @package PhpCAS
43+
* @author Joachim Fritschi <[email protected]>
44+
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
45+
* @link https://wiki.jasig.org/display/CASC/phpCAS
46+
*/
47+
48+
class CAS_AuthenticationException
49+
extends RuntimeException
50+
implements CAS_Exception
51+
{
52+
53+
/**
54+
* This method is used to print the HTML output when the user was not
55+
* authenticated.
56+
*
57+
* @param CAS_Client $client phpcas client
58+
* @param string $failure the failure that occured
59+
* @param string $cas_url the URL the CAS server was asked for
60+
* @param bool $no_response the response from the CAS server (other
61+
* parameters are ignored if TRUE)
62+
* @param bool $bad_response bad response from the CAS server ($err_code
63+
* and $err_msg ignored if TRUE)
64+
* @param string $cas_response the response of the CAS server
65+
* @param int $err_code the error code given by the CAS server
66+
* @param string $err_msg the error message given by the CAS server
67+
*/
68+
public function __construct($client,$failure,$cas_url,$no_response,
69+
$bad_response='',$cas_response='',$err_code='',$err_msg=''
70+
) {
71+
phpCAS::traceBegin();
72+
$lang = $client->getLangObj();
73+
$client->printHTMLHeader($lang->getAuthenticationFailed());
74+
printf(
75+
$lang->getYouWereNotAuthenticated(),
76+
htmlentities($client->getURL()),
77+
isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN']:''
78+
);
79+
phpCAS::trace('CAS URL: '.$cas_url);
80+
phpCAS::trace('Authentication failure: '.$failure);
81+
if ( $no_response ) {
82+
phpCAS::trace('Reason: no response from the CAS server');
83+
} else {
84+
if ( $bad_response ) {
85+
phpCAS::trace('Reason: bad response from the CAS server');
86+
} else {
87+
switch ($client->getServerVersion()) {
88+
case CAS_VERSION_1_0:
89+
phpCAS::trace('Reason: CAS error');
90+
break;
91+
case CAS_VERSION_2_0:
92+
case CAS_VERSION_3_0:
93+
if ( empty($err_code) ) {
94+
phpCAS::trace('Reason: no CAS error');
95+
} else {
96+
phpCAS::trace('Reason: ['.$err_code.'] CAS error: '.$err_msg);
97+
}
98+
break;
99+
}
100+
}
101+
phpCAS::trace('CAS response: '.$cas_response);
102+
}
103+
$client->printHTMLFooter();
104+
phpCAS::traceExit();
105+
}
106+
107+
}
108+
?>

CAS-1.3.4/CAS/Autoload.php

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
3+
/**
4+
* Autoloader Class
5+
*
6+
* PHP Version 5
7+
*
8+
* @file CAS/Autoload.php
9+
* @category Authentication
10+
* @package SimpleCAS
11+
* @author Brett Bieber <[email protected]>
12+
* @copyright 2008 Regents of the University of Nebraska
13+
* @license http://www1.unl.edu/wdn/wiki/Software_License BSD License
14+
* @link http://code.google.com/p/simplecas/
15+
**/
16+
17+
/**
18+
* Autoload a class
19+
*
20+
* @param string $class Classname to load
21+
*
22+
* @return bool
23+
*/
24+
function CAS_autoload($class)
25+
{
26+
// Static to hold the Include Path to CAS
27+
static $include_path;
28+
// Check only for CAS classes
29+
if (substr($class, 0, 4) !== 'CAS_') {
30+
return false;
31+
}
32+
// Setup the include path if it's not already set from a previous call
33+
if (empty($include_path)) {
34+
$include_path = array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) . '/../test/' );
35+
}
36+
37+
// Declare local variable to store the expected full path to the file
38+
39+
foreach ($include_path as $path) {
40+
$file_path = $path . '/' . str_replace('_', '/', $class) . '.php';
41+
$fp = @fopen($file_path, 'r', true);
42+
if ($fp) {
43+
fclose($fp);
44+
include $file_path;
45+
if (!class_exists($class, false) && !interface_exists($class, false)) {
46+
die(
47+
new Exception(
48+
'Class ' . $class . ' was not present in ' .
49+
$file_path .
50+
' [CAS_autoload]'
51+
)
52+
);
53+
}
54+
return true;
55+
}
56+
}
57+
$e = new Exception(
58+
'Class ' . $class . ' could not be loaded from ' .
59+
$file_path . ', file does not exist (Path="'
60+
. implode(':', $include_path) .'") [CAS_autoload]'
61+
);
62+
$trace = $e->getTrace();
63+
if (isset($trace[2]) && isset($trace[2]['function'])
64+
&& in_array($trace[2]['function'], array('class_exists', 'interface_exists'))
65+
) {
66+
return false;
67+
}
68+
if (isset($trace[1]) && isset($trace[1]['function'])
69+
&& in_array($trace[1]['function'], array('class_exists', 'interface_exists'))
70+
) {
71+
return false;
72+
}
73+
die ((string) $e);
74+
}
75+
76+
// set up __autoload
77+
if (function_exists('spl_autoload_register')) {
78+
if (!(spl_autoload_functions())
79+
|| !in_array('CAS_autoload', spl_autoload_functions())
80+
) {
81+
spl_autoload_register('CAS_autoload');
82+
if (function_exists('__autoload')
83+
&& !in_array('__autoload', spl_autoload_functions())
84+
) {
85+
// __autoload() was being used, but now would be ignored, add
86+
// it to the autoload stack
87+
spl_autoload_register('__autoload');
88+
}
89+
}
90+
} elseif (!function_exists('__autoload')) {
91+
92+
/**
93+
* Autoload a class
94+
*
95+
* @param string $class Class name
96+
*
97+
* @return bool
98+
*/
99+
function __autoload($class)
100+
{
101+
return CAS_autoload($class);
102+
}
103+
}
104+
105+
?>

0 commit comments

Comments
 (0)