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


PHP TokenInterface::setAuthenticated方法代码示例

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


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

示例1: authenticate

 public function authenticate(TokenInterface $token)
 {
     $user = $this->userProvider->loadUserByUsername($token->getUsername());
     if (empty($user) || $user->checkToken($token->token) === false) {
         throw new AuthenticationException('Token authentication failed.');
     }
     $token->setAuthenticated(true);
     $token->setUser($user);
     return $token;
 }
开发者ID:rimi-itk,项目名称:bpi-web-service,代码行数:10,代码来源:PKProvider.php

示例2: authenticate

 public function authenticate(TokenInterface $token)
 {
     $this->service_container->get($this->wordpress_loader_id)->load();
     $user = wp_get_current_user();
     if (isset($user->data) && isset($user->data->user_nicename)) {
         $token->setUser($user->data->user_email);
         $token->setAuthenticated(true);
         //$token->setRoles(array());
     } else {
         $token->setRedirectUrl($this->redirect_url);
     }
     return $token;
 }
开发者ID:cmoncy,项目名称:WordpressBundle,代码行数:13,代码来源:WordpressAuthenticationProvider.php

示例3: authenticate

 public function authenticate(TokenInterface $token)
 {
     $token->setAuthenticated(true);
     return $token;
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:5,代码来源:SecurityNullAuthenticationManager.php

示例4: setAuthenticated

 public function setAuthenticated($isAuthenticated)
 {
     $this->innerToken->setAuthenticated($isAuthenticated);
 }
开发者ID:emodric,项目名称:LegacyBridge,代码行数:4,代码来源:LegacyToken.php

示例5: refreshUser

 /**
  * Refreshes the user by reloading it from the user provider
  *
  * @param TokenInterface $token
  *
  * @return TokenInterface|null
  */
 protected function refreshUser(TokenInterface $token)
 {
     $user = $token->getUser();
     if (!$user instanceof AccountInterface) {
         return $token;
     }
     if (null !== $this->logger) {
         $this->logger->debug(sprintf('Reloading user from user provider.'));
     }
     foreach ($this->userProviders as $provider) {
         try {
             $cUser = $provider->loadUserByAccount($user);
             $token->setRoles($cUser->getRoles());
             $token->setUser($cUser);
             if (false === $cUser->equals($user)) {
                 $token->setAuthenticated(false);
             }
             if (null !== $this->logger) {
                 $this->logger->debug(sprintf('Username "%s" was reloaded from user provider.', $user));
             }
             return $token;
         } catch (UnsupportedAccountException $unsupported) {
             // let's try the next user provider
         } catch (UsernameNotFoundException $notFound) {
             if (null !== $this->logger) {
                 $this->logger->debug(sprintf('Username "%s" could not be found.', $user));
             }
             return null;
         }
     }
     throw new \RuntimeException(sprintf('There is no user provider for user "%s".', get_class($user)));
 }
开发者ID:faridos,项目名称:ServerGroveLiveChat,代码行数:39,代码来源:ContextListener.php


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