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


PHP AuthManager::authenticate方法代碼示例

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


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

示例1: isset

autoloadManager::setSaveFile(dirname(__FILE__) . '/../tmp/front.php');
autoloadManager::addFolder(CORE);
autoloadManager::addFolder(BUSINESS);
spl_autoload_register('autoloadManager::loadClass');
$_REQUEST['controller'] = Toolbox::getArrayParameter($_REQUEST, 'controller', 'Feed');
$_REQUEST['action'] = Toolbox::getArrayParameter($_REQUEST, 'action', 'index');
// jquery based ajax application
$from = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'XMLHttpRequest' === $_SERVER['HTTP_X_REQUESTED_WITH'] ? 'ajax' : 'http';
try {
    $front = frontDispatcher::getInstance();
    // Init Session
    // Save header for ajax call, so that we can either root or return false for ajax calls
    $actions = AccessHelper::getActions();
    // authenticate
    $AuthManager = new AuthManager($actions);
    $AuthManager->authenticate($front, '/?controller=Feed&action=index', $from);
    // Inject Dynamically changing objects
    $Container = ContainerFactory::get('front');
    $Container['Access'] = $actions;
    $Container['AuthManager'] = $AuthManager;
    $Container['Request'] = $_REQUEST;
    $Container['Session'] = SessionManager::getSession('front');
    // Route
    $front->route($Container);
} catch (Exception $e) {
    if ('ajax' == $from) {
        header('content-type: application/json');
        $params = array('error' => 'false', 'message' => $e->getMessage());
        echo json_encode($params);
        exit;
    } else {
開發者ID:bachkoutou,項目名稱:Simple-MVC,代碼行數:31,代碼來源:index.php

示例2: unset

     unset($_SESSION['_user']);
 }
 // CAS
 if (get_conf('claro_CasEnabled', false) && isset($_REQUEST['authModeReq']) && $_REQUEST['authModeReq'] == 'CAS') {
     require get_path('rootSys') . '/claroline/auth/extauth/cas/casProcess.inc.php';
 }
 // SHIBBOLETH ( PROBABLY BROKEN !!!! )
 if (get_conf('claro_ShibbolethEnabled', false)) {
     require get_path('rootSys') . '/claroline/auth/extauth/shibboleth/shibbolethProcess.inc.php';
 }
 if ($login && $password) {
     // reinitalize all session variables
     session_unset();
     $claro_loginRequested = true;
     try {
         $currentUser = AuthManager::authenticate($login, $password);
         if ($currentUser) {
             $_uid = (int) $currentUser->userId;
             $uidReset = true;
             $claro_loginSucceeded = true;
         } else {
             $_uid = null;
             $claro_loginSucceeded = false;
         }
     } catch (Exception $e) {
         Console::error("Cannot authenticate user : " . $e->__toString());
         $_uid = null;
         $claro_loginSucceeded = false;
     }
 } else {
     $claro_loginRequested = false;
開發者ID:rhertzog,項目名稱:lcs,代碼行數:31,代碼來源:claro_init_local.inc.php

示例3: user_check_authentication

/**
 * Check if the authentication fassword for the given user
 *
 * @author Frederic Minne <zefredz@claroline.net>
 *
 * @param string $password
 * @param string $login
 * @return boolean
 *
 */
function user_check_authentication($password, $login)
{
    try {
        if (false !== AuthManager::authenticate($login, $password)) {
            return true;
        } else {
            return false;
        }
    } catch (Exception $e) {
        Console::error("Cannot authentified user : " . $e->__toString());
        return false;
    }
}
開發者ID:rhertzog,項目名稱:lcs,代碼行數:23,代碼來源:user.lib.php


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