|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* The MIT License (MIT) |
|
7
|
|
|
* |
|
8
|
|
|
* Copyright (c) 2014-2018 Spomky-Labs |
|
9
|
|
|
* |
|
10
|
|
|
* This software may be modified and distributed under the terms |
|
11
|
|
|
* of the MIT license. See the LICENSE file for details. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Jose\Bundle\JoseFramework\DependencyInjection\Source\Encryption; |
|
15
|
|
|
|
|
16
|
|
|
use Jose\Bundle\JoseFramework\DependencyInjection\Source\Source; |
|
17
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeDefinition; |
|
18
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
19
|
|
|
|
|
20
|
|
|
abstract class AbstractEncryptionSource implements Source |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* {@inheritdoc} |
|
24
|
|
|
*/ |
|
25
|
|
|
public function getNodeDefinition(NodeDefinition $node) |
|
26
|
|
|
{ |
|
27
|
|
|
$node |
|
28
|
|
|
->children() |
|
29
|
|
|
->arrayNode($this->name()) |
|
30
|
|
|
->useAttributeAsKey('name') |
|
31
|
|
|
->arrayPrototype() |
|
32
|
|
|
->children() |
|
33
|
|
|
->booleanNode('is_public') |
|
34
|
|
|
->info('If true, the service will be public, else private.') |
|
35
|
|
|
->defaultTrue() |
|
36
|
|
|
->end() |
|
37
|
|
|
->arrayNode('key_encryption_algorithms') |
|
38
|
|
|
->info('A list of supported key encryption algorithms.') |
|
39
|
|
|
->useAttributeAsKey('name') |
|
40
|
|
|
->isRequired() |
|
41
|
|
|
->requiresAtLeastOneElement() |
|
42
|
|
|
->scalarPrototype()->end() |
|
43
|
|
|
->end() |
|
44
|
|
|
->arrayNode('content_encryption_algorithms') |
|
45
|
|
|
->info('A list of supported content encryption algorithms.') |
|
46
|
|
|
->useAttributeAsKey('name') |
|
47
|
|
|
->isRequired() |
|
48
|
|
|
->requiresAtLeastOneElement() |
|
49
|
|
|
->scalarPrototype()->end() |
|
50
|
|
|
->end() |
|
51
|
|
|
->arrayNode('compression_methods') |
|
52
|
|
|
->info('A list of supported compression methods.') |
|
53
|
|
|
->useAttributeAsKey('name') |
|
54
|
|
|
->defaultValue(['DEF']) |
|
55
|
|
|
->requiresAtLeastOneElement() |
|
56
|
|
|
->scalarPrototype()->end() |
|
57
|
|
|
->end() |
|
58
|
|
|
->arrayNode('tags') |
|
59
|
|
|
->info('A list of tags to be associated to the service.') |
|
60
|
|
|
->useAttributeAsKey('name') |
|
61
|
|
|
->treatNullLike([]) |
|
62
|
|
|
->treatFalseLike([]) |
|
63
|
|
|
->prototype('variable')->end() |
|
64
|
|
|
->end() |
|
65
|
|
|
->end() |
|
66
|
|
|
->end() |
|
67
|
|
|
->end() |
|
68
|
|
|
->end(); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* {@inheritdoc} |
|
73
|
|
|
*/ |
|
74
|
|
|
public function prepend(ContainerBuilder $container, array $config): array |
|
75
|
|
|
{ |
|
76
|
|
|
return []; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|