3232namespace OCA \Settings \Controller ;
3333
3434use BadMethodCallException ;
35- use OC \Authentication \Exceptions \ExpiredTokenException ;
36- use OC \Authentication \Exceptions \InvalidTokenException ;
35+ use OC \Authentication \Exceptions \InvalidTokenException as OcInvalidTokenException ;
3736use OC \Authentication \Exceptions \PasswordlessTokenException ;
38- use OC \Authentication \Exceptions \WipeTokenException ;
3937use OC \Authentication \Token \INamedToken ;
4038use OC \Authentication \Token \IProvider ;
41- use OC \Authentication \Token \IToken ;
4239use OC \Authentication \Token \RemoteWipe ;
4340use OCA \Settings \Activity \Provider ;
4441use OCP \Activity \IManager ;
4542use OCP \AppFramework \Controller ;
4643use OCP \AppFramework \Http ;
4744use OCP \AppFramework \Http \JSONResponse ;
45+ use OCP \Authentication \Exceptions \ExpiredTokenException ;
46+ use OCP \Authentication \Exceptions \InvalidTokenException ;
47+ use OCP \Authentication \Exceptions \WipeTokenException ;
48+ use OCP \Authentication \Token \IToken ;
4849use OCP \IRequest ;
4950use OCP \ISession ;
5051use OCP \IUserSession ;
@@ -292,7 +293,8 @@ private function findTokenByIdAndUser(int $id): IToken {
292293 $ token = $ e ->getToken ();
293294 }
294295 if ($ token ->getUID () !== $ this ->uid ) {
295- throw new InvalidTokenException ('This token does not belong to you! ' );
296+ /** @psalm-suppress DeprecatedClass We have to throw the OC version so both OC and OCP catches catch it */
297+ throw new OcInvalidTokenException ('This token does not belong to you! ' );
296298 }
297299 return $ token ;
298300 }
@@ -305,7 +307,7 @@ private function findTokenByIdAndUser(int $id): IToken {
305307 * @param int $id
306308 * @return JSONResponse
307309 * @throws InvalidTokenException
308- * @throws \OC\Authentication\Exceptions\ ExpiredTokenException
310+ * @throws ExpiredTokenException
309311 */
310312 public function wipe (int $ id ): JSONResponse {
311313 if ($ this ->checkAppToken ()) {
0 commit comments