summaryrefslogtreecommitdiffstats
path: root/apps/oauth2/lib/Controller/SettingsController.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/oauth2/lib/Controller/SettingsController.php')
-rw-r--r--apps/oauth2/lib/Controller/SettingsController.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/oauth2/lib/Controller/SettingsController.php b/apps/oauth2/lib/Controller/SettingsController.php
index 1d376694f5a..f9ded6c0968 100644
--- a/apps/oauth2/lib/Controller/SettingsController.php
+++ b/apps/oauth2/lib/Controller/SettingsController.php
@@ -21,6 +21,8 @@
namespace OCA\OAuth2\Controller;
+use OC\Authentication\Token\DefaultTokenMapper;
+use OCA\OAuth2\Db\AccessTokenMapper;
use OCA\OAuth2\Db\Client;
use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Controller;
@@ -36,6 +38,10 @@ class SettingsController extends Controller {
private $clientMapper;
/** @var ISecureRandom */
private $secureRandom;
+ /** @var AccessTokenMapper */
+ private $accessTokenMapper;
+ /** @var DefaultTokenMapper */
+ private $defaultTokenMapper;
const validChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
@@ -45,16 +51,23 @@ class SettingsController extends Controller {
* @param IURLGenerator $urlGenerator
* @param ClientMapper $clientMapper
* @param ISecureRandom $secureRandom
+ * @param AccessTokenMapper $accessTokenMapper
+ * @param DefaultTokenMapper $defaultTokenMapper
*/
public function __construct($appName,
IRequest $request,
IURLGenerator $urlGenerator,
ClientMapper $clientMapper,
- ISecureRandom $secureRandom) {
+ ISecureRandom $secureRandom,
+ AccessTokenMapper $accessTokenMapper,
+ DefaultTokenMapper $defaultTokenMapper
+ ) {
parent::__construct($appName, $request);
$this->urlGenerator = $urlGenerator;
$this->secureRandom = $secureRandom;
$this->clientMapper = $clientMapper;
+ $this->accessTokenMapper = $accessTokenMapper;
+ $this->defaultTokenMapper = $defaultTokenMapper;
}
/**
@@ -78,8 +91,9 @@ class SettingsController extends Controller {
* @return RedirectResponse
*/
public function deleteClient($id) {
- $client = new Client();
- $client->setId($id);
+ $client = $this->clientMapper->getByUid($id);
+ $this->accessTokenMapper->deleteByClientId($id);
+ $this->defaultTokenMapper->deleteByName($client->getName());
$this->clientMapper->delete($client);
return new RedirectResponse($this->urlGenerator->getAbsoluteURL('/index.php/settings/admin/security'));
}