3
기본 인증 처리기를 작성해야합니다. 내 onAuthenticationFailure
에서 테스트 용으로, 나는 var-dumping $request
입니다. 그것은 나쁜 자격 증명을 사용하여 작동해야하지만 아무 일도 일어나지 않았습니다.Symfony2에서 인증 처리 서비스를 등록하는 방법은 무엇입니까?
내가 뭔가 잘못 거기 추측 내 src\Acme\TestBundle\resources\Config\services.yml
:
services:
authentication_handler:
class: Acme\TestBundle\Handler\AuthenticationHandler
이 사용 문은 가독성을 위해 테스트 클래스 제거 :
당신은security.yml
파일 핸들러를 설정해야
namespace Acme\TestBundle\Handler;
class AuthenticationHandler implements AuthenticationSuccessHandlerInterface,
AuthenticationFailureHandlerInterface, LogoutSuccessHandlerInterface
{
function onAuthenticationSuccess(Request $request, TokenInterface $token)
{
$user = $token->getUser();
}
function onAuthenticationFailure(Request $request,
AuthenticationException $exception)
{
var_dump($request);
die();
}
public function onLogoutSuccess(Request $request)
{
}
}