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 6a11506

Browse filesBrowse files
committed
[Security] remove deprecated features
1 parent b777f42 commit 6a11506
Copy full SHA for 6a11506

16 files changed

+40
-227
lines changed

‎src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
namespace Symfony\Bundle\SecurityBundle\DataCollector;
1313

1414
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
15+
use Symfony\Component\Security\Core\Role\Role;
1516
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
1617
use Symfony\Component\HttpFoundation\Request;
1718
use Symfony\Component\HttpFoundation\Response;
1819
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
1920
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
20-
use Symfony\Component\Security\Core\Role\RoleInterface;
2121
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
2222
use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface;
2323
use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager;
@@ -117,8 +117,8 @@ public function collect(Request $request, Response $response, \Exception $except
117117
'token_class' => $this->hasVarDumper ? new ClassStub(get_class($token)) : get_class($token),
118118
'logout_url' => $logoutUrl,
119119
'user' => $token->getUsername(),
120-
'roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $assignedRoles),
121-
'inherited_roles' => array_map(function (RoleInterface $role) { return $role->getRole(); }, $inheritedRoles),
120+
'roles' => array_map(function (Role $role) { return $role->getRole(); }, $assignedRoles),
121+
'inherited_roles' => array_map(function (Role $role) { return $role->getRole(); }, $inheritedRoles),
122122
'supports_role_hierarchy' => null !== $this->roleHierarchy,
123123
);
124124
}

‎src/Symfony/Component/Security/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/CHANGELOG.md
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
CHANGELOG
22
=========
33

4+
4.0.0
5+
-----
6+
7+
* The `AbstractFormLoginAuthenticator::onAuthenticationSuccess()` was removed.
8+
You should implement this method yourself in your concrete authenticator.
9+
* removed the `AccessDecisionManager::setVoters()` method
10+
* removed the `RoleInterface`
11+
* added a sixth `$context` argument to the `LogoutUrlGenerator::registerListener()`
12+
method
13+
414
3.3.0
515
-----
616

‎src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Security\Core\Authentication\Token;
1313

14-
use Symfony\Component\Security\Core\Role\RoleInterface;
1514
use Symfony\Component\Security\Core\Role\Role;
1615
use Symfony\Component\Security\Core\User\UserInterface;
1716
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
@@ -33,7 +32,7 @@ abstract class AbstractToken implements TokenInterface
3332
/**
3433
* Constructor.
3534
*
36-
* @param (RoleInterface|string)[] $roles An array of roles
35+
* @param (Role|string)[] $roles An array of roles
3736
*
3837
* @throws \InvalidArgumentException
3938
*/
@@ -42,8 +41,8 @@ public function __construct(array $roles = array())
4241
foreach ($roles as $role) {
4342
if (is_string($role)) {
4443
$role = new Role($role);
45-
} elseif (!$role instanceof RoleInterface) {
46-
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or RoleInterface instances, but got %s.', gettype($role)));
44+
} elseif (!$role instanceof Role) {
45+
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or Role instances, but got %s.', gettype($role)));
4746
}
4847

4948
$this->roles[] = $role;

‎src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ class PreAuthenticatedToken extends AbstractToken
2424
/**
2525
* Constructor.
2626
*
27-
* @param string|object $user The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string
28-
* @param mixed $credentials The user credentials
29-
* @param string $providerKey The provider key
30-
* @param (RoleInterface|string)[] $roles An array of roles
27+
* @param string|object $user The user can be a UserInterface instance, or an object implementing a __toString method or the username as a regular string
28+
* @param mixed $credentials The user credentials
29+
* @param string $providerKey The provider key
30+
* @param (Role|string)[] $roles An array of roles
3131
*/
3232
public function __construct($user, $credentials, $providerKey, array $roles = array())
3333
{

‎src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Core\Authentication\Token;
1313

14-
use Symfony\Component\Security\Core\Role\RoleInterface;
14+
use Symfony\Component\Security\Core\Role\Role;
1515

1616
/**
1717
* TokenInterface is the interface for the user authentication information.
@@ -33,7 +33,7 @@ public function __toString();
3333
/**
3434
* Returns the user roles.
3535
*
36-
* @return RoleInterface[] An array of RoleInterface instances
36+
* @return Role[] An array of Role instances
3737
*/
3838
public function getRoles();
3939

‎src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ class UsernamePasswordToken extends AbstractToken
2424
/**
2525
* Constructor.
2626
*
27-
* @param string|object $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method
28-
* @param string $credentials This usually is the password of the user
29-
* @param string $providerKey The provider key
30-
* @param (RoleInterface|string)[] $roles An array of roles
27+
* @param string|object $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method
28+
* @param string $credentials This usually is the password of the user
29+
* @param string $providerKey The provider key
30+
* @param (Role|string)[] $roles An array of roles
3131
*
3232
* @throws \InvalidArgumentException
3333
*/

‎src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,6 @@ public function __construct($voters = array(), $strategy = self::STRATEGY_AFFIRM
5252
$this->allowIfEqualGrantedDeniedDecisions = (bool) $allowIfEqualGrantedDeniedDecisions;
5353
}
5454

55-
/**
56-
* Configures the voters.
57-
*
58-
* @param VoterInterface[] $voters An array of VoterInterface instances
59-
*
60-
* @deprecated since version 3.3, to be removed in 4.0. Pass the voters to the constructor instead.
61-
*/
62-
public function setVoters(array $voters)
63-
{
64-
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Pass the voters to the constructor instead.', __METHOD__), E_USER_DEPRECATED);
65-
66-
$this->voters = $voters;
67-
}
68-
6955
/**
7056
* {@inheritdoc}
7157
*/

‎src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/DebugAccessDecisionManager.php
-36Lines changed: 0 additions & 36 deletions
This file was deleted.

‎src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/TraceableAccessDecisionManager.php
-17Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,6 @@ public function decide(TokenInterface $token, array $attributes, $object = null)
6060
return $result;
6161
}
6262

63-
/**
64-
* {@inheritdoc}
65-
*
66-
* @deprecated since version 3.3, to be removed in 4.0. Pass voters to the decorated AccessDecisionManager instead.
67-
*/
68-
public function setVoters(array $voters)
69-
{
70-
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Pass voters to the decorated AccessDecisionManager instead.', __METHOD__), E_USER_DEPRECATED);
71-
72-
if (!method_exists($this->manager, 'setVoters')) {
73-
return;
74-
}
75-
76-
$this->voters = $voters;
77-
$this->manager->setVoters($voters);
78-
}
79-
8063
/**
8164
* @return string
8265
*/

‎src/Symfony/Component/Security/Core/Authorization/Voter/RoleVoter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/Voter/RoleVoter.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\Security\Core\Authorization\Voter;
1313

1414
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
15-
use Symfony\Component\Security\Core\Role\RoleInterface;
15+
use Symfony\Component\Security\Core\Role\Role;
1616

1717
/**
1818
* RoleVoter votes if any attribute starts with a given prefix.
@@ -42,7 +42,7 @@ public function vote(TokenInterface $token, $subject, array $attributes)
4242
$roles = $this->extractRoles($token);
4343

4444
foreach ($attributes as $attribute) {
45-
if ($attribute instanceof RoleInterface) {
45+
if ($attribute instanceof Role) {
4646
$attribute = $attribute->getRole();
4747
}
4848

‎src/Symfony/Component/Security/Core/Role/Role.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Role/Role.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <fabien@symfony.com>
1818
*/
19-
class Role implements RoleInterface
19+
class Role
2020
{
2121
private $role;
2222

@@ -31,7 +31,9 @@ public function __construct($role)
3131
}
3232

3333
/**
34-
* {@inheritdoc}
34+
* Returns a string representation of the role.
35+
*
36+
* @return string
3537
*/
3638
public function getRole()
3739
{

‎src/Symfony/Component/Security/Core/Role/RoleHierarchyInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Role/RoleHierarchyInterface.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ interface RoleHierarchyInterface
2424
* Reachable roles are the roles directly assigned but also all roles that
2525
* are transitively reachable from them in the role hierarchy.
2626
*
27-
* @param RoleInterface[] $roles An array of directly assigned roles
27+
* @param Role[] $roles An array of directly assigned roles
2828
*
29-
* @return RoleInterface[] An array of all reachable roles
29+
* @return Role[] An array of all reachable roles
3030
*/
3131
public function getReachableRoles(array $roles);
3232
}

‎src/Symfony/Component/Security/Core/Role/RoleInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Role/RoleInterface.php
-37Lines changed: 0 additions & 37 deletions
This file was deleted.

‎src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php
-33Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
1616
use Symfony\Component\HttpFoundation\RedirectResponse;
1717
use Symfony\Component\HttpFoundation\Request;
18-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1918
use Symfony\Component\Security\Core\Exception\AuthenticationException;
2019
use Symfony\Component\Security\Core\Security;
2120
use Symfony\Component\Security\Http\Util\TargetPathTrait;
@@ -55,38 +54,6 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
5554
return new RedirectResponse($url);
5655
}
5756

58-
/**
59-
* Override to change what happens after successful authentication.
60-
*
61-
* @param Request $request
62-
* @param TokenInterface $token
63-
* @param string $providerKey
64-
*
65-
* @return RedirectResponse
66-
*/
67-
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
68-
{
69-
@trigger_error(sprintf('The AbstractFormLoginAuthenticator::onAuthenticationSuccess() implementation was deprecated in Symfony 3.1 and will be removed in Symfony 4.0. You should implement this method yourself in %s and remove getDefaultSuccessRedirectUrl().', get_class($this)), E_USER_DEPRECATED);
70-
71-
if (!method_exists($this, 'getDefaultSuccessRedirectUrl')) {
72-
throw new \Exception(sprintf('You must implement onAuthenticationSuccess() or getDefaultSuccessRedirectUrl() in %s.', get_class($this)));
73-
}
74-
75-
$targetPath = null;
76-
77-
// if the user hit a secure page and start() was called, this was
78-
// the URL they were on, and probably where you want to redirect to
79-
if ($request->getSession() instanceof SessionInterface) {
80-
$targetPath = $this->getTargetPath($request->getSession(), $providerKey);
81-
}
82-
83-
if (!$targetPath) {
84-
$targetPath = $this->getDefaultSuccessRedirectUrl();
85-
}
86-
87-
return new RedirectResponse($targetPath);
88-
}
89-
9057
public function supportsRememberMe()
9158
{
9259
return true;

0 commit comments

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