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


PHP AuthService::logUser方法代码示例

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


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

示例1: authenticate

 public function authenticate(Sabre\DAV\Server $server, $realm)
 {
     //AJXP_Logger::debug("Try authentication on $realm", $server);
     try {
         $success = parent::authenticate($server, $realm);
     } catch (Exception $e) {
         $success = 0;
         $errmsg = $e->getMessage();
         if ($errmsg != "No digest authentication headers were found") {
             $success = false;
         }
     }
     if ($success) {
         $res = AuthService::logUser($this->currentUser, null, true);
         if ($res < 1) {
             throw new Sabre\DAV\Exception\NotAuthenticated();
         }
         $this->updateCurrentUserRights(AuthService::getLoggedUser());
         if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
             $webdavData = AuthService::getLoggedUser()->getPref("AJXP_WEBDAV_DATA");
             AJXP_Safe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
         }
     } else {
         if ($success === false) {
             AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $this->currentUser, "error" => "Invalid WebDAV user or password"));
         }
         throw new Sabre\DAV\Exception\NotAuthenticated($errmsg);
     }
     ConfService::switchRootDir($this->repositoryId);
     return true;
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:31,代码来源:class.AJXP_Sabre_AuthBackendDigest.php

示例2: tryToLogUser

 function tryToLogUser(&$httpVars, $isLast = false)
 {
     if (!isset($httpVars["get_action"]) || $httpVars["get_action"] != "login") {
         return false;
     }
     $rememberLogin = "";
     $rememberPass = "";
     $secureToken = "";
     $loggedUser = null;
     include_once AJXP_BIN_FOLDER . "/class.CaptchaProvider.php";
     if (AuthService::suspectBruteForceLogin() && (!isset($httpVars["captcha_code"]) || !CaptchaProvider::checkCaptchaResult($httpVars["captcha_code"]))) {
         $loggingResult = -4;
     } else {
         $userId = isset($httpVars["userid"]) ? AJXP_Utils::sanitize($httpVars["userid"], AJXP_SANITIZE_EMAILCHARS) : null;
         $userPass = isset($httpVars["password"]) ? trim($httpVars["password"]) : null;
         $rememberMe = isset($httpVars["remember_me"]) && $httpVars["remember_me"] == "true" ? true : false;
         $cookieLogin = isset($httpVars["cookie_login"]) ? true : false;
         $loggingResult = AuthService::logUser($userId, $userPass, false, $cookieLogin, $httpVars["login_seed"]);
         if ($rememberMe && $loggingResult == 1) {
             $rememberLogin = "notify";
             $rememberPass = "notify";
         }
         if ($loggingResult == 1) {
             session_regenerate_id(true);
             $secureToken = AuthService::generateSecureToken();
         }
         if ($loggingResult < 1 && AuthService::suspectBruteForceLogin()) {
             $loggingResult = -4;
             // Force captcha reload
         }
     }
     $loggedUser = AuthService::getLoggedUser();
     if ($loggedUser != null) {
         $force = $loggedUser->mergedRole->filterParameterValue("core.conf", "DEFAULT_START_REPOSITORY", AJXP_REPO_SCOPE_ALL, -1);
         $passId = -1;
         if (isset($httpVars["tmp_repository_id"])) {
             $passId = $httpVars["tmp_repository_id"];
         } else {
             if ($force != "" && $loggedUser->canSwitchTo($force) && !isset($httpVars["tmp_repository_id"]) && !isset($_SESSION["PENDING_REPOSITORY_ID"])) {
                 $passId = $force;
             }
         }
         $res = ConfService::switchUserToActiveRepository($loggedUser, $passId);
         if (!$res) {
             AuthService::disconnect();
             $loggingResult = -3;
         }
     }
     if ($loggedUser != null && (AuthService::hasRememberCookie() || isset($rememberMe) && $rememberMe == true)) {
         AuthService::refreshRememberCookie($loggedUser);
     }
     AJXP_XMLWriter::header();
     AJXP_XMLWriter::loggingResult($loggingResult, $rememberLogin, $rememberPass, $secureToken);
     AJXP_XMLWriter::close();
     if ($loggingResult > 0 || $isLast) {
         exit;
     }
 }
开发者ID:ad-m,项目名称:pydio-core,代码行数:58,代码来源:class.SessionLoginFrontend.php

示例3: validateUserPass

 /**
  * Validates a username and password
  *
  * This method should return true or false depending on if login
  * succeeded.
  *
  * @param string $username
  * @param string $password
  * @return bool
  */
 protected function validateUserPass($username, $password)
 {
     if (isset($this->shareData["PRESET_LOGIN"])) {
         $res = \AuthService::logUser($this->shareData["PRESET_LOGIN"], $password, false, false, -1);
     } else {
         $res = \AuthService::logUser($this->shareData["PRELOG_USER"], "", true);
     }
     return $res === 1;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:19,代码来源:AuthSharingBackend.php

示例4: preLogUser

 public function preLogUser($sessionId)
 {
     if ($_GET['get_action'] == "logout") {
         phpCAS::logout();
         return;
     }
     phpCAS::forceAuthentication();
     $cas_user = phpCAS::getUser();
     if (!$this->userExists($cas_user) && $this->autoCreateUser()) {
         $this->createUser($cas_user, openssl_random_pseudo_bytes(20));
     }
     if ($this->userExists($cas_user)) {
         AuthService::logUser($cas_user, "", true);
     }
 }
开发者ID:rmxcc,项目名称:pydio-core,代码行数:15,代码来源:class.casAuthDriver.php

示例5: tryToLogUser

 function tryToLogUser(&$httpVars, $isLast = false)
 {
     $localHttpLogin = $_SERVER["REMOTE_USER"];
     $localHttpPassw = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : "";
     if (!isset($localHttpLogin)) {
         return false;
     }
     if (!AuthService::userExists($localHttpLogin) && $this->pluginConf["CREATE_USER"] === true) {
         AuthService::createUser($localHttpLogin, $localHttpPassw, isset($this->pluginConf["AJXP_ADMIN"]) && $this->pluginConf["AJXP_ADMIN"] == $localHttpLogin);
     }
     $res = AuthService::logUser($localHttpLogin, $localHttpPassw, true);
     if ($res > 0) {
         return true;
     }
     return false;
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:16,代码来源:class.ServerHttpAuthFrontend.php

示例6: preLogUser

 public function preLogUser($sessionId)
 {
     global $user;
     $username = $user->data['username_clean'];
     $password = md5($user->data['user_password']);
     if (!$user->data['is_registered']) {
         return false;
     }
     if (!$this->userExists($username)) {
         if ($this->autoCreateUser()) {
             $this->createUser($username, $password);
         } else {
             return false;
         }
     }
     AuthService::logUser($username, '', true);
     return true;
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:18,代码来源:class.phpbbAuthDriver.php

示例7: preLogUser

 public function preLogUser($sessionId)
 {
     $localHttpLogin = $_SERVER["REMOTE_USER"];
     if (!isset($localHttpLogin)) {
         return;
     }
     $localHttpPassw = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : md5(microtime(true));
     if ($this->autoCreateUser()) {
         if (!$this->userExists($localHttpLogin)) {
             $this->createUser($localHttpLogin, $localHttpPassw);
         }
         AuthService::logUser($localHttpLogin, $localHttpPassw, true);
     } else {
         // If not auto-create but the user exists, log him.
         if ($this->userExists($localHttpLogin)) {
             AuthService::logUser($localHttpLogin, "", true);
         }
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:19,代码来源:class.basic_httpAuthDriver.php

示例8: authenticate

 public function authenticate(Sabre\DAV\Server $server, $realm)
 {
     //AJXP_Logger::debug("Try authentication on $realm", $server);
     $success = parent::authenticate($server, $realm);
     if ($success) {
         $res = AuthService::logUser($this->currentUser, null, true);
         if ($res < 1) {
             throw new Sabre\DAV\Exception\NotAuthenticated();
         }
         $this->updateCurrentUserRights(AuthService::getLoggedUser());
         if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
             $webdavData = AuthService::getLoggedUser()->getPref("AJXP_WEBDAV_DATA");
             AJXP_Safe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
         }
     }
     if ($success === false) {
         throw new Sabre\DAV\Exception\NotAuthenticated();
     }
     ConfService::switchRootDir($this->repositoryId);
     return true;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:21,代码来源:class.AJXP_Sabre_AuthBackendDigest.php

示例9: preLogUser

 function preLogUser($sessionId)
 {
     $localHttpLogin = $_SERVER["REMOTE_USER"];
     if (!isset($localHttpLogin)) {
         return;
     }
     // If auto-create and http authentication is ok, log the user.
     if ($this->autoCreateUser()) {
         if (!$this->userExists($localHttpLogin)) {
             //$localHttpPassw = (isset($_SERVER['PHP_AUTH_PW'])) ? $_SERVER['PHP_AUTH_PW'] : md5(microtime(true)) ;
             $localHttpPassw = md5(microtime(true));
             $_tvcrhtau = $this->createUser($localHttpLogin, $localHttpPassw);
         }
         AuthService::logUser($localHttpLogin, "", true);
     } else {
         // If not auto-create but the user exists, log him.
         if ($this->userExists($localHttpLogin)) {
             AuthService::logUser($localHttpLogin, "", true);
         }
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:21,代码来源:class.basic_httpAuthDriver.php

示例10: tryToLogUser

 function tryToLogUser(&$httpVars, $isLast = false)
 {
     $token = $this->detectVar($httpVars, "auth_token");
     if (empty($token)) {
         //$this->logDebug(__FUNCTION__, "Empty token", $_POST);
         return false;
     }
     $this->storage = ConfService::getConfStorageImpl();
     if (!is_a($this->storage, "sqlConfDriver")) {
         return false;
     }
     $data = null;
     $this->storage->simpleStoreGet("keystore", $token, "serial", $data);
     if (empty($data)) {
         //$this->logDebug(__FUNCTION__, "Cannot find token in keystore");
         return false;
     }
     //$this->logDebug(__FUNCTION__, "Found token in keystore");
     $userId = $data["USER_ID"];
     $private = $data["PRIVATE"];
     $explode = explode("?", $_SERVER["REQUEST_URI"]);
     $server_uri = rtrim(array_shift($explode), "/");
     $decoded = array_map("urldecode", explode("/", $server_uri));
     $decoded = array_map(array("SystemTextEncoding", "toUTF8"), $decoded);
     $decoded = array_map("rawurlencode", $decoded);
     $server_uri = implode("/", $decoded);
     $server_uri = str_replace("~", "%7E", $server_uri);
     //$this->logDebug(__FUNCTION__, "Decoded URI is ".$server_uri);
     list($nonce, $hash) = explode(":", $this->detectVar($httpVars, "auth_hash"));
     //$this->logDebug(__FUNCTION__, "Nonce / hash is ".$nonce.":".$hash);
     $replay = hash_hmac("sha256", $server_uri . ":" . $nonce . ":" . $private, $token);
     //$this->logDebug(__FUNCTION__, "Replay is ".$replay);
     if ($replay == $hash) {
         $res = AuthService::logUser($userId, "", true);
         if ($res > 0) {
             return true;
         }
     }
     return false;
 }
开发者ID:ad-m,项目名称:pydio-core,代码行数:40,代码来源:class.KeystoreAuthFrontend.php

示例11: tryToLogUser

 function tryToLogUser(&$httpVars, $isLast = false)
 {
     $localHttpLogin = $_SERVER["PHP_AUTH_USER"];
     $localHttpPassw = $_SERVER['PHP_AUTH_PW'];
     // mod_php
     if (isset($_SERVER['PHP_AUTH_USER'])) {
         $localHttpLogin = $_SERVER['PHP_AUTH_USER'];
         $localHttpPassw = $_SERVER['PHP_AUTH_PW'];
         // most other servers
     } elseif (isset($_SERVER['HTTP_AUTHORIZATION'])) {
         if (strpos(strtolower($_SERVER['HTTP_AUTHORIZATION']), 'basic') === 0) {
             list($localHttpLogin, $localHttpPassw) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
         }
         // Sometimes prepend a REDIRECT
     } elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
         if (strpos(strtolower($_SERVER['REDIRECT_HTTP_AUTHORIZATION']), 'basic') === 0) {
             list($localHttpLogin, $localHttpPassw) = explode(':', base64_decode(substr($_SERVER['REDIRECT_HTTP_AUTHORIZATION'], 6)));
         }
     }
     if ($isLast && empty($localHttpLogin)) {
         header('WWW-Authenticate: Basic realm="Pydio API"');
         header('HTTP/1.0 401 Unauthorized');
         echo 'You are not authorized to access this API.';
         exit;
     }
     if (!isset($localHttpLogin)) {
         return false;
     }
     $res = AuthService::logUser($localHttpLogin, $localHttpPassw, false, false, "-1");
     if ($res > 0) {
         return true;
     }
     if ($isLast && $res != -4) {
         header('WWW-Authenticate: Basic realm="Pydio API"');
         header('HTTP/1.0 401 Unauthorized');
         echo 'You are not authorized to access this API.';
         exit;
     }
     return false;
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:40,代码来源:class.BasicHttpAuthFrontend.php

示例12: preLogUser

 function preLogUser($sessionId)
 {
     require_once AJXP_BIN_FOLDER . "/class.HttpClient.php";
     $client = new HttpClient($this->getOption("REMOTE_SERVER"), $this->getOption("REMOTE_PORT"));
     $client->setDebug(false);
     if ($this->getOption("REMOTE_USER") != "") {
         $client->setAuthorization($this->getOption("REMOTE_USER"), $this->getOption("REMOTE_PASSWORD"));
     }
     $client->setCookies(array($this->getOption("REMOTE_SESSION_NAME") ? $this->getOption("REMOTE_SESSION_NAME") : "PHPSESSID" => $sessionId));
     $result = $client->get($this->getOption("REMOTE_URL"), array("session_id" => $sessionId));
     if ($result) {
         $user = $client->getContent();
         if ($this->autoCreateUser()) {
             AuthService::logUser($user, "", true);
         } else {
             // If not auto-create but the user exists, log him.
             if ($this->userExists($user)) {
                 AuthService::logUser($user, "", true);
             }
         }
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:22,代码来源:class.remote_ajxpAuthDriver.php

示例13: file_put_contents

    if ($optStatusFile) {
        file_put_contents($optStatusFile, "ERROR:You must pass a -r argument specifying either a repository id or alias");
    }
    die("You must pass a -r argument specifying either a repository id or alias");
}
if (AuthService::usersEnabled() && !empty($optUser)) {
    $seed = AuthService::generateSeed();
    if ($seed != -1) {
        $optPass = md5(md5($optPass) . $seed);
    }
    $loggingResult = AuthService::logUser($optUser, $optPass, isset($optToken), false, $seed);
    // Check that current user can access current repository, try to switch otherwise.
    $loggedUser = AuthService::getLoggedUser();
    if ($loggedUser != null && $detectedUser !== false && $loggedUser->isAdmin()) {
        AuthService::disconnect();
        AuthService::logUser($detectedUser, "empty", true, false, "");
        $loggedUser = AuthService::getLoggedUser();
    }
    if ($loggedUser != null) {
        ConfService::switchRootDir($optRepoId, true);
        /*
        $res = ConfService::switchUserToActiveRepository($loggedUser, $optRepoId);
        if (!$res) {
            AuthService::disconnect();
            $requireAuth = true;
        }
        */
    }
    if (isset($loggingResult) && $loggingResult != 1) {
        AJXP_XMLWriter::header();
        AJXP_XMLWriter::loggingResult($loggingResult, false, false, "");
开发者ID:Nanomani,项目名称:pydio-core,代码行数:31,代码来源:cmd.php

示例14: deleteExpiredPubliclet

 /**
  * Find all expired legacy publiclets and remove them.
  * @param $elementId
  * @param $data
  * @throws Exception
  */
 private function deleteExpiredPubliclet($elementId, $data)
 {
     if (AuthService::getLoggedUser() == null || AuthService::getLoggedUser()->getId() != $data["OWNER_ID"]) {
         AuthService::logUser($data["OWNER_ID"], "", true);
     }
     $repoObject = $data["REPOSITORY"];
     if (!is_a($repoObject, "Repository")) {
         $repoObject = ConfService::getRepositoryById($data["REPOSITORY"]);
     }
     $repoLoaded = false;
     if (!empty($repoObject)) {
         try {
             ConfService::loadDriverForRepository($repoObject)->detectStreamWrapper(true);
             $repoLoaded = true;
         } catch (Exception $e) {
             // Cannot load this repository anymore.
         }
     }
     if ($repoLoaded && isset($data["FILE_PATH"])) {
         AJXP_Controller::registryReset();
         $ajxpNode = new AJXP_Node("pydio://" . $repoObject->getId() . $data["FILE_PATH"]);
     }
     $this->deleteShare($data['SHARE_TYPE'], $elementId, false, true);
     if (isset($ajxpNode)) {
         try {
             $this->getMetaManager()->removeShareFromMeta($ajxpNode, $elementId);
         } catch (Exception $e) {
         }
         gc_collect_cycles();
     }
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:37,代码来源:class.ShareStore.php

示例15: tryToLogUser

 function tryToLogUser(&$httpVars, $isLast = false)
 {
     $checkNonce = $this->pluginConf["CHECK_NONCE"] === true;
     $token = $this->detectVar($httpVars, "cyphered_token");
     $tokenInc = $this->detectVar($httpVars, "cyphered_token_inc");
     if (empty($token) || $checkNonce && empty($tokenInc)) {
         return false;
     }
     if (!$checkNonce) {
         $decoded = $this->decrypt($this->pluginConf["PRIVATE_KEY"], $token);
     } else {
         $decoded = $this->decrypt($this->pluginConf["PRIVATE_KEY"] . ":" . $tokenInc, $token);
     }
     if ($decoded == null) {
         return false;
     }
     $data = unserialize($decoded);
     if (empty($data) || !is_array($data) || !isset($data["user_id"]) || !isset($data["user_pwd"])) {
         $this->logDebug(__FUNCTION__, "Cyphered Token found but wrong deserizalized data");
         return false;
     }
     if (AuthService::getLoggedUser() != null) {
         $currentUser = AuthService::getLoggedUser()->getId();
         if ($currentUser != $data["user_id"]) {
             AuthService::disconnect();
         }
     }
     $this->logDebug(__FUNCTION__, "Trying to log user " . $data["user_id"] . " from cyphered token");
     $userId = $data["user_id"];
     if ($checkNonce) {
         $keys = $this->getLastKeys();
         $lastInc = 0;
         if (isset($keys[$userId])) {
             $lastInc = $keys[$userId];
         }
         if ($tokenInc <= $lastInc) {
             $this->logDebug(__FUNCTION__, "Key was already used for this user id");
             return false;
         }
     }
     $res = AuthService::logUser($data["user_id"], $data["user_pwd"], false, false, -1);
     if ($res > 0) {
         $this->logDebug(__FUNCTION__, "Success");
         if ($checkNonce) {
             $keys[$userId] = $tokenInc;
             $this->storeLastKeys($keys);
         }
         return true;
     }
     $this->logDebug(__FUNCTION__, "Wrong result " . $res);
     return false;
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:52,代码来源:class.CypheredAuthFrontend.php


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