當前位置: 首頁>>代碼示例>>PHP>>正文


PHP phpCAS::setNoClearTicketsFromUrl方法代碼示例

本文整理匯總了PHP中phpCAS::setNoClearTicketsFromUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP phpCAS::setNoClearTicketsFromUrl方法的具體用法?PHP phpCAS::setNoClearTicketsFromUrl怎麽用?PHP phpCAS::setNoClearTicketsFromUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在phpCAS的用法示例。


在下文中一共展示了phpCAS::setNoClearTicketsFromUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: check_cas_result

function check_cas_result($config)
{
    require_once dirname(__DIR__) . '/vendor/autoload.php';
    try {
        $cas_version = $config->cas_version ? $config->cas_version : CAS_VERSION_2_0;
        // phpCAS::setDebug();
        phpCAS::client($cas_version, $config->cashostname, (int) $config->casport, $config->casbaseuri, false);
        // don't automatically clear tickets from the url, we're taking care of that
        phpCAS::setNoClearTicketsFromUrl();
        // if a certificate is provided, use it, otherwise don't
        if ($config->cas_server_ca_cert_path != "") {
            // here we sould set the server certificate for production
            // '/etc/pki/tls/certs/DigiCertCA.crt'
            phpCAS::setCasServerCACert($config->cas_server_ca_cert_path);
        } else {
            // if you want to skip ssl verification
            if ($config->cas_server_no_validation) {
                phpCAS::setNoCasServerValidation();
            }
        }
        // check authentication; returns true/false
        if (phpCAS::checkAuthentication()) {
            // grab username
            $NetUsername = phpCAS::getUser();
            return $NetUsername;
        } else {
            return false;
        }
    } catch (Exception $e) {
        error_log("CAS ERROR: " . $e->getMessage());
        register_error($e->getMessage());
        return false;
    }
}
開發者ID:AU-Landing-Project,項目名稱:au_cas_auth,代碼行數:34,代碼來源:functions.php

示例2: checkAuthentication_raw

function checkAuthentication_raw($noCache, $haveTicket)
{
    if (isset($_GET["auth_checked"])) {
        $noCookies = !isset($_COOKIE["PHPSESSID"]);
        if ($noCookies) {
            debug_msg("cookie disabled or not accepted");
        }
        $_SESSION['time_before_verifying_CAS_ticket'] = microtime(true);
        $_SESSION['time_before_redirecting_to_CAS'] = getAndUnset($_SESSION, 'time_before_adding_auth_checked');
        if ($noCookies || $noCache) {
            // do not redirect otherwise
            // - if noCookies, it will dead-loop
            // - if noCache, we must not clean url otherwise "cleanup SESSION" will be done after final redirect to clean URL
            phpCAS::setNoClearTicketsFromUrl();
        } else {
            if ($haveTicket) {
                // remove "auth_checked" after CAS before redirecting to final URL
                toggle_auth_checked_in_redirect();
            }
        }
        try {
            $isAuthenticated = phpCAS::isAuthenticated();
        } catch (Exception $e) {
            // ignore
        }
        $wasPreviouslyAuthenticated = false;
    } else {
        // add "auth_checked" in url before redirecting to CAS
        toggle_auth_checked_in_redirect();
        $_SESSION['time_before_adding_auth_checked'] = microtime(true);
        $isAuthenticated = phpCAS::checkAuthentication();
        // NB: if we reach this point, we are either in "wasPreviouslyAuthenticated" case or after final redirect to clean URL
        $noCookies = false;
    }
    return array($isAuthenticated, $noCookies);
}
開發者ID:prigaux,項目名稱:bandeau-ENT,代碼行數:36,代碼來源:bandeau-ENT-js.php


注:本文中的phpCAS::setNoClearTicketsFromUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。