From 51a7e2b8ab1aceb04585f33319e4e377e208e6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Gallego?= Date: Fri, 4 Apr 2014 20:08:08 +0200 Subject: [PATCH] Also delete expired refresh and auth tokens --- .../Server/Controller/TokenController.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ZfrOAuth2Module/Server/Controller/TokenController.php b/src/ZfrOAuth2Module/Server/Controller/TokenController.php index c81e55b..e5f2910 100644 --- a/src/ZfrOAuth2Module/Server/Controller/TokenController.php +++ b/src/ZfrOAuth2Module/Server/Controller/TokenController.php @@ -52,7 +52,7 @@ public function tokenAction() { // Can't do anything if not HTTP request... if (!$this->request instanceof HttpRequest) { - return; + return null; } return $this->authorizationServer->handleTokenRequest($this->request); @@ -74,6 +74,14 @@ public function deleteExpiredTokensAction() $accessTokenService = $this->serviceLocator->get('ZfrOAuth2\Server\Service\AccessTokenService'); $accessTokenService->deleteExpiredTokens(); - return "\nExpired access tokens were properly deleted!\n\n"; + /* @var \ZfrOAuth2\Server\Service\TokenService $refreshTokenService */ + $refreshTokenService = $this->serviceLocator->get('ZfrOAuth2\Server\Service\RefreshTokenService'); + $refreshTokenService->deleteExpiredTokens(); + + /* @var \ZfrOAuth2\Server\Service\TokenService $authorizationCodeService */ + $authorizationCodeService = $this->serviceLocator->get('ZfrOAuth2\Server\Service\AuthorizationCodeService'); + $authorizationCodeService->deleteExpiredTokens(); + + return "\nExpired tokens were properly deleted!\n\n"; } }