-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] removed usage of the deprecated SecurityContextInterface #13323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -11,6 +11,8 @@ | |||
|
|||
namespace Symfony\Component\Security\Core; | |||
|
|||
trigger_error('The '.__NAMESPACE__.'\SecurityContext method is deprecated since version 2.6 and will be removed in 3.0.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method should be class, right?
6246890
to
d80c75a
Compare
d80c75a
to
2c888e0
Compare
Tests do not pass for lower/higher because SecurityBundle tests need a 2.7 version of |
ping @symfony/deciders |
/** | ||
* @param SecurityContextInterface|TokenStorageInterface | ||
* | ||
* Passing a SecurityContextInterface as a first argument was deprecated in 2.7 and will be removed in 3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we not trigger a deprecation warning when the argument is a SecurityContextInterface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually you can remove all these warning statements in the phpdoc because as I said below SecurityContextInterface extends TokenStorageInterface
. so this warning is irrelevant and we also dont need to trigger a deprecation warning in code (because that would already be done when people use the a class based on securitycontext).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
2c888e0
to
df25713
Compare
*/ | ||
public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) | ||
public function __construct($tokenStorage, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest forcing symfony/security-http
to use symfony/security-core
2.6+ and typehinting the TokenStorageInterface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deps is already on 2.6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then it is OK to typehint the new interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
df25713
to
5f20448
Compare
@@ -88,8 +90,6 @@ public function getToken() | |||
*/ | |||
public function setToken(TokenInterface $token = null) | |||
{ | |||
trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::setToken() method instead.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you forgot getToken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, fixed
*/ | ||
public function __construct(SecurityContextInterface $context = null) | ||
public function __construct($securityChecker = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should use the new interface as typehint too
57c0388
to
966cac7
Compare
@@ -17,7 +17,7 @@ | |||
], | |||
"require": { | |||
"php": ">=5.3.3", | |||
"symfony/security-csrf": "~2.4|~3.0.0", | |||
"symfony/security-csrf": "~2.6|~3.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the dev requirement for other parts of the security component should also be bumped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
The whole PR should be reviewed again as I've changed much more than before now that all type hints have been changed. ping @symfony/deciders |
966cac7
to
ba71b68
Compare
👍 |
…textInterface (fabpot) This PR was merged into the 2.7 branch. Discussion ---------- [Security] removed usage of the deprecated SecurityContextInterface | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a This PR removed internal usage of SecurityContextInterface in favor of the new alternatives, it also fixes removes as many deprecation notices as possible for the Security component. Commits ------- ba71b68 added type-hint 91d01d8 [Security] removed usage of the deprecated SecurityContextInterface
This PR removed internal usage of SecurityContextInterface in favor of the new alternatives, it also fixes removes as many deprecation notices as possible for the Security component.