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


PHP Token\AbstractToken类代码示例

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


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

示例1: update

 public function update(AbstractToken $token)
 {
     $usurpator = false;
     $roles = $token->getRoles();
     foreach ($roles as $role) {
         if ($role->getRole() === 'ROLE_PREVIOUS_ADMIN') {
             return;
         }
         //May be better to check the class of the token.
         if ($role->getRole() === 'ROLE_USURPATE_WORKSPACE_ROLE') {
             $usurpator = true;
         }
     }
     if ($usurpator) {
         $this->updateUsurpator($token);
     } else {
         $this->updateNormal($token);
     }
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:19,代码来源:TokenUpdater.php

示例2: __construct

 public function __construct($user, $attributes, array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->setAttributes($attributes);
     $this->userIsNew = false;
 }
开发者ID:AlejandroHerr,项目名称:EsnGalaxy,代码行数:7,代码来源:CasToken.php

示例3: __construct

 public function __construct(array $roles = array())
 {
     parent::__construct($roles);
     // If the user has roles, consider it authenticated
     $this->setAuthenticated(count($roles) > 0);
     $this->setSessionToken();
 }
开发者ID:bose987,项目名称:symfony-angular,代码行数:7,代码来源:SecurityToken.php

示例4: __construct

 public function __construct($user, array $attributes = array(), array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->casAttributes = $attributes;
     parent::setAuthenticated(true);
 }
开发者ID:rubenrua,项目名称:CasBundle,代码行数:7,代码来源:CasAuthenticationToken.php

示例5: __construct

 public function __construct(array $roles = array())
 {
     parent::__construct($roles);
     // If the user has roles, consider it authenticated
     $this->setAuthenticated(count($roles) > 0);
     $this->workspaceName = '';
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:7,代码来源:ViewAsToken.php

示例6: setAuthenticated

 public function setAuthenticated($isAuthenticated)
 {
     if ($isAuthenticated) {
         throw new \LogicException('Cannot set this token to trusted after instantiation.');
     }
     parent::setAuthenticated(false);
 }
开发者ID:aptoma,项目名称:silex-extras,代码行数:7,代码来源:ApiKeyToken.php

示例7: __construct

 public function __construct(OpauthResult $result, array $roles = array())
 {
     parent::__construct($roles);
     // If the user has roles, consider it authenticated
     $this->setAuthenticated(count($roles) > 0);
     $this->setAttribute('opauth', $result);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:7,代码来源:OpauthToken.php

示例8: __construct

 /**
  * @param string|object            $user         The username (like a nickname, email address, etc.),
  *                                               or a UserInterface instance
  *                                               or an object implementing a __toString method.
  * @param Organization             $organization The organization
  * @param RoleInterface[]|string[] $roles        An array of roles
  */
 public function __construct($user, Organization $organization, array $roles = [])
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->setOrganizationContext($organization);
     parent::setAuthenticated(count($roles) > 0);
 }
开发者ID:Maksold,项目名称:platform,代码行数:14,代码来源:ImpersonationToken.php

示例9: __construct

 /**
  * @param array $infos
  */
 public function __construct(array $infos)
 {
     parent::__construct([]);
     $this->clientTokenInfos = isset($infos['client']['id']) ? $infos['client'] : null;
     $this->userTokenInfos = isset($infos['user']['id']) ? $infos['user'] : null;
     $this->impersonatedUserInfos = isset($infos['sudo']['id']) ? $infos['sudo'] : null;
     $this->setUser(isset($this->userTokenInfos['id']) ? $this->userTokenInfos['id'] : 'unknown');
 }
开发者ID:phppro,项目名称:silex-api,代码行数:11,代码来源:ApiUnauthenticatedUserToken.php

示例10: __construct

 public function __construct($firewallName, $providerKey, $uid, array $role = [])
 {
     parent::__construct($role);
     $this->setAuthenticated(count($role) > 0);
     $this->setAttribute(self::UNIQUE_ID_ATTR, $uid);
     $this->setAttribute(self::PROVIDER_KEY_ATTR, $providerKey);
     $this->setAttribute(self::FIREWALL_NAME_ATTR, $firewallName);
 }
开发者ID:trismegiste,项目名称:oauthbundle,代码行数:8,代码来源:Token.php

示例11: __construct

 /**
  * Constructor.
  *
  * @param string|object            $user        The user
  * @param mixed                    $context The user credentials
  * @param string                   $providerKey The provider key
  * @param RoleInterface[]|string[] $roles       An array of roles
  */
 public function __construct($user, $context, $providerKey, array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->credentials = $context;
     $this->providerKey = $providerKey;
     parent::setAuthenticated(count($roles) > 0);
 }
开发者ID:shirone,项目名称:security-jwt-service-provider,代码行数:16,代码来源:JWTToken.php

示例12: __construct

 public function __construct($user, array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     if ($roles) {
         $this->setAuthenticated(true);
     }
 }
开发者ID:datavoyager,项目名称:SimplesamlphpBundle,代码行数:8,代码来源:SamlToken.php

示例13: __construct

 /**
  * {@inheritDoc}
  */
 public function __construct($user, array $roles = null)
 {
     if (is_null($roles) && $user instanceof UserInterface) {
         $roles = $user->getRoles();
     }
     parent::__construct($roles ?: []);
     $this->setUser($user);
 }
开发者ID:kl3ryk,项目名称:symfony-facebook-authentication-bundle,代码行数:11,代码来源:FacebookUserToken.php

示例14: __construct

 /**
  * @param mixed  $credentials
  * @param string $guardProviderKey Unique key that bind this token to a specific GuardAuthenticatorInterface
  */
 public function __construct($credentials, $guardProviderKey)
 {
     $this->credentials = $credentials;
     $this->guardProviderKey = $guardProviderKey;
     parent::__construct(array());
     // never authenticated
     parent::setAuthenticated(false);
 }
开发者ID:Irvyne,项目名称:KnpUGuard,代码行数:12,代码来源:PreAuthenticationGuardToken.php

示例15: __construct

 public function __construct($usuario, $credenciales, array $roles = array())
 {
     parent::__construct($roles);
     // If the user has roles, consider it authenticated
     $this->setAuthenticated(count($roles) > 0);
     $this->credentials = $credenciales;
     $this->user = $usuario;
 }
开发者ID:vtacius,项目名称:ldapas,代码行数:8,代码来源:ldapUserToken.php


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