本文整理汇总了PHP中Symfony\Component\Security\Core\Authentication\Token\TokenInterface::eraseCredentials方法的典型用法代码示例。如果您正苦于以下问题:PHP TokenInterface::eraseCredentials方法的具体用法?PHP TokenInterface::eraseCredentials怎么用?PHP TokenInterface::eraseCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Security\Core\Authentication\Token\TokenInterface
的用法示例。
在下文中一共展示了TokenInterface::eraseCredentials方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* {@inheritdoc}
*/
public function authenticate(TokenInterface $token)
{
$credentials = $token->getCredentials();
if (is_null($credentials)) {
throw new AuthenticationException(OAuth2::HTTP_BAD_REQUEST, null, 'Empty credentials');
}
$client = $this->storage->getClient($credentials[0]);
if (is_null($client)) {
throw new AuthenticationException(OAuth2::ERROR_INVALID_CLIENT);
}
if ($this->storage->checkClientCredentials($client, $credentials[1]) === false) {
throw new AuthenticationException(OAuth2::ERROR_INVALID_CLIENT);
}
$token->eraseCredentials();
$newToken = new SharedSecretToken(array("ROLE_SHARED_SECRET", "ROLE_OAUTH_CLIENT"));
$newToken->setClient($client);
$newToken->setAuthenticated(true);
return $newToken;
}
示例2: eraseCredentials
public function eraseCredentials()
{
$this->innerToken->eraseCredentials();
}