當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。