Is there a way to access a route parameter from inside a custom authenticator with Guard?
In detail:
The instructions at https://symfony.com/doc/current/security/guard_authentication.html are submitting the API key as an HTTP header (X-AUTH-TOKEN
). But how can you access the API key, when it's being submitted as a route parameter instead (i.e. the {slug}
part of the route login/{slug}
)?
In other words: How can you access a route parameter from within TokenAuthenticator::getCredentials()
?
Thanks to https://stackoverflow.com/a/8630619/1668200 I found the answer myself:
$request->get('slug'));