8000 Revert "Added a SecurityUserValueResolver for controllers" · symfony/symfony@03646d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 03646d8

Browse files
committed
Revert "Added a SecurityUserValueResolver for controllers"
This reverts commit d341889.
1 parent 194dcf3 commit 03646d8

File tree

13 files changed

+7
-206
lines changed

13 files changed

+7
-206
lines changed

UPGRADE-3.2.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
UPGRADE FROM 3.1 to 3.2
22
=======================
33

4-
FrameworkBundle
5-
---------------
6-
7-
* The `Controller::getUser()` method has been deprecated and will be removed in
8-
Symfony 4.0; typehint the security user object in the action instead.
9-
104
DependencyInjection
115
-------------------
126

UPGRADE-4.0.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ FrameworkBundle
117117
* The `framework.serializer.cache` option and the services
118118
`serializer.mapping.cache.apc` and `serializer.mapping.cache.doctrine.apc`
119119
have been removed. APCu should now be automatically used when available.
120- 8000
121-
* The `Controller::getUser()` method has been removed in favor of the ability
122-
to typehint the security user object in the action.
123120

124121
HttpKernel
125122
----------

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
CHANGELOG
22
=========
33

4-
3.2.0
5-
-----
6-
7-
* The `Controller::getUser()` method has been deprecated and will be removed in
8-
Symfony 4.0; typehint the security user object in the action instead.
9-
104
3.1.0
115
-----
126

src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2323
use Symfony\Component\HttpKernel\HttpKernelInterface;
2424
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
25-
use Symfony\Component\Security\Core\User\UserInterface;
2625
use Symfony\Component\Security\Csrf\CsrfToken;
2726
use Symfony\Component\Form\Extension\Core\Type\FormType;
2827
use Symfony\Component\Form\Form;
@@ -363,16 +362,12 @@ protected function getDoctrine()
363362
*
364363
* @return mixed
365364
*
366-
* @deprecated as of 3.2 and will be removed in 4.0. You can typehint your method argument with Symfony\Component\Security\Core\User\UserInterface instead.
367-
*
368365
* @throws \LogicException If SecurityBundle is not available
369366
*
370367
* @see TokenInterface::getUser()
371368
*/
372369
protected function getUser()
373370
{
374-
@trigger_error(sprintf('%s() is deprecated as of 3.2 and will be removed in 4.0. You can typehint your method argument with %s instead.', __METHOD__, UserInterface::class), E_USER_DEPRECATED);
375-
376371
if (!$this->container->has('security.token_storage')) {
377372
throw new \LogicException('The SecurityBundle is not registered in your application.');
378373
}

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ public function testForward()
5656
$this->assertEquals('xml--fr', $response->getContent());
5757
}
5858

59-
/**
60-
* @group legacy
61-
*/
6259
public function testGetUser()
6360
{
6461
$user = new User('user', 'pass');
@@ -70,9 +67,6 @@ public function testGetUser()
7067
$this->assertSame($controller->getUser(), $user);
7168
}
7269

73-
/**
74-
* @group legacy
75-
*/
7670
public function testGetUserAnonymousUserConvertedToNull()
7771
{
7872
$token = new AnonymousToken('default', 'anon.');
@@ -83,9 +77,6 @@ public function testGetUserAnonymousUserConvertedToNull()
8377
$this->assertNull($controller->getUser());
8478
}
8579

86-
/**
87-
* @group legacy
88-
*/
8980
public function testGetUserWithEmptyTokenStorage()
9081
{
9182
$controller = new TestController();
@@ -95,7 +86,6 @@ public function testGetUserWithEmptyTokenStorage()
9586
}
9687

9788
/**
98-
* @group legacy
9989
* @expectedException \LogicException
10090
* @expectedExceptionMessage The SecurityBundle is not registered in your application.
10191
*/

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
CHANGELOG
22
=========
33

4-
3.2.0
5-
-----
6-
7-
* Added the `SecurityUserValueResolver` to inject the security users in actions via
8-
`Symfony\Component\Security\Core\User\UserInterface` in the method signature.
9-
104
3.0.0
115
-----
126

src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
<service id="security.token_storage" class="Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage" />
2222

23-
<service id="security.user_value_resolver" class="Symfony\Bundle\SecurityBundle\SecurityUserValueResolver" public="false">
24-
<argument type="service" id="security.token_storage" />
25-
<tag name="controller.argument_value_resolver" priority="40" />
26-
</service>
27-
2823
<!-- Authentication related services -->
2924
<service id="security.authentication.manager" class="Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager" public="false">
3025
<argument type="collection" />

src/Symfony/Bundle/SecurityBundle/SecurityUserValueResolver.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
use Symfony\Component\HttpFoundation\Request;
1818
use Symfony\Component\HttpFoundation\Response;
1919
use Symfony\Component\Security\Core\Security;
20-
use Symfony\Component\Security\Core\User\UserInterface;
2120

2221
class LoginController implements ContainerAwareInterface
2322
{
2423
use ContainerAwareTrait;
2524

26-
public function loginAction(Request $request, UserInterface $user = null)
25+
public function loginAction(Request $request)
2726
{
2827
// get the login error if there is one
2928
if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) {
@@ -39,9 +38,9 @@ public function loginAction(Request $request, UserInterface $user = null)
3938
));
4039
}
4140

42-
public function afterLoginAction(UserInterface $user)
41+
public function afterLoginAction()
4342
{
44-
return $this->container->get('templating')->renderResponse('FormLoginBundle:Login:after_login.html.twig', array('user' => $user));
43+
return $this->container->get('templating')->renderResponse('FormLoginBundle:Login:after_login.html.twig');
4544
}
4645

4746
public function loginCheckAction()

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Resources/views/Login/after_login.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "::base.html.twig" %}
22

33
{% block body %}
4-
Hello {{ user.username }}!<br /><br />
4+
Hello {{ app.user.username }}!<br /><br />
55
You're browsing to path "{{ app.request.pathInfo }}".
66

77
<a href="{{ logout_path('default') }}">Log out</a>.

src/Symfony/Bundle/SecurityBundle/Tests/SecurityUserValueResolverTest.php

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=5.5.9",
2020
"symfony/security": "~3.1,>=3.1.2",
21-
"symfony/http-kernel": "~3.1",
21+
"symfony/http-kernel": "~2.8|~3.0",
2222
"symfony/polyfill-php70": "~1.0"
2323
},
2424
"require-dev": {
@@ -27,7 +27,7 @@
2727
"symfony/css-selector": "~2.8|~3.0",
2828
"symfony/dom-crawler": "~2.8|~3.0",
2929
"symfony/form": "~2.8|~3.0",
30-
"symfony/framework-bundle": "~3.1",
30+
"symfony/framework-bundle": "~2.8|~3.0",
3131
"symfony/http-foundation": "~2.8|~3.0",
3232
"symfony/security-acl": "~2.8|~3.0",
3333
"symfony/twig-bundle": "~2.8|~3.0",

src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/RequestValueResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class RequestValueResolver implements ArgumentValueResolverInterface
2727
*/
2828
public function supports(Request $request, ArgumentMetadata $argument)
2929
{
30-
return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class);
30+
return $argument->getType() === Request::class || is_subclass_of($argument->getType(), Request::class);
3131
}
3232

3333
/**

0 commit comments

Comments
 (0)
0