1、cas?php/* * Licensed to Jasig under one or more contributor license * agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. * * Jasig licenses this file to you under the Apache License, * Version 2.0 (the License); you may not use this
2、 file except in * compliance with the License. You may obtain a copy of the License at: * * http:/www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR COND
3、ITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * * Interface class of the phpCAS library * PHP Version 5 * * file CAS/CAS.php * category Authentication * package PhpCAS * author Pascal Aubry *
4、author Olivier Berger * author Brett Bieber * author Joachim Fritschi * author Adam Franco * license http:/www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * link https:/wiki.jasig.org/display/CASC/phpCAS * ingroup public */ hack by Vangelis Haniotakis to handle the absence of $_SERVERREQUEST_
5、URI/ in IIS/if (php_sapi_name() != cli) if (!isset($_SERVERREQUEST_URI) $_SERVERREQUEST_URI = $_SERVERSCRIPT_NAME . ? . $_SERVERQUERY_STRING; / Add a E_USER_DEPRECATED for php versions = 5.2if (!defined(E_USER_DEPRECATED) define(E_USER_DEPRECATED, E_USER_NOTICE);/ #/ CONSTANTS/ #/ -/ CAS VERSIONS/ -
6、/* * phpCAS version. accessible for the user by phpCAS:getVersion(). */define(PHPCAS_VERSION, 1.3.4);/* * addtogroup public * */* * CAS version 1.0 */define(CAS_VERSION_1_0, 1.0);/*! * CAS version 2.0*/define(CAS_VERSION_2_0, 2.0);/* * CAS version 3.0 */define(CAS_VERSION_3_0, 3.0);/ -/ SAML defines
7、/ -/* * SAML protocol */define(SAML_VERSION_1_1, S1);/* * XML header for SAML POST */define(SAML_XML_HEADER, );/* * SOAP envelope for SAML POST */define(SAML_SOAP_ENV, );/* * SOAP body for SAML POST */define(SAML_SOAP_BODY, );/* * SAMLP request */define(SAMLP_REQUEST, );define(SAMLP_REQUEST_CLOSE, )
8、;/* * SAMLP artifact tag (for the ticket) */define(SAML_ASSERTION_ARTIFACT, );/* * SAMLP close */define(SAML_ASSERTION_ARTIFACT_CLOSE, );/* * SOAP body close */define(SAML_SOAP_BODY_CLOSE, );/* * SOAP envelope close */define(SAML_SOAP_ENV_CLOSE, );/* * SAML Attributes */define(SAML_ATTRIBUTES, SAMLA
9、TTRIBS);/* * SAML Attributes */define(DEFAULT_ERROR, Internal script failure);/* */* * addtogroup publicPGTStorage * */ -/ FILE PGT STORAGE/ -/* * Default path used when storing PGTs to file */define(CAS_PGT_STORAGE_FILE_DEFAULT_PATH, session_save_path();/* */ -/ SERVICE ACCESS ERRORS/ -/* * addtogr
10、oup publicServices * */* * phpCAS:service() error code on success */define(PHPCAS_SERVICE_OK, 0);/* * phpCAS:service() error code when the PT could not retrieve because * the CAS server did not respond. */define(PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, 1);/* * phpCAS:service() error code when the PT co
11、uld not retrieve because * the response of the CAS server was ill-formed. */define(PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, 2);/* * phpCAS:service() error code when the PT could not retrieve because * the CAS server did not want to. */define(PHPCAS_SERVICE_PT_FAILURE, 3);/* * phpCAS:service() error co
12、de when the service was not available. */define(PHPCAS_SERVICE_NOT_AVAILABLE, 4);/ -/ SERVICE TYPES/ -/* * phpCAS:getProxiedService() type for HTTP GET */define(PHPCAS_PROXIED_SERVICE_HTTP_GET, CAS_ProxiedService_Http_Get);/* * phpCAS:getProxiedService() type for HTTP POST */define(PHPCAS_PROXIED_SE
13、RVICE_HTTP_POST, CAS_ProxiedService_Http_Post);/* * phpCAS:getProxiedService() type for IMAP */define(PHPCAS_PROXIED_SERVICE_IMAP, CAS_ProxiedService_Imap);/* */ -/ LANGUAGES/ -/* * addtogroup publicLang * */define(PHPCAS_LANG_ENGLISH, CAS_Languages_English);define(PHPCAS_LANG_FRENCH, CAS_Languages_
14、French);define(PHPCAS_LANG_GREEK, CAS_Languages_Greek);define(PHPCAS_LANG_GERMAN, CAS_Languages_German);define(PHPCAS_LANG_JAPANESE, CAS_Languages_Japanese);define(PHPCAS_LANG_SPANISH, CAS_Languages_Spanish);define(PHPCAS_LANG_CATALAN, CAS_Languages_Catalan);/* */* * addtogroup internalLang * */* *
15、phpCAS default language (when phpCAS:setLang() is not used) */define(PHPCAS_LANG_DEFAULT, PHPCAS_LANG_ENGLISH);/* */ -/ DEBUG/ -/* * addtogroup publicDebug * */* * The default directory for the debug file under Unix. */function gettmpdir() if (!empty($_ENVTMP) return realpath($_ENVTMP); if (!empty($
16、_ENVTMPDIR) return realpath( $_ENVTMPDIR); if (!empty($_ENVTEMP) return realpath( $_ENVTEMP); return /tmp;define(DEFAULT_DEBUG_DIR, gettmpdir()./);/* */ include the class autoloaderrequire_once dirname(_FILE_) . /CAS/Autoload.php;/* * The phpCAS class is a simple container for the phpCAS library. It
17、 provides CAS * authentication for web applications written in PHP. * * ingroup public * class phpCAS * category Authentication * package PhpCAS * author Pascal Aubry * author Olivier Berger * author Brett Bieber * author Joachim Fritschi * author Adam Franco * license http:/www.apache.org/licenses/
18、LICENSE-2.0 Apache License 2.0 * link https:/wiki.jasig.org/display/CASC/phpCAS */class phpCAS /* * This variable is used by the interface class phpCAS. * * var CAS_Client * hideinitializer */ private static $_PHPCAS_CLIENT; /* * This variable is used to store where the initializer is called from *
19、(to print a comprehensive error in case of multiple calls). * * hideinitializer */ private static $_PHPCAS_INIT_CALL; /* * This variable is used to store phpCAS debug mode. * * hideinitializer */ private static $_PHPCAS_DEBUG; /* * This variable is used to enable verbose mode * This pevents debug in
20、fo to be show to the user. Since its a security * feature the default is false * * hideinitializer */ private static $_PHPCAS_VERBOSE = false; / # / INITIALIZATION / # /* * addtogroup publicInit * */ /* * phpCAS client initializer. * * param string $server_version the version of the CAS server * par
21、am string $server_hostname the hostname of the CAS server * param string $server_port the port the CAS server is running on * param string $server_uri the URI the CAS server is responding on * param bool $changeSessionID Allow phpCAS to change the session_id (Single * Sign Out/handleLogoutRequests i
22、s based on that change) * * return a newly created CAS_Client object * note Only one of the phpCAS:client() and phpCAS:proxy functions should be * called, only once, and before all other methods (except phpCAS:getVersion() * and phpCAS:setDebug(). */ public static function client($server_version, $s
23、erver_hostname, $server_port, $server_uri, $changeSessionID = true ) phpCAS : traceBegin(); if (is_object(self:$_PHPCAS_CLIENT) phpCAS : error(self:$_PHPCAS_INIT_CALLmethod . () has already been called (at . self:$_PHPCAS_INIT_CALLfile . : . self:$_PHPCAS_INIT_CALLline . ); / store where the initializer is called from $dbg = debug_backtrace(); self:$_PHPCAS_INIT_CALL
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1