12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace Symfony\Component\Security\Http\EntryPoint;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\Security\Core\Exception\AuthenticationException;
- class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface
- {
- private $realmName;
- public function __construct($realmName)
- {
- $this->realmName = $realmName;
- }
-
- public function start(Request $request, AuthenticationException $authException = null)
- {
- $response = new Response();
- $response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realmName));
- $response->setStatusCode(401);
- return $response;
- }
- }
|