对于我的项目我有
但是当我想在同一时间启用两种身份验证时,我遇到了问题。一旦我使用登录表单登录,我就会被重定向到CAS登录页面: - /
Security.yml
...
pattern: ^/
anonymous: false
form_login:
provider: user_provider
login_path: login_route
check_path: login_check
default_target_path: homepage
logout:
path: /logout
switch_user: true
guard:
authenticators:
- xxxx.cas_authenticator
...
CasAuthenticator.php
...
public function getCredentials(Request $request)
{
\phpCAS::client(CAS_VERSION_2_0, $url, $port, "/cas");
\phpCAS::setNoCasServerValidation();
\phpCAS::handleLogoutRequests();
\phpCAS::forceAuthentication();
if (\phpCAS::getUser()) {
return \phpCAS::getUser();
}
return null;
}
public function getUser($credentials, UserProviderInterface $userProvider)
{
return $this->em->getRepository('LfayBundle:User\User')
->findOneBy(array('username' => $credentials ));
}
...
我哪里错了?
如果有人有想法......