|
@@ -5,6 +5,7 @@ namespace Base\OAuthBundle\Command;
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
+use Symfony\Component\Console\Input\InputOption;
|
|
|
|
|
|
class CreateOAuthClientCommand extends ContainerAwareCommand
|
|
class CreateOAuthClientCommand extends ContainerAwareCommand
|
|
{
|
|
{
|
|
@@ -15,7 +16,13 @@ class CreateOAuthClientCommand extends ContainerAwareCommand
|
|
->setName('oauth:client:create')
|
|
->setName('oauth:client:create')
|
|
->setDescription('Create OAuht client')
|
|
->setDescription('Create OAuht client')
|
|
->setHelp('This command allows you to create an OAuth client')
|
|
->setHelp('This command allows you to create an OAuth client')
|
|
- ;
|
|
|
|
|
|
+ ->addOption(
|
|
|
|
+ 'redirect_uri',
|
|
|
|
+ 'r',
|
|
|
|
+ InputOption::VALUE_REQUIRED,
|
|
|
|
+ 'OAuth Redirect URI',
|
|
|
|
+ 'http://127.0.0.1'
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -27,7 +34,7 @@ class CreateOAuthClientCommand extends ContainerAwareCommand
|
|
$clientManager = $this->getContainer()->get('fos_oauth_server.client_manager.default');
|
|
$clientManager = $this->getContainer()->get('fos_oauth_server.client_manager.default');
|
|
|
|
|
|
$client = $clientManager->createClient();
|
|
$client = $clientManager->createClient();
|
|
- $client->setRedirectUris(array('http://127.0.0.1'));
|
|
|
|
|
|
+ $client->setRedirectUris(array($input->getOption('redirect_uri')));
|
|
$client->setAllowedGrantTypes(array('password', 'token', 'authorization_code'));
|
|
$client->setAllowedGrantTypes(array('password', 'token', 'authorization_code'));
|
|
$clientManager->updateClient($client);
|
|
$clientManager->updateClient($client);
|
|
|
|
|