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 56be86a

Browse filesBrowse files
fancywebfabpot
authored andcommitted
[SecurityBundle] Deprecate public services to private
1 parent d7007d7 commit 56be86a
Copy full SHA for 56be86a

File tree

8 files changed

+36
-5
lines changed
Filter options

8 files changed

+36
-5
lines changed

‎UPGRADE-5.3.md

Copy file name to clipboardExpand all lines: UPGRADE-5.3.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ SecurityBundle
214214
use `security.password_hasher_factory` and `Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface` instead
215215
* Deprecate the `security.user_password_encoder.generic` service, the `security.password_encoder` and the `Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface` aliases,
216216
use `security.user_password_hasher`, `security.password_hasher` and `Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface` instead
217+
* Deprecate the public `security.authorization_checker` and `security.token_storage` services to private
217218

218219
Serializer
219220
----------

‎UPGRADE-6.0.md

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ SecurityBundle
300300
use `security.password_hasher_factory` and `Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface` instead
301301
* Remove the `security.user_password_encoder.generic` service, the `security.password_encoder` and the `Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface` aliases,
302302
use `security.user_password_hasher`, `security.password_hasher` and `Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface` instead
303+
* The `security.authorization_checker` and `security.token_storage` services are now private
303304

304305
Serializer
305306
----------

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/SecurityController.php
+20-4Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,32 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller;
1313

14-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
15-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
14+
use Psr\Container\ContainerInterface;
1615
use Symfony\Component\HttpFoundation\Response;
16+
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
17+
use Symfony\Contracts\Service\ServiceSubscriberInterface;
1718

18-
class SecurityController implements ContainerAwareInterface
19+
class SecurityController implements ServiceSubscriberInterface
1920
{
20-
use ContainerAwareTrait;
21+
private $container;
22+
23+
public function __construct(ContainerInterface $container)
24+
{
25+
$this->container = $container;
26+
}
2127

2228
public function profileAction()
2329
{
2430
return new Response('Welcome '.$this->container->get('security.token_storage')->getToken()->getUserIdentifier().'!');
2531
}
32+
33+
/**
34+
* {@inheritdoc}
35+
*/
36+
public static function getSubscribedServices(): array
37+
{
38+
return [
39+
'security.token_storage' => TokenStorageInterface::class,
40+
];
41+
}
2642
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Security/config.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Security/config.yml
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
imports:
22
- { resource: ./../config/default.yml }
33

4+
services:
5+
Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller\SecurityController:
6+
public: true
7+
tags:
8+
- container.service_subscriber
9+
410
security:
511
providers:
612
main:

‎src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ CHANGELOG
1616
use `security.password_hasher_factory` and `Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface` instead
1717
* Deprecate the `security.user_password_encoder.generic` service, the `security.password_encoder` and the `Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface` aliases,
1818
use `security.user_password_hasher`, `security.password_hasher` and `Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface` instead
19+
* Deprecate the public `security.authorization_checker` and `security.token_storage` services to private
1920

2021
5.2.0
2122
-----

‎src/Symfony/Bundle/SecurityBundle/Resources/config/security.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Resources/config/security.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
service('security.access.decision_manager'),
6969
param('security.access.always_authenticate_before_granting'),
7070
])
71+
->tag('container.private', ['package' => 'symfony/security-bundle', 'version' => '5.3'])
7172
->alias(AuthorizationCheckerInterface::class, 'security.authorization_checker')
7273

7374
->set('security.token_storage', UsageTrackingTokenStorage::class)
@@ -80,6 +81,7 @@
8081
])
8182
->tag('kernel.reset', ['method' => 'disableUsageTracking'])
8283
->tag('kernel.reset', ['method' => 'setToken'])
84+
->tag('container.private', ['package' => 'symfony/security-bundle', 'version' => '5.3'])
8385
->alias(TokenStorageInterface::class, 'security.token_storage')
8486

8587
->set('security.untracked_token_storage', TokenStorage::class)

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testServiceIsFunctional()
2828
// put a token into the storage so the final calls can function
2929
$user = new InMemoryUser('foo', 'pass');
3030
$token = new UsernamePasswordToken($user, '', 'provider', ['ROLE_USER']);
31-
$container->get('security.token_storage')->setToken($token);
31+
$container->get('security.token_storage.alias')->setToken($token);
3232

3333
$security = $container->get('functional_test.security.helper');
3434
$this->assertTrue($security->isGranted('ROLE_USER'));

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/SecurityHelper/config.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/SecurityHelper/config.yml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ services:
77
alias: security.helper
88
public: true
99

10+
functional.test.security.token_storage:
11+
alias: security.token_storage
12+
public: true
13+
1014
security:
1115
providers:
1216
in_memory:

0 commit comments

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