当前位置: 首页>>代码示例>>PHP>>正文


PHP phpCAS::handleLogoutRequests方法代码示例

本文整理汇总了PHP中phpCAS::handleLogoutRequests方法的典型用法代码示例。如果您正苦于以下问题:PHP phpCAS::handleLogoutRequests方法的具体用法?PHP phpCAS::handleLogoutRequests怎么用?PHP phpCAS::handleLogoutRequests使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpCAS的用法示例。


在下文中一共展示了phpCAS::handleLogoutRequests方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare

 private function prepare()
 {
     \phpCAS::client(CAS_VERSION_2_0, $this->casUrl, $this->casPort, $this->casUri, false);
     //\phpCAS::setDebug('/tmp/cas.log');
     \phpCAS::setNoCasServerValidation();
     //\phpCAS::setSingleSignoutCallback(array($this, 'casSingleSignOut'));
     //\phpCAS::setPostAuthenticateCallback(array($this, 'casPostAuth'));
     \phpCAS::handleLogoutRequests(true, $this->casAllowedIpClients);
 }
开发者ID:bmartinezteltek,项目名称:PuMuKIT2,代码行数:9,代码来源:CASService.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     $this->load->database();
     $this->load->library('grocery_CRUD');
     include_once 'CAS.php';
     phpCAS::client('2.0', 'cas.uhp-nancy.fr', 443, '/cas', false);
     phpCAS::setNoCasServerValidation();
     phpCAS::handleLogoutRequests(false);
 }
开发者ID:rjachnie,项目名称:DHCPI,代码行数:10,代码来源:main.php

示例3: check_auth

function check_auth()
{
    if (!isset($GLOBALS['PHPCAS_CLIENT'])) {
        phpCAS::client(CAS_VERSION_2_0, 'cas.byu.edu', 443, 'cas');
        //phpCAS::setCasServerCACert("../CAS/cas_ca.pem");
        phpCAS::setNoCasServerValidation();
        phpCAS::setDebug("cas_error.txt");
        phpCAS::handleLogoutRequests(true, array('cas.byu.edu', 'cas1.byu.edu', 'cas2.byu.edu', 'cas3.byu.edu'));
    }
    return phpCAS::isAuthenticated();
}
开发者ID:niclush2009,项目名称:DBLS,代码行数:11,代码来源:core_functions.php

示例4: init

 public static function init()
 {
     if (self::$_init) {
         return true;
     }
     $config = new \Yaf\Config\Ini(APPLICATION_CONFIG_PATH . '/phpcas.ini', \Yaf\ENVIRON);
     phpCAS::setDebug('');
     phpCAS::client($config->cas_version, $config->cas_host, intval($config->cas_port), $config->cas_context);
     phpCAS::setNoCasServerValidation();
     phpCAS::handleLogoutRequests(false);
     self::$_init = true;
     return true;
 }
开发者ID:JohnnyChenS,项目名称:mock-server,代码行数:13,代码来源:Phpcas.php

示例5: setCASSettings

 private function setCASSettings()
 {
     if ($this->options->IsCasDebugOn()) {
         phpCAS::setDebug($this->options->DebugFile());
     }
     phpCAS::client($this->options->CasVersion(), $this->options->HostName(), $this->options->Port(), $this->options->ServerUri(), $this->options->ChangeSessionId());
     if ($this->options->CasHandlesLogouts()) {
         phpCAS::handleLogoutRequests(true, $this->options->LogoutServers());
     }
     if ($this->options->HasCertificate()) {
         phpCAS::setCasServerCACert($this->options->Certificate());
     }
     phpCAS::setNoCasServerValidation();
 }
开发者ID:hugutux,项目名称:booked,代码行数:14,代码来源:CAS.php

示例6: handle

 function handle($args)
 {
     parent::handle($args);
     if (common_is_real_login()) {
         // TRANS: Client error displayed when trying to log in while already logged on.
         $this->clientError(_m('Already logged in.'));
     } else {
         global $casSettings;
         phpCAS::client(CAS_VERSION_2_0, $casSettings['server'], $casSettings['port'], $casSettings['path'], false);
         phpCAS::setNoCasServerValidation();
         phpCAS::handleLogoutRequests();
         phpCAS::forceAuthentication();
         global $casTempPassword;
         $casTempPassword = common_good_rand(16);
         $user = common_check_user(phpCAS::getUser(), $casTempPassword);
         if (!$user) {
             // TRANS: Server error displayed when trying to log in with incorrect username or password.
             $this->serverError(_m('Incorrect username or password.'));
             return;
         }
         // success!
         if (!common_set_user($user)) {
             // TRANS: Server error displayed when login fails in CAS authentication plugin.
             $this->serverError(_m('Error setting user. You are probably not authorized.'));
             return;
         }
         common_real_login(true);
         $url = common_get_returnto();
         if ($url) {
             // We don't have to return to it again
             common_set_returnto(null);
         } else {
             if (common_config('site', 'private') && $casSettings['takeOverLogin']) {
                 //SSO users expect to just go to the URL they entered
                 //if we don't have a returnto set, the user entered the
                 //main StatusNet url, so send them there.
                 $url = common_local_url('public');
             } else {
                 //With normal logins (regular form-based username/password),
                 //the user would expect to go to their home after logging in.
                 $url = common_local_url('public', array('nickname' => $user->nickname));
             }
         }
         common_redirect($url, 303);
     }
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:46,代码来源:caslogin.php

示例7: FilterApplicationConfig

 public function FilterApplicationConfig(&$oConfig)
 {
     $sCasHost = \trim($this->Config()->Get('plugin', 'cas_server_host', ''));
     $iCasPort = $this->Config()->Get('plugin', 'cas_server_port', 8443);
     phpCAS::setDebug('/tmp/phpCAS-rl.log');
     // Schrijft debug informatie naar een log-file
     // Parameters: CAS version, CAS server url, CAS server port, CAS server URI (same as host),
     // boolean indicating session start, communication protocol (SAML) between application and CAS server
     phpCAS::client(CAS_VERSION_3_0, $sCasHost, $iCasPort, '', true, 'saml');
     // Server from which logout requests are sent
     // phpCAS::handleLogoutRequests(true, array('cas1.ugent.be','cas2.ugent.be','cas3.ugent.be','cas4.ugent.be','cas5.ugent.be','cas6.ugent.be'));
     phpCAS::handleLogoutRequests(true, array('http://localhost:8080/php_cas_login/home.html'));
     // Path to the "trusted certificate authorities" file:
     // phpCAS::setCasServerCACert('/etc/ssl/certs/ca-certificates.crt');
     // No server verification (less safe!):
     phpCAS::setNoCasServerValidation();
     // The actual user authentication
     phpCAS::forceAuthentication();
     $this->oAccountManagementProvider = $this->AccountManagementProvider($oConfig);
 }
开发者ID:Elico-Corp,项目名称:rainloop-webmail,代码行数:20,代码来源:index.php

示例8: sso

 public static function sso($action = 'login')
 {
     include_once ROOT_PATH . 'lib/cas/CAS.php';
     include_once ROOT_PATH . 'config/cas.php';
     $client = '';
     // error_reporting(E_ALL);
     // ini_set("display_errors", 1);
     $cas_host = CAS_HOST;
     $cas_port = intval(CAS_PORT);
     $cas_context = CAS_CONTEXT;
     $phpCAS = new \phpCAS();
     // $phpCAS->setDebug();
     $phpCAS->client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);
     $phpCAS->setNoCasServerValidation();
     $phpCAS->handleLogoutRequests();
     $phpCAS->forceAuthentication();
     if (isset($action) && $action == 'logout') {
         $phpCAS->logout();
     }
     $client = $phpCAS->getAttributes();
     return $client;
 }
开发者ID:hellocc2,项目名称:crmht,代码行数:22,代码来源:CheckLogin.php

示例9: authenticate_cas

	function authenticate_cas() {
		include_once('CAS.php');
		if ($GLOBALS['mode_debug']) {
		    phpCAS::setDebug($GLOBALS['debug_log_file']);
                }
		// config_cas.inc.php est le fichier d'informations de connexions au serveur cas
		$path = dirname(__FILE__)."/../secure/config_cas.inc.php";
		include($path);

		// Le premier argument est la version du protocole CAS
		phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_root, true);
		phpCAS::setLang('french');

		// redirige vers le serveur d'authentification si aucun utilisateur authentifié n'a
		// été trouvé par le client CAS.
		phpCAS::setNoCasServerValidation();
		
		// Gestion du single sign-out
		phpCAS::handleLogoutRequests(false);
		
		// Authentification
		phpCAS::forceAuthentication();

		$this->login = phpCAS::getUser();

		// On réinitialise la session
		session_name("GEPI");
		session_start();
		$_SESSION['login'] = $this->login;

		$this->current_auth_mode = "sso";

		return true;
	}
开发者ID:rhertzog,项目名称:lcs,代码行数:34,代码来源:Session.php4.class.php

示例10: __construct


//.........这里部分代码省略.........
         $this->casuserfile = DOKU_CONF . 'users.auth.plaincas.php';
     }
     $this->localuserfile = $config_cascade['plainauth.users']['default'];
     // check the state of the file with the users and attempt to create it.
     if (!@is_readable($this->casuserfile)) {
         if (!fopen($this->casuserfile, 'w')) {
             msg("plainCAS: The CAS users file could not be opened.", -1);
             $this->success = false;
         } elseif (!@is_readable($this->casuserfile)) {
             $this->success = false;
         } else {
             $this->success = true;
         }
         // die( "bitch!" );
     }
     if ($this->success) {
         // the users are not managable through the wiki
         $this->cando['addUser'] = false;
         $this->cando['delUser'] = true;
         $this->cando['modLogin'] = false;
         //keep this false as CAS name is constant
         $this->cando['modPass'] = false;
         $this->cando['modName'] = false;
         $this->cando['modMail'] = false;
         $this->cando['modGroups'] = false;
         $this->cando['getUsers'] = true;
         $this->cando['getUserCount'] = true;
         $this->cando['external'] = preg_match("#(bot)|(slurp)|(netvibes)#i", $_SERVER['HTTP_USER_AGENT']) ? false : true;
         //Disable CAS redirection for bots/crawlers/readers
         $this->cando['login'] = true;
         $this->cando['logout'] = true;
         $this->cando['logoff'] = true;
         // The default options which need to be set in the settins file.
         $defaults = array('logFile' => NULL, 'cert' => NULL, 'cacert' => NULL, 'debug' => false, 'settings_file' => DOKU_CONF . 'plaincas.settings.php', 'defaultgroup' => $conf['defaultgroup'], 'superuser' => $conf['superuser']);
         $this->_options = (array) $conf['plugin']['authplaincas'] + $defaults;
         // Options are set in the configuration and have a proper default value there.
         $this->_options['server'] = $this->getConf('server');
         $this->_options['rootcas'] = $this->getConf('rootcas');
         $this->_options['port'] = $this->getConf('port');
         $this->_options['samlValidate'] = $this->getConf('samlValidate');
         $this->_options['autologin'] = $this->getConf('autologinout');
         // $this->getConf('autologin');
         $this->_options['caslogout'] = $this->getConf('autologinout');
         // $this->getConf('caslogout');
         $this->_options['handlelogoutrequest'] = $this->getConf('handlelogoutrequest');
         $this->_options['handlelogoutrequestTrustedHosts'] = $this->getConf('handlelogoutrequestTrustedHosts');
         $this->_options['minimalgroups'] = $this->getConf('minimalgroups');
         $this->_options['localusers'] = $this->getConf('localusers');
         // $this->_options['defaultgroup'] = $this->getConf('defaultgroup');
         // $this->_options['superuser'] = $this->getConf('superuser');
         // no local users at the moment
         $this->_options['localusers'] = false;
         if ($this->_options['localusers'] && !@is_readable($this->localuserfile)) {
             msg("plainCAS: The local users file is not readable.", -1);
             $this->success = false;
         }
         if ($this->_getOption("logFile")) {
             phpCAS::setDebug($this->_getOption("logFile"));
         }
         //If $conf['auth']['cas']['logFile'] exist we start phpCAS in debug mode
         $server_version = CAS_VERSION_2_0;
         if ($this->_getOption("samlValidate")) {
             $server_version = SAML_VERSION_1_1;
         }
         phpCAS::client($server_version, $this->_getOption('server'), (int) $this->_getOption('port'), $this->_getOption('rootcas'), true);
         //Note the last argument true, to allow phpCAS to change the session_id so he will be able to destroy the session after a CAS logout request - Enable Single Sign Out
         // curl extension is needed
         if (!function_exists('curl_init')) {
             if ($this->_getOption('debug')) {
                 msg("CAS err: CURL extension not found.", -1, __LINE__, __FILE__);
             }
             $this->success = false;
             return;
         }
         // automatically log the user when there is a cas session opened
         if ($this->_getOption('autologin')) {
             phpCAS::setCacheTimesForAuthRecheck(1);
         } else {
             phpCAS::setCacheTimesForAuthRecheck(-1);
         }
         if ($this->_getOption('cert')) {
             phpCAS::setCasServerCert($this->_getOption('cert'));
         } elseif ($this->_getOption('cacert')) {
             phpCAS::setCasServerCACert($this->_getOption('cacert'));
         } else {
             phpCAS::setNoCasServerValidation();
         }
         if ($this->_getOption('handlelogoutrequest')) {
             phpCAS::handleLogoutRequests(true, $this->_getOption('handlelogoutrequestTrustedHosts'));
         } else {
             phpCAS::handleLogoutRequests(false);
         }
         if (@is_readable($this->_getOption('settings_file'))) {
             include_once $this->_getOption('settings_file');
         } else {
             include_once DOKU_PLUGIN . 'authplaincas/plaincas.settings.php';
         }
     }
     //
 }
开发者ID:papillon326,项目名称:authplaincas,代码行数:101,代码来源:auth.php

示例11: _synlogout

 private function _synlogout()
 {
     phpCAS::handleLogoutRequests(false);
 }
开发者ID:nicklos17,项目名称:littlemall,代码行数:4,代码来源:CasClient.php

示例12: configureCasValidation

 /**
  * Configure SSL Validation
  *
  * Having some kind of server cert validation in production
  * is highly recommended.
  */
 protected function configureCasValidation($config)
 {
     if ($config['cas_validation'] == 'ca' || $config['cas_validation'] == 'self') {
         phpCAS::setCasServerCACert($config['cas_cert'], $config['cas_validate_cn']);
     } else {
         // Not safe (does not validate your CAS server)
         phpCAS::setNoCasServerValidation();
     }
     phpCAS::handleLogoutRequests(false);
 }
开发者ID:nvanh1983,项目名称:zf1-cas-client,代码行数:16,代码来源:Cas.php

示例13: array

<?php

include_once 'CAS-1.3.1/CAS.php';
//phpCAS::setDebug('/tmp/phpCAS.log'); // Schrijft debug informatie naar een log-file
// Parameters: CAS versie, url CAS server, poort CAS server, CAS server URI (idem als host),
// boolean die aangeeft of sessie moet gestart worden, communicatieprotocol (SAML) tussen toepassing en CAS server
phpCAS::client(SAML_VERSION_1_1, 'login.ugent.be', 443, '', true, 'saml');
// Geeft aan vanaf welke server logout requests mogelijk zijn
phpCAS::handleLogoutRequests(true, array('cas1.ugent.be', 'cas2.ugent.be', 'cas3.ugent.be', 'cas4.ugent.be', 'cas5.ugent.be', 'cas6.ugent.be'));
// Configuratie van het certificaat van de CAS server
phpCAS::setExtraCurlOption(CURLOPT_SSLVERSION, 3);
// Locatie van het "trusted certificate authorities" bestand:
phpCAS::setCasServerCACert('/etc/ssl/certs/ca-certificates.crt');
// Geen server verificatie (minder veilig!):
//phpCAS::setNoCasServerValidation();
// Hier gebeurt de authenticatie van de gebruiker
phpCAS::forceAuthentication();
// Opvangen van logout requests
if (isset($_REQUEST['logout'])) {
    phpCAS::logout();
}
?>

<html>
  <head>
    <title>phpCAS simple client</title>
  </head>
  <body>
    <h1>Successfull Authentication!</h1>

    <p>the user's login is <b><?php 
开发者ID:zagarus,项目名称:trialShop,代码行数:31,代码来源:index.php

示例14: getUser

 public function getUser(CakeRequest $request)
 {
     phpCAS::handleLogoutRequests(false);
     phpCAS::forceAuthentication();
     return array_merge(array('username' => phpCAS::getUser()), phpCAS::getAttributes());
 }
开发者ID:byu-oit-appdev,项目名称:eamWS,代码行数:6,代码来源:CasAuthenticate.php

示例15: buildsurveysession

function buildsurveysession($surveyid, $preview = false)
{
    global $hitid, $hitname;
    Yii::trace('start', 'survey.buildsurveysession');
    global $secerror, $clienttoken;
    global $tokensexist;
    //global $surveyid;
    global $move, $rooturl;
    $sLangCode = App()->language;
    $languagechanger = makeLanguageChangerSurvey($sLangCode);
    if (!$preview) {
        $preview = Yii::app()->getConfig('previewmode');
    }
    $thissurvey = getSurveyInfo($surveyid, $sLangCode);
    $_SESSION['survey_' . $surveyid]['templatename'] = $thissurvey['template'];
    // $thissurvey['template'] already fixed by model : but why put this in session ?
    $_SESSION['survey_' . $surveyid]['templatepath'] = getTemplatePath($thissurvey['template']) . DIRECTORY_SEPARATOR;
    $sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
    $loadsecurity = returnGlobal('loadsecurity', true);
    // NO TOKEN REQUIRED BUT CAPTCHA ENABLED FOR SURVEY ACCESS
    if ($tokensexist == 0 && isCaptchaEnabled('surveyaccessscreen', $thissurvey['usecaptcha']) && !isset($_SESSION['survey_' . $surveyid]['captcha_surveyaccessscreen']) && !$preview) {
        //session_start();
        require_once dirname(__FILE__) . "/CAS/CAS.php";
        //指定log文件
        phpCAS::setDebug('./log.log');
        //指定cas地址,最后一个true表示是否cas服务器为https
        phpCAS::client(CAS_VERSION_2_0, 'ids.hit.edu.cn', 443, 'authserver', true);
        phpCAS::handleLogoutRequests();
        //本地退出应该重定向到CAS进行退出,传递service参数可以使CAS退出后返回本应用
        //demo表示退出请求为logout的请求
        if (isset($_GET['logout'])) {
            $param = array('service' => 'http://demo.cas.wisedu.cn:3273/');
            phpCAS::logout($param);
            exit;
        }
        //设置no ssl,即忽略证书检查.如果需要ssl,请用 phpCAS::setCasServerCACert()设置
        //setCasServerCACert方法设置ssl证书,
        phpCAS::setNoCasServerValidation();
        phpCAS::forceAuthentication();
        $hitid = phpCAS::getUser();
        $hitname = phpCAS::getAttributes()["cn"];
        /*//默认的就是这种状况
                // IF CAPTCHA ANSWER IS NOT CORRECT OR NOT SET
                //echo 2221;
                if (!isset($loadsecurity) ||
                !isset($_SESSION['survey_'.$surveyid]['secanswer']) ||
                $loadsecurity != $_SESSION['survey_'.$surveyid]['secanswer'])
                {
                    //echo 111;
                    sendCacheHeaders();
                    doHeader();
                    // No or bad answer to required security question
        
                    $redata = compact(array_keys(get_defined_vars()));
                    //下面一行测试注释掉,除样式没有发现其他影响
                    //echo templatereplace(file_get_contents($sTemplatePath."startpage.pstpl"),array(),$redata,'frontend_helper[875]');
                    //echo makedropdownlist();
                    echo templatereplace(file_get_contents($sTemplatePath."survey.pstpl"),array(),$redata,'frontend_helper[877]');
                    echo "我们需要对你的身份进行确认,确保你是哈尔滨工业大学师生,请点击下面的按钮进行全校统一认证登录";
                    if (isset($loadsecurity))
                    { // was a bad answer
                        echo "<font color='#FF0000'>".gT("The answer to the security question is incorrect.")."</font><br />";
                    }
        
                    echo "<p class='captcha'>".gT("Please confirm access to survey by answering the security question below and click continue.")."</p>"
                    .CHtml::form(array("/survey/index","sid"=>$surveyid), 'post', array('class'=>'captcha'))."
                    <table align='center'>
                    <tr>
                    <td align='right' valign='middle'>
                    <input type='hidden' name='sid' value='".$surveyid."' id='sid' />
                    <input type='hidden' name='lang' value='".$sLangCode."' id='lang' />";
                    // In case we this is a direct Reload previous answers URL, then add hidden fields
                    if (isset($_GET['loadall']) && isset($_GET['scid'])
                    && isset($_GET['loadname']) && isset($_GET['loadpass']))
                    {
                        echo "
                        <input type='hidden' name='loadall' value='".htmlspecialchars($_GET['loadall'],ENT_QUOTES, 'UTF-8')."' id='loadall' />
                        <input type='hidden' name='scid' value='".returnGlobal('scid',true)."' id='scid' />
                        <input type='hidden' name='loadname' value='".htmlspecialchars($_GET['loadname'],ENT_QUOTES, 'UTF-8')."' id='loadname' />
                        <input type='hidden' name='loadpass' value='".htmlspecialchars($_GET['loadpass'],ENT_QUOTES, 'UTF-8')."' id='loadpass' />";
                    }
        
                    echo "
                    </td>
                    </tr>";
                    if (function_exists("ImageCreate") && isCaptchaEnabled('surveyaccessscreen', $thissurvey['usecaptcha']))
                    {
                        echo "<tr>
                        <td align='center' valign='middle'><label for='captcha'>".gT("Security question:")."</label></td><td align='left' valign='middle'><table><tr><td valign='middle'><img src='".Yii::app()->getController()->createUrl('/verification/image/sid/'.$surveyid)."' alt='captcha' /></td>
                        <td valign='middle'><input id='captcha' type='text' size='5' maxlength='3' name='loadsecurity' value='' /></td></tr></table>
                        </td>
                        </tr>";
                    }
                    echo "<tr><td colspan='2' align='center'><input class='submit' type='submit' value='".gT("Continue")."' /></td></tr>
                    </table>
                    </form>";
        
                    echo templatereplace(file_get_contents($sTemplatePath."endpage.pstpl"),array(),$redata,'frontend_helper[1567]');
                    doFooter();
                    exit;
//.........这里部分代码省略.........
开发者ID:withhope,项目名称:HIT-Survey,代码行数:101,代码来源:frontend_helper.php


注:本文中的phpCAS::handleLogoutRequests方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。