Skip to content

Commit

Permalink
bug #620 fix missing $config variable (Oliboy50, chalasr)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x-dev branch.

Discussion
----------

fix missing $config variable

Commits
-------

d05b54d fix test
43300af fix missing $config variable
  • Loading branch information
chalasr committed Feb 18, 2019
2 parents bc3239c + d05b54d commit bb38cf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions DependencyInjection/LexikJWTAuthenticationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ public function load(array $configs, ContainerBuilder $container)
$container->setParameter('lexik_jwt_authentication.public_key_path', $config['public_key']);
}

if (empty($config['public_key']) && empty(['secret_key'])) {
throw new InvalidConfigurationException('You must either configure a "public_key" or a "secret_key".', 'lexik_jwt_authentication');
if (empty($config['public_key']) && empty($config['secret_key'])) {
$e = new InvalidConfigurationException('You must either configure a "public_key" or a "secret_key".');
$e->setPath('lexik_jwt_authentication');

throw $e;

}

$container->setParameter('lexik_jwt_authentication.pass_phrase', $config['pass_phrase']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testDeprecatedDefaultEncoderService()
public function testTokenExtractorsConfiguration()
{
// Default configuration
$chainTokenExtractor = $this->getContainer()->getDefinition('lexik_jwt_authentication.extractor.chain_extractor');
$chainTokenExtractor = $this->getContainer(['secret_key' => 'private.pem', 'public_key' => 'public.pem'])->getDefinition('lexik_jwt_authentication.extractor.chain_extractor');

$extractorIds = array_map('strval', $chainTokenExtractor->getArgument(0));

Expand All @@ -83,7 +83,7 @@ public function testTokenExtractorsConfiguration()
$this->assertNotContains('lexik_jwt_authentication.extractor.query_parameter_extractor', $extractorIds);

// Custom configuration
$chainTokenExtractor = $this->getContainer(['token_extractors' => ['authorization_header' => true, 'cookie' => true]])
$chainTokenExtractor = $this->getContainer(['secret_key' => 'private.pem', 'public_key' => 'public.pem', 'token_extractors' => ['authorization_header' => true, 'cookie' => true]])
->getDefinition('lexik_jwt_authentication.extractor.chain_extractor');

$extractorIds = array_map('strval', $chainTokenExtractor->getArgument(0));
Expand Down

0 comments on commit bb38cf0

Please sign in to comment.