-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Inherit private Exception from OCP to fix class hierarchy #42577
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
Fix regression of authentication workflow because class hierarchy changed when moving Exception to OCP Signed-off-by: Côme Chilliet <[email protected]>
And always throw OC versions for BC Signed-off-by: Côme Chilliet <[email protected]>
| if ($token->getUID() !== $this->uid) { | ||
| throw new InvalidTokenException('This token does not belong to you!'); | ||
| /* We have to throw the OC version so both OC and OCP catches catch it */ | ||
| throw new OcInvalidTokenException('This token does not belong to you!'); |
Check notice
Code scanning / Psalm
DeprecatedClass
| $token = $this->tokenProvider->getToken($password); | ||
| if ($token->getLoginName() !== $user) { | ||
| throw new InvalidTokenException('login name does not match'); | ||
| throw new OcInvalidTokenException('login name does not match'); |
Check notice
Code scanning / Psalm
DeprecatedClass
| $token = \OC::$server->get(\OC\Authentication\Token\IProvider::class)->getToken($password); | ||
| if ($token->getLoginName() !== $user) { | ||
| throw new InvalidTokenException('login name does not match'); | ||
| throw new OcInvalidTokenException('login name does not match'); |
Check notice
Code scanning / Psalm
DeprecatedClass
nickvergessen
left a comment
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.
Blocking this as I prefer #42640
|
Replaced by #42640 |
Fix regression of authentication workflow because class hierarchy changed when moving Exception to OCP
Summary
27:
graph BT; \OC\ExpiredTokenException --> \OC\InvalidTokenException \OC\WipeTokenException --> \OC\InvalidTokenException \OC\InvalidTokenException --> \Exception28:
graph BT; \OC\ExpiredTokenException --> \OCP\ExpiredTokenException \OC\WipeTokenException --> \OCP\WipeTokenException \OC\InvalidTokenException --> \OCP\InvalidTokenException \OCP\ExpiredTokenException --> \OCP\InvalidTokenException \OCP\WipeTokenException --> \OCP\InvalidTokenException \OCP\InvalidTokenException --> \ExceptionThis PR:
graph BT; \OC\ExpiredTokenException --> \OCP\ExpiredTokenException \OC\WipeTokenException --> \OCP\WipeTokenException \OC\InvalidTokenException --> \OCP\InvalidTokenException \OCP\ExpiredTokenException --> \OC\InvalidTokenException \OCP\WipeTokenException --> \OC\InvalidTokenException \OCP\InvalidTokenException --> \ExceptionIt is a bit sad to reference
OCfromOCPbut I am not sure we have a better solution here to restore backward compatibility of the API. We should still move all code to using theOCPnamespaced exceptions and remove theOCones when possible.Checklist