Skip to content

Commit

Permalink
Enable substitution
Browse files Browse the repository at this point in the history
  • Loading branch information
romainneutron committed Jun 5, 2023
1 parent 5dc7a3d commit f279915
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public function getConfigTreeBuilder(): TreeBuilder
->min(0)
->defaultValue(1800)
->end()
->booleanNode('substitute')
->info('Substitute Lexik JWT encoder by the Jose one.')
->defaultValue(true)
->end()
->scalarNode('key_set')
->info('Private/Shared keys used by this server to validate signed tokens. Must be a JWKSet object.')
->end()
Expand Down
14 changes: 8 additions & 6 deletions DependencyInjection/SpomkyLabsLexikJoseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ public function prepend(ContainerBuilder $container): void
$this->enableEncryptionSupport($container, $bridgeConfig, $isDebug);
}

$lexikConfig = [
'encoder' => [
'service' => LexikJoseEncoder::class,
],
];
$container->prependExtensionConfig('lexik_jwt_authentication', $lexikConfig);
if ($bridgeConfig['substitute']) {
$lexikConfig = [
'encoder' => [
'service' => LexikJoseEncoder::class,
],
];
$container->prependExtensionConfig('lexik_jwt_authentication', $lexikConfig);
}
}

private function enableEncryptionSupport(ContainerBuilder $container, array $bridgeConfig, bool $isDebug): void
Expand Down

0 comments on commit f279915

Please sign in to comment.