| @@ 19-62 (lines=44) @@ | ||
| 16 | use Symfony\Component\DependencyInjection\Definition; |
|
| 17 | use Symfony\Component\DependencyInjection\Reference; |
|
| 18 | ||
| 19 | class JKU 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.jwkset'), |
|
| 29 | 'createFromJKU', |
|
| 30 | ]); |
|
| 31 | $definition->setArguments([ |
|
| 32 | $config['url'], |
|
| 33 | $config['is_secured'], |
|
| 34 | ]); |
|
| 35 | ||
| 36 | $container->setDefinition($id, $definition); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | public function getKeySet() |
|
| 43 | { |
|
| 44 | return 'jku'; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * {@inheritdoc} |
|
| 49 | */ |
|
| 50 | public function addConfiguration(NodeDefinition $node) |
|
| 51 | { |
|
| 52 | $node |
|
| 53 | ->children() |
|
| 54 | ->scalarNode('url') |
|
| 55 | ->isRequired() |
|
| 56 | ->end() |
|
| 57 | ->booleanNode('is_secured') |
|
| 58 | ->defaultTrue() |
|
| 59 | ->end() |
|
| 60 | ->end(); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| @@ 19-62 (lines=44) @@ | ||
| 16 | use Symfony\Component\DependencyInjection\Definition; |
|
| 17 | use Symfony\Component\DependencyInjection\Reference; |
|
| 18 | ||
| 19 | class X5U 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.jwkset'), |
|
| 29 | 'createFromX5U', |
|
| 30 | ]); |
|
| 31 | $definition->setArguments([ |
|
| 32 | $config['url'], |
|
| 33 | $config['is_secured'], |
|
| 34 | ]); |
|
| 35 | ||
| 36 | $container->setDefinition($id, $definition); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | public function getKeySet() |
|
| 43 | { |
|
| 44 | return 'x5u'; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * {@inheritdoc} |
|
| 49 | */ |
|
| 50 | public function addConfiguration(NodeDefinition $node) |
|
| 51 | { |
|
| 52 | $node |
|
| 53 | ->children() |
|
| 54 | ->scalarNode('url') |
|
| 55 | ->isRequired() |
|
| 56 | ->end() |
|
| 57 | ->booleanNode('is_secured') |
|
| 58 | ->defaultTrue() |
|
| 59 | ->end() |
|
| 60 | ->end(); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| @@ 19-60 (lines=42) @@ | ||
| 16 | use Symfony\Component\DependencyInjection\Definition; |
|
| 17 | use Symfony\Component\DependencyInjection\Reference; |
|
| 18 | ||
| 19 | class Values 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 | $config['values'], |
|
| 33 | ]); |
|
| 34 | ||
| 35 | $container->setDefinition($id, $definition); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritdoc} |
|
| 40 | */ |
|
| 41 | public function getKey() |
|
| 42 | { |
|
| 43 | return 'values'; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * {@inheritdoc} |
|
| 48 | */ |
|
| 49 | public function addConfiguration(NodeDefinition $node) |
|
| 50 | { |
|
| 51 | $node |
|
| 52 | ->children() |
|
| 53 | ->arrayNode('values') |
|
| 54 | ->isRequired() |
|
| 55 | ->useAttributeAsKey('key') |
|
| 56 | ->prototype('variable')->end() |
|
| 57 | ->end() |
|
| 58 | ->end(); |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||