public function SimpleOauthCommands::generateKeys in Simple OAuth (OAuth2) & OpenID Connect 5.x
Same name and namespace in other branches
- 8.4 src/Commands/SimpleOauthCommands.php \Drupal\simple_oauth\Commands\SimpleOauthCommands::generateKeys()
- 8.3 src/Commands/SimpleOauthCommands.php \Drupal\simple_oauth\Commands\SimpleOauthCommands::generateKeys()
Generate Oauth2 Keys.
@usage simple-oauth:generate-keys /var/www/drupal-example.org/keys Creates the keys in the /var/www/drupal-example.org/keys directory.
@command simple-oauth:generate-keys @aliases so:generate-keys, sogk
@validate-module-enabled simple_oauth
Parameters
string $keypath: The full path were the key files will be saved.
File
- src/
Commands/ SimpleOauthCommands.php, line 65
Class
- SimpleOauthCommands
- Drush commands for Simple OAuth.
Namespace
Drupal\simple_oauth\CommandsCode
public function generateKeys($keypath) {
if (!$this
->isDirectory($keypath)) {
$this->fileSystem
->mkdir($keypath);
}
$keys_path = $this->fileSystem
->realpath($keypath);
try {
$this->keygen
->generateKeys($keys_path);
$this
->logger()
->notice('Keys successfully generated at {path}.', [
'path' => $keypath,
]);
} catch (FilesystemValidationException $e) {
$this
->logger()
->error($e
->getMessage());
} catch (ExtensionNotLoadedException $e) {
$this
->logger()
->error($e
->getMessage());
}
}