本文整理汇总了PHP中Symfony\Component\Security\Core\Authentication\Token\TokenInterface::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP TokenInterface::getUri方法的具体用法?PHP TokenInterface::getUri怎么用?PHP TokenInterface::getUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Security\Core\Authentication\Token\TokenInterface
的用法示例。
在下文中一共展示了TokenInterface::getUri方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
/**
* Attempts to authenticate a TokenInterface object.
*
* @param TokenInterface $token The TokenInterface instance to authenticate
*
* @return TokenInterface An authenticated TokenInterface instance, never null
*
* @throws AuthenticationException if the authentication fails
*/
public function authenticate(TokenInterface $token)
{
if (!$token instanceof HawkToken) {
throw new \InvalidArgumentException('Provided token is not HawkToken');
}
try {
$user = $this->userProvider->loadUserByUsername($token->getId());
$this->userChecker->checkPreAuth($user);
$this->hawkServer->authenticate($token->getMethod(), $token->getHost(), $token->getPort(), $token->getUri(), $token->getContentType(), $token->getPayload(), $token->getAuthorizationHeader());
$this->userChecker->checkPostAuth($user);
$authenticatedToken = new HawkToken($user->getRoles());
$authenticatedToken->copy($token);
$authenticatedToken->setAuthenticated(true);
$authenticatedToken->setUser($user);
return $authenticatedToken;
} catch (UnauthorizedException $exception) {
throw new AuthenticationException('Invalid Hawk authentication data');
}
}
开发者ID:vytautasgimbutas,项目名称:lib-hawk-authentication-bundle,代码行数:28,代码来源:HawkAuthenticationProvider.php