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


PHP OC_User::handleApacheAuth方法代码示例

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


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

示例1: authenticate

 /**
  * Override function here. We want to cache authentication cookies
  * in the syncing client to avoid HTTP-401 roundtrips.
  * If the sync client supplies the cookies, then OC_User::isLoggedIn()
  * will return true and we can see this WebDAV request as already authenticated,
  * even if there are no HTTP Basic Auth headers.
  * In other case, just fallback to the parent implementation.
  *
  * @return bool
  */
 public function authenticate(Sabre_DAV_Server $server, $realm)
 {
     if (OC_User::handleApacheAuth() || OC_User::isLoggedIn()) {
         $user = OC_User::getUser();
         OC_Util::setupFS($user);
         $this->currentUser = $user;
         return true;
     }
     return parent::authenticate($server, $realm);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:20,代码来源:auth.php

示例2: auth

 /**
  * @param \Sabre\DAV\Server $server
  * @param $realm
  * @return bool
  */
 private function auth(\Sabre\DAV\Server $server, $realm)
 {
     if (OC_User::handleApacheAuth() || OC_User::isLoggedIn() && is_null(\OC::$server->getSession()->get(self::DAV_AUTHENTICATED))) {
         $user = OC_User::getUser();
         OC_Util::setupFS($user);
         $this->currentUser = $user;
         \OC::$server->getSession()->close();
         return true;
     }
     return parent::authenticate($server, $realm);
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:16,代码来源:auth.php

示例3: tryApacheAuth

 /**
  * Try to login a user via HTTP authentication
  * @return bool|void
  */
 protected static function tryApacheAuth()
 {
     $return = OC_User::handleApacheAuth();
     // if return is true we are logged in -> redirect to the default page
     if ($return === true) {
         $_REQUEST['redirect_url'] = \OC::$server->getRequest()->getRequestUri();
         OC_Util::redirectToDefaultPage();
         exit;
     }
     // in case $return is null apache based auth is not enabled
     return is_null($return) ? false : true;
 }
开发者ID:krsvital,项目名称:core,代码行数:16,代码来源:base.php

示例4: auth

 /**
  * @param RequestInterface $request
  * @param ResponseInterface $response
  * @return array
  */
 private function auth(RequestInterface $request, ResponseInterface $response)
 {
     if (\OC_User::handleApacheAuth() || $this->userSession->isLoggedIn() && is_null($this->session->get(self::DAV_AUTHENTICATED)) || $this->userSession->isLoggedIn() && $this->session->get(self::DAV_AUTHENTICATED) === $this->userSession->getUser()->getUID() && $request->getHeader('Authorization') === null) {
         $user = $this->userSession->getUser()->getUID();
         \OC_Util::setupFS($user);
         $this->currentUser = $user;
         $this->session->close();
         return [true, $this->principalPrefix . $user];
     }
     if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With')))) {
         // do not re-authenticate over ajax, use dummy auth name to prevent browser popup
         $response->addHeader('WWW-Authenticate', 'DummyBasic realm="' . $this->realm . '"');
         $response->setStatus(401);
         throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
     }
     return parent::check($request, $response);
 }
开发者ID:mnefedov,项目名称:core,代码行数:22,代码来源:auth.php

示例5: auth

 /**
  * @param RequestInterface $request
  * @param ResponseInterface $response
  * @return array
  * @throws NotAuthenticated
  */
 private function auth(RequestInterface $request, ResponseInterface $response)
 {
     $forcedLogout = false;
     if (!$this->request->passesCSRFCheck() && $this->requiresCSRFCheck()) {
         // In case of a fail with POST we need to recheck the credentials
         if ($this->request->getMethod() === 'POST') {
             $forcedLogout = true;
         } else {
             $response->setStatus(401);
             throw new \Sabre\DAV\Exception\NotAuthenticated('CSRF check not passed.');
         }
     }
     if ($forcedLogout) {
         $this->userSession->logout();
     } else {
         if ($this->twoFactorManager->needsSecondFactor()) {
             throw new \Sabre\DAV\Exception\NotAuthenticated('2FA challenge not passed.');
         }
         if (\OC_User::handleApacheAuth() || $this->userSession->isLoggedIn() && is_null($this->session->get(self::DAV_AUTHENTICATED)) || $this->userSession->isLoggedIn() && $this->session->get(self::DAV_AUTHENTICATED) === $this->userSession->getUser()->getUID() && $request->getHeader('Authorization') === null) {
             $user = $this->userSession->getUser()->getUID();
             \OC_Util::setupFS($user);
             $this->currentUser = $user;
             $this->session->close();
             return [true, $this->principalPrefix . $user];
         }
     }
     if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With')))) {
         // do not re-authenticate over ajax, use dummy auth name to prevent browser popup
         $response->addHeader('WWW-Authenticate', 'DummyBasic realm="' . $this->realm . '"');
         $response->setStatus(401);
         throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
     }
     $data = parent::check($request, $response);
     if ($data[0] === true) {
         $startPos = strrpos($data[1], '/') + 1;
         $user = $this->userSession->getUser()->getUID();
         $data[1] = substr_replace($data[1], $user, $startPos);
     }
     return $data;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:46,代码来源:Auth.php

示例6: handleLogin

 /**
  * Check login: apache auth, auth token, basic auth
  *
  * @param OCP\IRequest $request
  * @return boolean
  */
 private static function handleLogin(OCP\IRequest $request)
 {
     $userSession = self::$server->getUserSession();
     if (OC_User::handleApacheAuth()) {
         return true;
     }
     if ($userSession->tryTokenLogin($request)) {
         return true;
     }
     if ($userSession->tryBasicAuthLogin($request)) {
         return true;
     }
     return false;
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:20,代码来源:base.php

示例7: auth

 /**
  * @param \Sabre\DAV\Server $server
  * @param string $realm
  * @return bool
  */
 private function auth(\Sabre\DAV\Server $server, $realm)
 {
     if (\OC_User::handleApacheAuth() || $this->userSession->isLoggedIn() && is_null($this->session->get(self::DAV_AUTHENTICATED))) {
         $user = $this->userSession->getUser()->getUID();
         \OC_Util::setupFS($user);
         $this->currentUser = $user;
         $this->session->close();
         return true;
     }
     if ($server->httpRequest->getHeader('X-Requested-With') === 'XMLHttpRequest') {
         // do not re-authenticate over ajax, use dummy auth name to prevent browser popup
         $server->httpResponse->addHeader('WWW-Authenticate', 'DummyBasic realm="' . $realm . '"');
         $server->httpResponse->setStatus(401);
         throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
     }
     return parent::authenticate($server, $realm);
 }
开发者ID:hassanhawilo,项目名称:core,代码行数:22,代码来源:auth.php

示例8: auth

	/**
	 * @param \Sabre\DAV\Server $server
	 * @param $realm
	 * @return bool
	 */
	private function auth(\Sabre\DAV\Server $server, $realm) {
		if (\OC_User::handleApacheAuth() ||
			//Fix for broken webdav clients
			(\OC_User::isLoggedIn() && is_null(\OC::$server->getSession()->get(self::DAV_AUTHENTICATED))) ||
			//Well behaved clients that only send the cookie are allowed
			(\OC_User::isLoggedIn() && \OC::$server->getSession()->get(self::DAV_AUTHENTICATED) === \OC_User::getUser())
		) {
			$user = \OC_User::getUser();
			\OC_Util::setupFS($user);
			$this->currentUser = $user;
			\OC::$server->getSession()->close();
			return true;
		}

		return parent::authenticate($server, $realm);
	}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:21,代码来源:auth.php


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