本文整理汇总了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);
}
}
示例2: __construct
public function __construct($user, $attributes, array $roles = array())
{
parent::__construct($roles);
$this->setUser($user);
$this->setAttributes($attributes);
$this->userIsNew = false;
}
示例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();
}
示例4: __construct
public function __construct($user, array $attributes = array(), array $roles = array())
{
parent::__construct($roles);
$this->setUser($user);
$this->casAttributes = $attributes;
parent::setAuthenticated(true);
}
示例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 = '';
}
示例6: setAuthenticated
public function setAuthenticated($isAuthenticated)
{
if ($isAuthenticated) {
throw new \LogicException('Cannot set this token to trusted after instantiation.');
}
parent::setAuthenticated(false);
}
示例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);
}
示例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);
}
示例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');
}
示例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);
}
示例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);
}
示例12: __construct
public function __construct($user, array $roles = array())
{
parent::__construct($roles);
$this->setUser($user);
if ($roles) {
$this->setAuthenticated(true);
}
}
示例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);
}
示例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);
}
示例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;
}