本文整理汇总了PHP中Symfony\Component\Security\Core\Authentication\Token\TokenInterface::getProviderKey方法的典型用法代码示例。如果您正苦于以下问题:PHP TokenInterface::getProviderKey方法的具体用法?PHP TokenInterface::getProviderKey怎么用?PHP TokenInterface::getProviderKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Security\Core\Authentication\Token\TokenInterface
的用法示例。
在下文中一共展示了TokenInterface::getProviderKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: supportsToken
/**
* @return boolean
*/
public function supportsToken(TokenInterface $token, $providerKey)
{
if (!$token instanceof PreAuthenticatedToken) {
return false;
}
return $token->getProviderKey() === $providerKey;
}
示例2: supportsToken
/**
* {@inheritdoc}
*/
public function supportsToken(TokenInterface $token, $providerKey)
{
if (!$token instanceof WebTokenToken) {
return false;
}
return $providerKey == $token->getProviderKey();
}
示例3: onAuthenticationSuccess
/**
* Triggered on successful login.
*
* @param Request $request
* @param TokenInterface $token
*
* @return RedirectResponse
*/
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
// clean up some session data used at login
$request->getSession()->remove(AsnUsernamePasswordFormAuthenticationListener::LAST_ASN);
$targetPathString = sprintf('_security.%s.target_path', $token->getProviderKey());
// if we were redirected to login after accessing a secure url, return back to the url
if ($request->getSession()->has($targetPathString)) {
$targetUrl = $request->getSession()->get($targetPathString);
// clean the session
$request->getSession()->remove($targetPathString);
} else {
$targetUrl = '/';
}
return new RedirectResponse($targetUrl);
}
示例4: onAuthenticationSuccess
public function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
$em = $this->container->get('doctrine')->getManager();
$failureRepo = $em->getRepository('AppFrontBundle:Loginfailure');
$failureRepo->removeFailures($token->getUser(), $request->server->get('REMOTE_ADDR'));
if ($request->isXmlHttpRequest()) {
$response = new JsonResponse(array('success' => true, 'username' => $token->getUsername()));
} else {
$referer = $request->getSession()->get('_security.' . $token->getProviderKey() . '.target_path');
if ($referer) {
$response = new RedirectResponse($referer);
} else {
$response = parent::onAuthenticationSuccess($request, $token);
}
}
return $response;
}
示例5: supports
/**
* @see Symfony\Component\Security\Core\Authentication\Provider\uthenticationProviderInterface::supports()
*/
public function supports(TokenInterface $token)
{
return $token instanceof AutoLoginToken && $token->getProviderKey() === $this->providerKey;
}
示例6: supports
/**
* {@inheritdoc}
*/
public function supports(TokenInterface $token)
{
return $token instanceof UsernamePasswordToken && $this->providerKey === $token->getProviderKey();
}
示例7: isAdminToken
/**
* @param TokenInterface $token
* @param $providerKey
*
* @return bool
*/
private function isAdminToken($providerKey, TokenInterface $token = null)
{
return ($token instanceof UsernamePasswordToken || $token instanceof RememberMeToken) && $token->getProviderKey() === $providerKey;
}
示例8: isAdminToken
/**
* @param TokenInterface $token
* @param $providerKey
*
* @return bool
*/
private function isAdminToken(TokenInterface $token, $providerKey)
{
return $token instanceof UsernamePasswordToken && $token->getProviderKey() === $providerKey;
}
示例9: supports
/**
* {@inheritdoc}
*/
public function supports(TokenInterface $token)
{
return $token instanceof PreAuthenticatedToken && $this->providerKey === $token->getProviderKey();
}
示例10: supports
/**
* {@inheritdoc}
*/
public function supports(TokenInterface $token)
{
return $token instanceof OrganizationRememberMeToken && $this->providerKey === $token->getProviderKey();
}
示例11: supports
public function supports(TokenInterface $token)
{
return $token instanceof TelenorUserToken && $this->providerKey == $token->getProviderKey() && $this->validateIfTokenIsNotExpired($token);
}
示例12: supportsToken
public function supportsToken(TokenInterface $token, $providerKey)
{
return $token instanceof PreAuthenticatedToken && $token->getProviderKey() === $providerKey || $token instanceof AnonymousToken;
}
示例13: isAdminToken
/**
* @param TokenInterface $token
* @param $providerKey
*
* @return bool
*/
private function isAdminToken($providerKey, TokenInterface $token = null)
{
return is_callable([$token, 'getProviderKey']) && $token->getProviderKey() === $providerKey;
}
示例14: supports
/**
* Check whether this provider supports the given token.
*
* @param TokenInterface $token
*
* @return boolean
*/
public function supports(TokenInterface $token)
{
return $token instanceof UsernamePasswordToken && $token->getProviderKey() === $this->providerKey && $this->emailValidator->isValid($token->getUsername()) && $this->imapManager->supports($token->getUsername());
}
示例15: supportsToken
/**
* @param TokenInterface $token
* @param $providerKey
* @return bool
*/
public function supportsToken(TokenInterface $token, $providerKey)
{
return $token instanceof UsernamePasswordToken && $token->getProviderKey() === $providerKey;
}