protected function execute(InputInterface $input, OutputInterface $output)
 {
     $helper = $this->getHelper('question');
     $accessTokenService = new AccessTokenService($this->getSlim());
     $accessTokenService->fetchTokens();
     $clientIds = [];
     foreach ($accessTokenService->getCursor() as $document) {
         $clientIds[] = $document->getClientId();
     }
     $question = new Question('Please enter the the client ID of the token you wish to delete: ');
     $question->setAutocompleterValues($clientIds);
     $clientId = $helper->ask($input, $output, $question);
     $question = new ConfirmationQuestion('Are you sure (y/n): ', false);
     if (!$helper->ask($input, $output, $question)) {
         return;
     }
     $accessTokenService->deleteToken($clientId);
     $output->writeln('<info>Supertoken successfully deleted!</info>');
 }
Ejemplo n.º 2
0
 public function delete()
 {
     $request = $this->getSlim()->request();
     // Check authentication
     $this->getSlim()->auth->checkPermission('super');
     // Do the validation - TODO!!!
     //$this->statementValidator->validateRequest($request);
     //$this->statementValidator->validatePutRequest($request);
     $this->accessTokenService->accessTokenDelete($request);
     Resource::response(Resource::STATUS_NO_CONTENT);
 }