Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 70b49c7

Browse filesBrowse files
committed
Added a tests
1 parent ebfd6b2 commit 70b49c7
Copy full SHA for 70b49c7

File tree

5 files changed

+123
-0
lines changed
Filter options

5 files changed

+123
-0
lines changed
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
13+
14+
final class AnoynousTest extends AbstractWebTestCase
15+
{
16+
public function testAnonymous(): void
17+
{
18+
$client = $this->createClient(['test_case' => 'Anonymous', 'root_config' => 'config.yml']);
19+
20+
$client->request('GET', '/');
21+
22+
$this->assertSame(401, $client->getResponse()->getStatusCode());
23+
}
24+
}
+55Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AnonymousBundle;
13+
14+
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
16+
use Symfony\Component\Security\Core\Exception\AuthenticationException;
17+
use Symfony\Component\Security\Core\User\UserInterface;
18+
use Symfony\Component\Security\Core\User\UserProviderInterface;
19+
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
20+
21+
class AppCustomAuthenticator extends AbstractGuardAuthenticator
22+
{
23+
public function supports(Request $request)
24+
{
25+
return false;
26+
}
27+
28+
public function getCredentials(Request $request)
29+
{
30+
}
31+
32+
public function getUser($credentials, UserProviderInterface $userProvider)
33+
{
34+
}
35+
36+
public function checkCredentials($credentials, UserInterface $user)
37+
{
38+
}
39+
40+
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
41+
{
42+
}
43+
44+
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
45+
{
46+
}
47+
48+
public function start(Request $request, AuthenticationException $authException = null)
49+
{
50+
}
51+
52+
public function supportsRememberMe()
53+
{
54+
}
55+
}
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
return [
13+
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
14+
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
15+
];
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
framework:
2+
secret: test
3+
router: { resource: "%kernel.project_dir%/%kernel.test_case%/routing.yml" }
4+
validation: { enabled: true, enable_annotations: true }
5+
csrf_protection: true
6+
form: true
7+
test: ~
8+
default_locale: en
9+
session:
10+
storage_id: session.storage.mock_file
11+
profiler: { only_exceptions: false }
12+
13+
services:
14+
Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AnonymousBundle\AppCustomAuthenticator: ~
15+
16+
security:
17+
firewalls:
18+
secure:
19+
pattern: ^/
20+
anonymous: false
21+
stateless: true
22+
guard:
23+
authenticators:
24+
- Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AnonymousBundle\AppCustomAuthenticator
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
main:
2+
path: /
3+
defaults:
4+
_controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction
5+
path: /app

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.