Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be387ed

Browse files
committed
[Security] remove deprecated features
1 parent b777f42 commit be387ed

15 files changed

+37
-224
lines changed

src/Symfony/Component/Security/CHANGELOG.md

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

Lines 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

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

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

Lines 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

Lines 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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <[email protected]>
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
{

0 commit comments

Comments
 (0)