php Symfony-Component-Security-Core-Authentication-Token-AbstractToken类(方法)实例源码

下面列出了php Symfony-Component-Security-Core-Authentication-Token-AbstractToken 类(方法)源码代码实例,从而了解它的用法。

作者:ngyda    项目:CoreBundl   
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);
     }
 }

作者:AlejandroHer    项目:EsnGalax   
public function __construct($user, $attributes, array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->setAttributes($attributes);
     $this->userIsNew = false;
 }

作者:bose98    项目:symfony-angula   
public function __construct(array $roles = array())
 {
     parent::__construct($roles);
     // If the user has roles, consider it authenticated
     $this->setAuthenticated(count($roles) > 0);
     $this->setSessionToken();
 }

作者:rubenru    项目:CasBundl   
public function __construct($user, array $attributes = array(), array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->casAttributes = $attributes;
     parent::setAuthenticated(true);
 }

作者:ngyda    项目:CoreBundl   
public function __construct(array $roles = array())
 {
     parent::__construct($roles);
     // If the user has roles, consider it authenticated
     $this->setAuthenticated(count($roles) > 0);
     $this->workspaceName = '';
 }

作者:aptom    项目:silex-extra   
public function setAuthenticated($isAuthenticated)
 {
     if ($isAuthenticated) {
         throw new \LogicException('Cannot set this token to trusted after instantiation.');
     }
     parent::setAuthenticated(false);
 }

作者:ilosad    项目:chamilo-lms-icpn   
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);
 }

作者:Maksol    项目:platfor   
/**
  * @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);
 }

作者:phppr    项目:silex-ap   
/**
  * @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');
 }

作者:trismegist    项目:oauthbundl   
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);
 }

作者:shiron    项目:security-jwt-service-provide   
/**
  * 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);
 }

作者:datavoyage    项目:SimplesamlphpBundl   
public function __construct($user, array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($user);
     if ($roles) {
         $this->setAuthenticated(true);
     }
 }

作者:kl3ry    项目:symfony-facebook-authentication-bundl   
/**
  * {@inheritDoc}
  */
 public function __construct($user, array $roles = null)
 {
     if (is_null($roles) && $user instanceof UserInterface) {
         $roles = $user->getRoles();
     }
     parent::__construct($roles ?: []);
     $this->setUser($user);
 }

作者:Irvyn    项目:KnpUGuar   
/**
  * @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);
 }

作者:vtaciu    项目:ldapa   
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;
 }

作者:rdohm    项目:FOSTwitterBundl   
public function __construct($uid = '', array $roles = array())
 {
     parent::__construct($roles);
     $this->setUser($uid);
     if (!empty($uid)) {
         $this->setAuthenticated(true);
     }
 }

作者:ase    项目:SettingsBundl   
/**
  * @param string $user
  * @param int    $expirationTime
  * @param string $ipAddress
  * @param string $signature
  * @param array  $roles
  */
 public function __construct($user, $expirationTime, $ipAddress, $signature, array $roles = [])
 {
     parent::__construct($roles);
     $this->setUser($user);
     $this->expirationTime = $expirationTime;
     $this->ipAddress = $ipAddress;
     $this->signature = $signature;
     $this->setAuthenticated(count($roles) > 0);
 }

作者:conta    项目:core-bundl   
/**
  * Constructor.
  *
  * @param User $user
  *
  * @throws UsernameNotFoundException
  */
 public function __construct(User $user)
 {
     if (!$user->authenticate()) {
         throw new UsernameNotFoundException('Invalid Contao user given.');
     }
     $this->setUser($user);
     $this->setAuthenticated(true);
     parent::__construct($this->getRolesFromUser($user));
 }

作者:xpher    项目:one-time-access-bundl   
public function __construct($providerKey, UserInterface $user = null)
 {
     if ($user) {
         parent::__construct($user->getRoles());
         $this->setUser($user);
     } else {
         parent::__construct();
     }
     $this->providerKey = $providerKey;
 }

作者:fattouchsqual    项目:AMFWebServicesSecurityBundl   
/**
  * Constructor class.
  *
  * @param string $providerKey The key for the provider.
  * @param array  $roles       The roles for the token.
  * @param string $created     The created attribute.
  * @param string $digest      The digest attribute.
  * @param string $nonce       The nonce attribute.
  */
 public function __construct($providerKey, array $roles = array(), $created = null, $digest = null, $nonce = null)
 {
     parent::__construct($roles);
     // if the user has roles, consider it authenticated
     $this->setAuthenticated(count($roles) > 0);
     $this->providerKey = $providerKey;
     $this->created = $created;
     $this->digest = $digest;
     $this->nonce = $nonce;
 }


问题


面经


文章

微信
公众号

扫码关注公众号