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


PHP phpCAS::isSessionAuthenticated方法代碼示例

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


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

示例1: authCAS

function authCAS($config)
{
    require_once dirname(__FILE__) . '/CAS/CAS.php';
    // get module configuration
    $cas_validate = true;
    $cas_version = CAS_VERSION_2_0;
    $cas_language = 'english';
    //    phpCAS::setDebug();
    phpCAS::client($cas_version, $config->cashostname, (int) $config->casport, $config->casbaseuri, false);
    phpCAS::setLang($cas_language);
    error_log("CAS: Entering");
    $check = phpCAS::isSessionAuthenticated();
    phpCAS::forceAuthentication();
    $NetUsername = phpCAS::getUser();
    //this stores their network user id
    error_log("CAS: Exiting {$NetUsername}");
    return $NetUsername;
}
開發者ID:duanhv,項目名稱:mdg-social,代碼行數:18,代碼來源:lib.php

示例2: RWSPLICas

function RWSPLICas($r_usrn, $r_pw, $r_csf)
{
    global $RWSESL3;
    global $RWSSRURL;
    global $RWSCRURL;
    global $RWSECMUL;
    if ($r_csf) {
        return;
    }
    $r_aus = get_enabled_auth_plugins();
    foreach ($r_aus as $r_aun) {
        $r_aup = get_auth_plugin($r_aun);
        if (strcasecmp($r_aup->authtype, RWSCAS) == 0) {
            $r_csp = $r_aup;
            break;
        }
    }
    if (!isset($r_csp)) {
        return;
    }
    if (empty($r_csp->config->hostname)) {
        return;
    }
    if ($r_csp->config->multiauth) {
        $r_auc = RWSGSOpt("authCAS", PARAM_ALPHANUMEXT);
        if ($r_auc === false || strlen($r_auc) == 0) {
            $r_auc = "CAS";
        }
        if (strcasecmp($r_auc, "CAS") != 0) {
            return;
        }
    }
    list($r_v1, $r_v2, $r_v3) = explode(".", phpCAS::getVersion());
    $r_csp->connectCAS();
    if (phpCAS::isSessionAuthenticated()) {
        return;
    }
    $r_rv = RWSGSOpt("version", PARAM_ALPHANUMEXT);
    if ($r_rv === false || strlen($r_rv) == 0) {
        unset($r_bv);
    } else {
        $r_bv = intval($r_rv);
    }
    if (strlen($RWSCRURL) > 0) {
        $r_svu = $RWSCRURL;
    } else {
        $r_svu = RWSGSUrl(false, false);
    }
    $r_svu .= "?rwscas=1";
    if (isset($r_bv)) {
        $r_svu .= "&version=";
        $r_svu .= urlencode($r_bv);
    }
    if ($RWSECMUL || $r_csp->config->multiauth) {
        if (isset($r_usrn)) {
            $r_svu .= "&rwsuser=";
            $r_svu .= urlencode($r_usrn);
        }
        if (isset($r_pw)) {
            $r_svu .= "&rwspass=";
            $r_svu .= urlencode($r_pw);
        }
    }
    phpCAS::setFixedServiceURL($r_svu);
    if ($r_csp->config->proxycas) {
        if (strlen($RWSCRURL) > 0) {
            $r_cbu = $RWSCRURL;
        } else {
            $r_cbu = RWSGSUrl(true, false);
        }
        $r_cbu .= "?rwscas=2";
        if (isset($r_bv)) {
            $r_cbu .= "&version=";
            $r_cbu .= urlencode($r_bv);
        }
        if ($RWSECMUL || $r_csp->config->multiauth) {
            if (isset($r_usrn)) {
                $r_cbu .= "&rwsuser=";
                $r_cbu .= urlencode($r_usrn);
            }
            if (isset($r_pw)) {
                $r_cbu .= "&rwspass=";
                $r_cbu .= urlencode($r_pw);
            }
        }
        phpCAS::setFixedCallbackURL($r_cbu);
    }
    $r_tpp = RWSGTPath();
    if ($r_tpp !== false) {
        $r_ckf = tempnam($r_tpp, "rws");
        if ($r_ckf !== false) {
            $_SESSION['rwscas']['cookiejar'] = $r_ckf;
        }
    }
    $r_liu = phpCAS::getServerLoginURL();
    $r_ch = curl_init();
    curl_setopt($r_ch, CURLOPT_URL, $r_liu);
    curl_setopt($r_ch, CURLOPT_HTTPGET, true);
    curl_setopt($r_ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($r_ch, CURLOPT_HEADER, true);
//.........這裏部分代碼省略.........
開發者ID:MoodleMetaData,項目名稱:MoodleMetaData,代碼行數:101,代碼來源:servicelib.php

示例3: logout

 public function logout()
 {
     if (phpCAS::isSessionAuthenticated()) {
         if (isset($_SESSION['phpCAS'])) {
             $serialized = serialize($_SESSION['phpCAS']);
         }
         phpCAS::log('Logout requested, but no session data found for user:' . PHP_EOL . $serialized);
     }
     phpCAS::logout();
 }
開發者ID:nvanh1983,項目名稱:zf1-cas-client,代碼行數:10,代碼來源:Cas.php

示例4: ob_start

 * Include the Entrada init code.
 */
require_once "init.inc.php";
ob_start("on_checkout");
$PROCEED_TO = isset($_GET["url"]) ? clean_input($_GET["url"], "trim") : (isset($_SERVER["REQUEST_URI"]) ? clean_input($_SERVER["REQUEST_URI"], "trim") : false);
$PATH_INFO = isset($_SERVER["PATH_INFO"]) ? clean_input($_SERVER["PATH_INFO"], array("url", "lowercase")) : "";
$PATH_SEPARATED = explode("/", $PATH_INFO);
/**
 * Process CAS authentication
 */
if (defined("AUTH_ALLOW_CAS") && AUTH_ALLOW_CAS == true) {
    if (!isset($_SESSION["isAuthorized"]) || !(bool) $_SESSION["isAuthorized"]) {
        if ($ACTION == "cas" || isset($_COOKIE[AUTH_CAS_COOKIE])) {
            phpCAS::forceAuthentication();
        }
        if (phpCAS::isSessionAuthenticated()) {
            if (isset($_SESSION[AUTH_CAS_SESSION][AUTH_CAS_ID])) {
                $result = cas_credentials($_SESSION[AUTH_CAS_SESSION][AUTH_CAS_ID]);
                if ($result) {
                    $CAS_AUTHENTICATED = true;
                    $username = $result["username"];
                    $password = $result["password"];
                    $ACTION = "login";
                }
            } else {
                phpCAS::logout(ENTRADA_URL . "?action=cas&state=failed");
            }
        }
        if ($ACTION == "cas" && isset($_GET["state"]) && $_GET["state"] == "failed") {
            add_error("Your login credentials are not recognized.<br /><br />Please contact a system administrator for further information.");
            $ACTION = "login";
開發者ID:nadeemshafique,項目名稱:entrada-1x,代碼行數:31,代碼來源:index.php

示例5: isLoggedIn

 public static function isLoggedIn()
 {
     return class_exists("phpCAS") && phpCAS::isSessionAuthenticated();
 }
開發者ID:nerdydrew,項目名稱:Poo-at-CWRU,代碼行數:4,代碼來源:helper.php


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