I want to retrieve the basic authentication credentials from Symfony's HttpFoundation component. A cursory look at the docs reveals nothing; is there a way I can do it?
(I'm using the HttpFoundation component in an application not based on the Symfony framework.)
The values of $_SERVER['PHP_AUTH_USER']
and $_SERVER['PHP_AUTH_PW']
can be accessed through an instance of Symfony\Component\HttpFoundation\Request
in the following manner:
$username = $request->headers->get('php-auth-user');
$password = $request->headers->get('php-auth-pw');