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


PHP Context::getInterceptedRequest方法代码示例

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


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

示例1: authenticateAction

 /**
  * Calls the authentication manager to authenticate all active tokens
  * and redirects to the original intercepted request on success if there
  * is one stored in the security context. If no intercepted request is
  * found, the function simply returns.
  *
  * If authentication fails, the result of calling the defined
  * $errorMethodName is returned.
  *
  * Note: Usually there is no need to override this action. You should use
  * the according callback methods instead (onAuthenticationSuccess() and
  * onAuthenticationFailure()).
  *
  * @return string
  * @Flow\SkipCsrfProtection
  */
 public function authenticateAction()
 {
     $authenticationException = null;
     try {
         $this->authenticationManager->authenticate();
     } catch (\TYPO3\Flow\Security\Exception\AuthenticationRequiredException $exception) {
         $authenticationException = $exception;
     }
     if ($this->authenticationManager->isAuthenticated()) {
         $storedRequest = $this->securityContext->getInterceptedRequest();
         if ($storedRequest !== null) {
             $this->securityContext->setInterceptedRequest(null);
         }
         return $this->onAuthenticationSuccess($storedRequest);
     } else {
         $this->onAuthenticationFailure($authenticationException);
         return call_user_func(array($this, $this->errorMethodName));
     }
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:35,代码来源:AbstractAuthenticationController.php

示例2: callbackAction

 /**
  * Receive an SSO authentication callback and trigger authentication
  * through the SingleSignOnProvider.
  *
  * GET /sso/authentication/callback?...
  *
  * @param string $callbackUri
  * @return void
  */
 public function callbackAction($callbackUri)
 {
     try {
         $this->authenticationManager->authenticate();
     } catch (\TYPO3\Flow\Security\Exception\AuthenticationRequiredException $exception) {
         $authenticationException = $exception;
     }
     if ($this->authenticationManager->isAuthenticated()) {
         $storedRequest = $this->securityContext->getInterceptedRequest();
         if ($storedRequest !== NULL) {
             $this->securityContext->setInterceptedRequest(NULL);
             $this->redirectToRequest($storedRequest);
         } else {
             // TODO Do we have to check the URI?
             $this->redirectToUri($callbackUri);
         }
     } else {
         throw new \Flowpack\SingleSignOn\Client\Exception('Could not authenticate in callbackAction triggered by the SSO server.', 1366613161, isset($authenticationException) ? $authenticationException : NULL);
     }
 }
开发者ID:anihy,项目名称:Flowpack.SingleSignOn.Client,代码行数:29,代码来源:AuthenticationController.php

示例3: authenticateDiscourseUserAction

 /**
  * @param string $sso
  * @param string $sig
  * @return void
  * @Flow\SkipCsrfProtection
  */
 public function authenticateDiscourseUserAction($sso = '', $sig = '')
 {
     if ($sso === '' && $sig === '') {
         $argumentsOfInterceptedRequest = $this->securityContext->getInterceptedRequest()->getArguments();
         if (!isset($argumentsOfInterceptedRequest['sso']) || !isset($argumentsOfInterceptedRequest['sig'])) {
             return 'This page needs to be called with valid sso and sig arguments from crowd!';
         }
         $sso = $argumentsOfInterceptedRequest['sso'];
         $sig = $argumentsOfInterceptedRequest['sig'];
     }
     if (hash_hmac('sha256', $sso, $this->ssoSecret) === $sig) {
         parse_str(base64_decode($sso), $incomingPayload);
         $currentAccount = $this->securityContext->getAccount();
         /** @var Person $crowdUser */
         $crowdUser = $this->partyService->getAssignedPartyOfAccount($currentAccount);
         $outgoingPayload = base64_encode(http_build_query(array('nonce' => $incomingPayload['nonce'], 'email' => $crowdUser->getPrimaryElectronicAddress()->getIdentifier(), 'name' => $crowdUser->getName()->getFullName(), 'username' => $currentAccount->getAccountIdentifier(), 'external_id' => $currentAccount->getAccountIdentifier()), '', '&', PHP_QUERY_RFC3986));
         $outgoingSignature = hash_hmac('sha256', $outgoingPayload, $this->ssoSecret);
         $this->redirectToUri(sprintf('%s?%s', $this->discourseSsoUrl, http_build_query(array('sso' => $outgoingPayload, 'sig' => $outgoingSignature), '', '&', PHP_QUERY_RFC3986)), 0, 302);
     }
     return 'Sorry, we couldn\'t log you in';
 }
开发者ID:robertlemke,项目名称:Neos.IdNeosIo,代码行数:27,代码来源:DiscourseCrowdSsoController.php


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