本文整理汇总了PHP中Symfony\Component\Security\Core\User\UserProviderInterface::getProviders方法的典型用法代码示例。如果您正苦于以下问题:PHP UserProviderInterface::getProviders方法的具体用法?PHP UserProviderInterface::getProviders怎么用?PHP UserProviderInterface::getProviders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Security\Core\User\UserProviderInterface
的用法示例。
在下文中一共展示了UserProviderInterface::getProviders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ($this->userProvider instanceof ChainUserProvider) {
foreach ($this->userProvider->getProviders() as $provider) {
$result = $this->doAuth($provider, $token);
if ($result !== false) {
return $result;
}
}
} else {
$result = $this->doAuth($this->userProvider, $token);
if ($result !== false) {
return $result;
}
}
}
示例2: __construct
/**
* @param $user
* @param TokenInterface $token
* @param UserProviderInterface $userProvider
* @param Request $request
* @param bool $loginCheck Event executed from the mautic_sso_login_check route typically used as the SSO callback
* @param string $authenticatingService Service Service requesting authentication
* @param null $integrations
*/
public function __construct($user, TokenInterface $token, UserProviderInterface $userProvider, Request $request, $loginCheck = false, $authenticatingService = null, $integrations = null)
{
$this->token = $token;
$this->user = $user;
$this->isFormLogin = $token instanceof UsernamePasswordToken;
$this->integrations = $integrations;
$this->request = $request;
$this->isLoginCheck = $loginCheck;
$this->authenticatingService = $authenticatingService;
if ($userProvider instanceof ChainUserProvider) {
// Chain of user providers so let's find Mautic's
$providers = $userProvider->getProviders();
foreach ($providers as $provider) {
if ($provider instanceof UserProvider) {
$userProvider = $provider;
break;
}
}
}
$this->userProvider = $userProvider;
}