Skip to content

Commit

Permalink
Merge pull request #31 from alexsegura/passphrase
Browse files Browse the repository at this point in the history
Allow configuring private key passphrase.
  • Loading branch information
spideyfusion committed Mar 13, 2019
2 parents caa4c89 + 534acf0 commit f16ec67
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ private function createAuthorizationServerNode(): NodeDefinition
->isRequired()
->cannotBeEmpty()
->end()
->scalarNode('private_key_passphrase')
->info('Passphrase of the private key, if any')
->defaultValue(null)
->end()
->scalarNode('encryption_key')
->info("The string used as an encryption key.\nHow to generate an encryption key: https://oauth2.thephpleague.com/installation/#string-password")
->isRequired()
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/TrikoderOAuth2Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private function configureAuthorizationServer(ContainerBuilder $container, array
->getDefinition('league.oauth2.server.authorization_server')
->replaceArgument('$privateKey', new Definition(CryptKey::class, [
$config['private_key'],
null,
$config['private_key_passphrase'],
false,
]))
->replaceArgument('$encryptionKey', $config['encryption_key'])
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This package is currently in the active development.
```sh
composer require trikoder/oauth2-bundle --no-plugins --no-scripts
```

> **NOTE:** Due to required pre-configuration, this bundle is currently not compatible with [Symfony Flex](https://github.com/symfony/flex).

2. Create the bundle configuration file under `config/packages/trikoder_oauth2.yaml`. Here is a reference configuration file:
Expand All @@ -49,6 +49,9 @@ This package is currently in the active development.
# How to generate a private key: https://oauth2.thephpleague.com/installation/#generating-public-and-private-keys
private_key: # Required, Example: /var/oauth/private.key
# Passphrase of the private key, if any.
private_key_passphrase: ~ # Optional, default null
# The string used as an encryption key.
# How to generate an encryption key: https://oauth2.thephpleague.com/installation/#string-password
encryption_key: # Required
Expand Down Expand Up @@ -79,7 +82,7 @@ This package is currently in the active development.
# Name of the entity manager that you wish to use for managing clients and tokens.
entity_manager: default # Required
in_memory: ~
```

Expand Down

0 comments on commit f16ec67

Please sign in to comment.