Вход Регистрация
Файл: symfony-2.7/src/Symfony/Component/Security/Http/EntryPoint/BasicAuthenticationEntryPoint.php
Строк: 75
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace SymfonyComponentSecurityHttpEntryPoint;

use 
SymfonyComponentSecurityCoreExceptionAuthenticationException;
use 
SymfonyComponentHttpFoundationResponse;
use 
SymfonyComponentHttpFoundationRequest;

/**
 * BasicAuthenticationEntryPoint starts an HTTP Basic authentication.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class BasicAuthenticationEntryPoint implements AuthenticationEntryPointInterface
{
    private 
$realmName;

    public function 
__construct($realmName)
    {
        
$this->realmName $realmName;
    }

    
/**
     * {@inheritdoc}
     */
    
public function start(Request $requestAuthenticationException $authException null)
    {
        
$response = new Response();
        
$response->headers->set('WWW-Authenticate'sprintf('Basic realm="%s"'$this->realmName));
        
$response->setStatusCode(401);

        return 
$response;
    }
}
Онлайн: 0
Реклама