protected function execute(InputInterface $input, OutputInterface $output) { $clientId = $input->getArgument($this->clientId); $clientStorage = new ClientStorage(new RedisClient(null, 'dev', 6379), new RedisKeysManager()); if ($clientStorage->delete($clientId)) { $output->writeln('<info>Your client has been deleted successfully!</info>'); } else { $output->writeln('<error>Error when deleting the client...!</error>'); } }
protected function execute(InputInterface $input, OutputInterface $output) { $clientStorage = new ClientStorage(new RedisClient(null, 'dev', 6379), new RedisKeysManager()); if ($clients = $clientStorage->all()) { $output->writeln('<info>Your clients are: </info>'); foreach ($clients as $client) { $output->writeln('<info>Client ID: </info>' . $client->getClientId()); $output->writeln('<info>App Name: </info>' . $client->getName()); $output->writeln('-------------------------------------------------'); } } else { $output->writeln('<error>No available clients!</error>'); } }
protected function execute(InputInterface $input, OutputInterface $output) { $clientId = $input->getArgument($this->clientId); $password = $input->getArgument($this->password); $clientStorage = new ClientStorage(new RedisClient(null, 'dev', 6379), new RedisKeysManager()); $newSecret = $this->generateUuid(); if ($clientStorage->updateSecret($clientId, $newSecret, $password)) { $output->writeln('<info>Your client\'s secret has been updated!</info>'); $output->writeln('<info>Client Secret: </info>' . $newSecret); $output->writeln('-------------------------------------------------'); } else { $output->writeln('<error>Client ID or client\'s password do not match!</error>'); } }
protected function execute(InputInterface $input, OutputInterface $output) { $clientId = $input->getArgument($this->clientId); $clientStorage = new ClientStorage(new RedisClient(null, 'dev', 6379), new RedisKeysManager()); if ($password = $input->getOption($this->showSecret)) { $client = $clientStorage->read($clientId, $password); if ($client->getSecret()) { $output->writeln('<info>Your client\'s information are: </info>'); $output->writeln('<info>App Name: </info>' . $client->getName()); $output->writeln('<info>Client ID: </info>' . $client->getClientId()); $output->writeln('<info>Client Secret: </info>' . $client->getSecret()); } else { $output->writeln('<error>Your password is invalid!</error>'); } } else { if ($clientStorage->read($clientId)) { $output->writeln('<info>Your client\'s information are: </info>'); $output->writeln('<info>App Name: </info>' . $client->getName()); $output->writeln('<info>Client ID: </info>' . $client->getClientId()); } } }
protected function execute(InputInterface $input, OutputInterface $output) { $appName = $input->getArgument($this->name); $password = $input->getArgument($this->password); $redirectUri = $input->getArgument($this->redirectUri); $grantType = $input->getArgument($this->grantType); $clientStorage = new ClientStorage(new RedisClient(null, 'dev', 6379), new RedisKeysManager()); if ($client = $clientStorage->create($this->generateUuid(), $appName, $password, $this->generateUuid(), $redirectUri, $grantType)) { $output->writeln('<info>Your client has been generated successfully!</info>'); $output->writeln('<info>Client ID: </info>' . $client->getClientId()); $output->writeln('<info>Client Secret: </info>' . $client->getSecret()); } else { $output->writeln('<error>There was an error when creating your client...!</error>'); } }