File tree Expand file tree Collapse file tree 5 files changed +123
-0
lines changed
src/Symfony/Bundle/SecurityBundle/Tests/Functional Expand file tree Collapse file tree 5 files changed +123
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ ];
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
1
+ main :
2
+ path : /
3
+ defaults :
4
+ _controller : Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction
5
+ path : /app
You can’t perform that action at this time.
0 commit comments