I am trying to learn Symfony 2 and ran into some strange problem with an exception that I don't understand.
I am trying to implement a modified version of the authentication API on the Symfony site, but instead of $ _SERVER ['REMOTE_USER'] instead (this is where IIS passes the Windows Authentication to the user in PHP).
When I follow the tutorial, there are those UsernameNotFoundException, and AuthenticationExceptionthat can be selected, but when I use when I get BadCredentialsException(the token is not found in SecurityContext.).
I see that other exceptions are thrown into my logs, but they seem to be caught by the Kernel, and code execution continues until the token is requested and exists, which throws BadCredentialsException, which is not caught and, finally, system errors.
As far as I can tell:
- In
PreAuthenticationInterfaceI try to check the username in $ _SERVER ['REMOTE_USER'] with a known user. - Username not found (actually not matching strings - I haven't started integrating the database yet)
- A
UsernameNotFoundExceptionthrows me and is caught by the Core. Since throwing an exception works like returnnone of the code after its execution and nothing is returned. - Since nothing is returned, no authentication token is created.
- () , ,
BadCredentialsException. BadCredentialsException , kernel.exception , Symfony 500.
, UsernameNotFoundException .
EventListener, kernel.exception, , BadCredentialsException.
, UsernameNotFoundException AuthenticationException ?