я, наконец, нашел решение:
Вам необходимо переопределить это в parameters.yml В параметре:
security.authentication.basic_entry_point.class: NAMESAPCE\YOURCUSTOM_CLASS
И создать файл, в котором вы предпочитаете (я сделал это в MyBundle \ Security \ Http \ EntryPoint) выглядит следующим образом:
<?php
namespace NAMESAPCE;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\EntryPoint\BasicAuthenticationEntryPoint;
class CustomBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint
{
private $realmName;
public function __construct($realmName)
{
$this->realmName = 'XXX';
}
/**
* {@inheritdoc}
*/
public function start(Request $request, AuthenticationException $authException = null)
{
$response = new Response();
$response->headers->set('WWW-Authenticate', sprintf('myOwnBasic realm="%s"', $this->realmName));
$response->setStatusCode(401);
return $response;
}
}