Answer the question
In order to leave comments, you need to log in
Symfony guard entry_point?
Colleagues, welcome!
Problem with authorization
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# Вызывается каждый раз, когда я запрашиваю /security.getAccessToken
get_access_token:
pattern: ^/security.getAccessToken
guard:
entry_point: App\Security\CreateAccessToken
# Вызывается каждый раз, когда я запрашиваю /security.checkAccessToken
check_access_token:
pattern: ^/security.checkAccessToken
guard:
entry_point: App\Security\CheckAccessToken
# Вызывается каждый раз, когда я запрашиваю любой другой роут
main:
guard:
entry_point: App\Security\TokenAuthenticator
class TokenAuthenticator implements AuthenticationEntryPointInterface
{
...
/**
* @param Request $request
* @param AuthenticationException|null $authException
* @return Response
* @throws EAuthorisationError
* @throws ExceptionInvalidRequest
*/
public function start(Request $request, AuthenticationException $authException = null)
{
if (!$this->supports($request)) {
throw new ExceptionInvalidRequest("Требуется параметр [token]!", $request);
}
$credentials = $this->getCredentials($request);
if ($this->verification($credentials["token"])) {
return new Response(params);
}
throw new EAuthorisationError("Token is not valid!");
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question