本文整理汇总了PHP中Symfony\Component\Security\Core\Authentication\Token\AbstractToken::setAuthenticated方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractToken::setAuthenticated方法的具体用法?PHP AbstractToken::setAuthenticated怎么用?PHP AbstractToken::setAuthenticated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Security\Core\Authentication\Token\AbstractToken
的用法示例。
在下文中一共展示了AbstractToken::setAuthenticated方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setAuthenticated
/**
* {@inheritdoc}
*/
public function setAuthenticated($isAuthenticated)
{
if ($isAuthenticated) {
throw new \LogicException('Cannot set this token to trusted after instantiation.');
}
parent::setAuthenticated(false);
}
示例2: __construct
public function __construct($user, array $attributes = array(), array $roles = array())
{
parent::__construct($roles);
$this->setUser($user);
$this->casAttributes = $attributes;
parent::setAuthenticated(true);
}
示例3: setAuthenticated
/**
* {@inheritdoc}
*/
public function setAuthenticated($authenticated)
{
if ($authenticated) {
throw new \LogicException('You cannot set this token to authenticated after creation.');
}
parent::setAuthenticated(false);
}
示例4: __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);
}
示例5: setAuthenticated
public function setAuthenticated($bool)
{
if ($bool) {
throw new \LogicException('TwitterUserToken may not be set to authenticated after creation.');
}
parent::setAuthenticated(false);
}
示例6: __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);
}
示例7: __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);
}
示例8: __construct
public function __construct($providerKey, $clientId, $clientSecret, $redirectUri = '', array $roles = [])
{
parent::__construct($roles);
$this->providerKey = $providerKey;
$this->clientId = $clientId;
$this->clientSecret = $clientSecret;
$this->redirectUri = $redirectUri;
parent::setAuthenticated(count($roles) > 0);
}
示例9: __construct
public function __construct(UserInterface $user, $providerKey)
{
parent::__construct($user->getRoles());
if (empty($providerKey)) {
throw new \InvalidArgumentException('$providerKey must not be empty.');
}
$this->providerKey = $providerKey;
$this->setUser($user);
parent::setAuthenticated(true);
}
示例10: __construct
public function __construct(UserInterface $user, $credentials, $providerKey, array $roles = array())
{
parent::__construct($roles);
if (empty($providerKey)) {
throw new \InvalidArgumentException('$providerKey must not be empty.');
}
$this->setUser($user);
$this->credentials = $credentials;
$this->providerKey = $providerKey;
parent::setAuthenticated(count($roles) > 0);
}
示例11: __construct
/**
* @param UserInterface $user The user!
* @param string $providerKey The provider (firewall) key
* @param RoleInterface[]|string[] $roles An array of roles
*
* @throws \InvalidArgumentException
*/
public function __construct(UserInterface $user, $providerKey, array $roles)
{
parent::__construct($roles);
if (empty($providerKey)) {
throw new \InvalidArgumentException('$providerKey (i.e. firewall key) must not be empty.');
}
$this->setUser($user);
$this->providerKey = $providerKey;
// this token is meant to be used after authentication success, so it is always authenticated
// you could set it as non authenticated later if you need to
parent::setAuthenticated(true);
}
示例12: __construct
public function __construct($providerKey, $accessToken, $tokenType = '', $clientId = '', $username = '', $expires = '', array $scope = [], array $roles = [])
{
parent::__construct($roles);
$this->providerKey = $providerKey;
$this->accessToken = $accessToken;
$this->tokenType = $tokenType;
$this->clientId = $clientId;
$this->username = $username;
$this->expires = $expires;
$this->scope = $scope;
parent::setAuthenticated(count($roles) > 0);
}
示例13: __construct
/**
* @param array|\Symfony\Component\Security\Core\Role\RoleInterface[] $providerKey
* @param null $authenticatingService
* @param string $user
* @param string $credentials
* @param array $roles
* @param Response $response
*/
public function __construct($providerKey, $authenticatingService = null, $user = '', $credentials = '', array $roles = [], Response $response = null)
{
parent::__construct($roles);
if (empty($providerKey)) {
throw new \InvalidArgumentException('$providerKey must not be empty.');
}
$this->setUser($user);
$this->authenticatingService = $authenticatingService;
$this->credentials = $credentials;
$this->providerKey = $providerKey;
$this->response = $response;
parent::setAuthenticated(count($roles) > 0);
}
示例14: __construct
public function __construct($user, $accessToken, User $apiUser = null, $providerKey, $scope = null, array $roles = array())
{
parent::__construct($roles);
if (empty($providerKey)) {
throw new \InvalidArgumentException('$providerKey must not be empty.');
}
$this->setUser($user);
$this->setAccessToken($accessToken);
$this->apiUser = $apiUser;
$this->providerKey = $providerKey;
$this->scope = $scope;
parent::setAuthenticated(count($roles) > 0);
}
示例15: setAuthenticated
public function setAuthenticated($authenticated)
{
parent::setAuthenticated($authenticated);
return $this;
}