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


PHP Context::getAuthenticationTokens方法代码示例

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


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

示例1: render

 /**
  * @param string $propertyPath
  * @return string
  */
 public function render($propertyPath = 'party.name')
 {
     $tokens = $this->securityContext->getAuthenticationTokens();
     foreach ($tokens as $token) {
         if ($token->isAuthenticated()) {
             return (string) \TYPO3\Flow\Reflection\ObjectAccess::getPropertyPath($token->getAccount(), $propertyPath);
         }
     }
     return '';
 }
开发者ID:Chhunlong,项目名称:Flow.Login,代码行数:14,代码来源:AccountViewHelper.php

示例2: render

 /**
  * Renders <f:then> child if any account is currently authenticated, otherwise renders <f:else> child.
  *
  * @return string the rendered string
  * @api
  */
 public function render()
 {
     $activeTokens = $this->securityContext->getAuthenticationTokens();
     /** @var $token TokenInterface */
     foreach ($activeTokens as $token) {
         if ($token->isAuthenticated()) {
             return $this->renderThenChild();
         }
     }
     return $this->renderElseChild();
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:17,代码来源:IfAuthenticatedViewHelper.php

示例3: render

 /**
  * Renders <f:then> child if any account is currently authenticated, otherwise renders <f:else> child.
  *
  * @param string $authenticationProviderName
  * @return string the rendered string
  * @api
  */
 public function render($authenticationProviderName = 'Sandstorm.UserManagement:Login')
 {
     $activeTokens = $this->securityContext->getAuthenticationTokens();
     /** @var $token TokenInterface */
     foreach ($activeTokens as $token) {
         if ($token->getAuthenticationProviderName() === $authenticationProviderName && $token->isAuthenticated()) {
             return $this->renderThenChild();
         }
     }
     return $this->renderElseChild();
 }
开发者ID:sandstorm,项目名称:usermanagement,代码行数:18,代码来源:IfAuthenticatedViewHelper.php

示例4: onAuthenticationFailure

 /**
  * @param AuthenticationRequiredException $exception
  */
 protected function onAuthenticationFailure(AuthenticationRequiredException $exception = NULL)
 {
     /** @var $token TokenInterface */
     foreach ($this->securityContext->getAuthenticationTokens() as $token) {
         if ($token instanceof AbstractClientToken && $token->getAuthenticationStatus() === TokenInterface::WRONG_CREDENTIALS) {
             $this->addFlashMessage('An error occurred during your log in. Please make sure you\'re granting all required permissions because this is need for the Instagram Client to run.', 'Wrong input', Message::SEVERITY_ERROR, array(), 1383817435);
             $this->forward('login');
             break;
         }
     }
     $this->addFlashMessage('The e-mail address or the password have not been entered correctly.', 'Wrong input', Message::SEVERITY_ERROR, array(), 1371119714);
     $this->forward('index');
 }
开发者ID:Weissheiten,项目名称:Weissheiten.OAuth2.ClientInstagram,代码行数:16,代码来源:AuthenticationController.php

示例5: logout

 /**
  * Logout all active authentication tokens
  *
  * @return void
  */
 public function logout()
 {
     if ($this->isAuthenticated() !== TRUE) {
         return;
     }
     $this->isAuthenticated = NULL;
     /** @var $token TokenInterface */
     foreach ($this->securityContext->getAuthenticationTokens() as $token) {
         $token->setAuthenticationStatus(TokenInterface::NO_CREDENTIALS_GIVEN);
     }
     $this->emitLoggedOut();
     if ($this->session->isStarted()) {
         $this->session->destroy('Logout through AuthenticationProviderManager');
     }
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:20,代码来源:AuthenticationProviderManager.php

示例6: blockIllegalRequestsAndForwardToAuthenticationEntryPoints

 /**
  * Advices the dispatch method so that illegal action requests are blocked before
  * invoking any controller.
  *
  * The "request" referred to within this method is an ActionRequest or some other
  * dispatchable request implementing RequestInterface. Note that we don't deal
  * with HTTP requests here.
  *
  * @Flow\Around("setting(TYPO3.Flow.security.enable) && method(TYPO3\Flow\Mvc\Dispatcher->dispatch())")
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current joinpoint
  * @return mixed Result of the advice chain
  * @throws \Exception|\TYPO3\Flow\Security\Exception\AccessDeniedException
  * @throws \Exception|\TYPO3\Flow\Security\Exception\AuthenticationRequiredException
  */
 public function blockIllegalRequestsAndForwardToAuthenticationEntryPoints(JoinPointInterface $joinPoint)
 {
     $request = $joinPoint->getMethodArgument('request');
     if (!$request instanceof ActionRequest || $this->securityContext->areAuthorizationChecksDisabled()) {
         return $joinPoint->getAdviceChain()->proceed($joinPoint);
     }
     try {
         $this->firewall->blockIllegalRequests($request);
         return $joinPoint->getAdviceChain()->proceed($joinPoint);
     } catch (AuthenticationRequiredException $exception) {
         $response = $joinPoint->getMethodArgument('response');
         $entryPointFound = FALSE;
         /** @var $token \TYPO3\Flow\Security\Authentication\TokenInterface */
         foreach ($this->securityContext->getAuthenticationTokens() as $token) {
             $entryPoint = $token->getAuthenticationEntryPoint();
             if ($entryPoint !== NULL) {
                 $entryPointFound = TRUE;
                 if ($entryPoint instanceof WebRedirect) {
                     $this->securityLogger->log('Redirecting to authentication entry point', LOG_INFO, $entryPoint->getOptions());
                 } else {
                     $this->securityLogger->log('Starting authentication with entry point of type ' . get_class($entryPoint), LOG_INFO);
                 }
                 $this->securityContext->setInterceptedRequest($request->getMainRequest());
                 $entryPoint->startAuthentication($request->getHttpRequest(), $response);
             }
         }
         if ($entryPointFound === FALSE) {
             $this->securityLogger->log('No authentication entry point found for active tokens, therefore cannot authenticate or redirect to authentication automatically.', LOG_NOTICE);
             throw $exception;
         }
     } catch (AccessDeniedException $exception) {
         $this->securityLogger->log('Access denied', LOG_WARNING);
         throw $exception;
     }
     return NULL;
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:50,代码来源:RequestDispatchingAspect.php

示例7: onetimeLoginAction

 /**
  * @param Token $token
  * @return void
  */
 public function onetimeLoginAction(Token $token)
 {
     $username = $token->getMeta()['name'];
     /** @var $account \TYPO3\Flow\Security\Account */
     $account = NULL;
     $providerName = $this->authenticationProviderName;
     $accountRepository = $this->accountRepository;
     $this->securityContext->withoutAuthorizationChecks(function () use($username, $providerName, $accountRepository, &$account) {
         $account = $accountRepository->findActiveByAccountIdentifierAndAuthenticationProviderName($username, $providerName);
     });
     foreach ($this->securityContext->getAuthenticationTokens() as $authenticationToken) {
         if ($authenticationToken->getAuthenticationProviderName() === $providerName) {
             $authenticationToken->setAuthenticationStatus(TokenInterface::AUTHENTICATION_SUCCESSFUL);
             $authenticationToken->setAccount($account);
             break;
         }
     }
     $this->redirect('resetForm');
 }
开发者ID:robertlemke,项目名称:Neos.IdNeosIo,代码行数:23,代码来源:ResetPasswordController.php

示例8: socialAuthenticateAction

 public function socialAuthenticateAction($name, $socialNetwork, $return_url = NULL)
 {
     $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($name, $this->providerName);
     if ($account instanceof \TYPO3\Flow\Security\Account) {
         if ($account->getParty()->getSocialNetwork() == $socialNetwork) {
             $tokens = $this->securityContext->getAuthenticationTokens();
             foreach ($tokens as $token) {
                 $token->setAccount($account);
                 $token->setAuthenticationStatus(\TYPO3\Flow\Security\Authentication\TokenInterface::AUTHENTICATION_SUCCESSFUL);
             }
             $this->flashMessageContainer->addMessage(new Message($this->translator->translateById('login.login.success', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
             if ($return_url != '') {
                 $this->redirectToUri($return_url);
             } else {
                 $this->redirect('index', 'Standard');
             }
         } else {
             $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error($this->translator->translateById('login.login.usernameExist', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
             $this->redirect('index', 'Standard');
         }
     }
 }
开发者ID:e-webking,项目名称:lostfound,代码行数:22,代码来源:LoginController.php


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