| @@ 19-58 (lines=40) @@ | ||
| 16 | use Symfony\Component\DependencyInjection\Definition; |
|
| 17 | use Symfony\Component\DependencyInjection\Reference; |
|
| 18 | ||
| 19 | class JWKSet implements JWKSetSourceInterface |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 25 | { |
|
| 26 | $definition = new Definition('Jose\Object\JWKSet'); |
|
| 27 | $definition->setFactory([ |
|
| 28 | new Reference('jose.factory.jwk'), |
|
| 29 | 'createFromValues', |
|
| 30 | ]); |
|
| 31 | $definition->setArguments([ |
|
| 32 | json_decode($config['value'], true), |
|
| 33 | ]); |
|
| 34 | ||
| 35 | $container->setDefinition($id, $definition); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritdoc} |
|
| 40 | */ |
|
| 41 | public function getKeySet() |
|
| 42 | { |
|
| 43 | return 'jwkset'; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function addConfiguration(NodeDefinition $node) |
|
| 50 | { |
|
| 51 | $node |
|
| 52 | ->children() |
|
| 53 | ->scalarNode('value') |
|
| 54 | ->isRequired() |
|
| 55 | ->end() |
|
| 56 | ->end(); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| @@ 19-58 (lines=40) @@ | ||
| 16 | use Symfony\Component\DependencyInjection\Definition; |
|
| 17 | use Symfony\Component\DependencyInjection\Reference; |
|
| 18 | ||
| 19 | class JWK implements JWKSourceInterface |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 25 | { |
|
| 26 | $definition = new Definition('Jose\Object\JWK'); |
|
| 27 | $definition->setFactory([ |
|
| 28 | new Reference('jose.factory.jwk'), |
|
| 29 | 'createFromValues', |
|
| 30 | ]); |
|
| 31 | $definition->setArguments([ |
|
| 32 | json_decode($config['value'], true), |
|
| 33 | ]); |
|
| 34 | ||
| 35 | $container->setDefinition($id, $definition); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritdoc} |
|
| 40 | */ |
|
| 41 | public function getKey() |
|
| 42 | { |
|
| 43 | return 'jwk'; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function addConfiguration(NodeDefinition $node) |
|
| 50 | { |
|
| 51 | $node |
|
| 52 | ->children() |
|
| 53 | ->scalarNode('value') |
|
| 54 | ->isRequired() |
|
| 55 | ->end() |
|
| 56 | ->end(); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| @@ 19-58 (lines=40) @@ | ||
| 16 | use Symfony\Component\DependencyInjection\Definition; |
|
| 17 | use Symfony\Component\DependencyInjection\Reference; |
|
| 18 | ||
| 19 | class X5C implements JWKSourceInterface |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function create(ContainerBuilder $container, $id, array $config) |
|
| 25 | { |
|
| 26 | $definition = new Definition('Jose\Object\JWK'); |
|
| 27 | $definition->setFactory([ |
|
| 28 | new Reference('jose.factory.jwk'), |
|
| 29 | 'createFromCertificate', |
|
| 30 | ]); |
|
| 31 | $definition->setArguments([ |
|
| 32 | $config['value'], |
|
| 33 | ]); |
|
| 34 | ||
| 35 | $container->setDefinition($id, $definition); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritdoc} |
|
| 40 | */ |
|
| 41 | public function getKey() |
|
| 42 | { |
|
| 43 | return 'x5c'; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function addConfiguration(NodeDefinition $node) |
|
| 50 | { |
|
| 51 | $node |
|
| 52 | ->children() |
|
| 53 | ->scalarNode('value') |
|
| 54 | ->isRequired() |
|
| 55 | ->end() |
|
| 56 | ->end(); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||