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 OAuth2Framework\Bundle\DependencyInjection\Component\Endpoint; |
15
|
|
|
|
16
|
|
|
use OAuth2Framework\Bundle\DependencyInjection\Component\Component; |
17
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeDefinition; |
18
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
19
|
|
|
|
20
|
|
|
final class AuthorizationEndpointRequestObjectEncryptionSource implements Component |
|
|
|
|
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* {@inheritdoc} |
24
|
|
|
*/ |
25
|
|
|
protected function continueLoading(string $path, ContainerBuilder $container, array $config) |
26
|
|
|
{ |
27
|
|
|
foreach (['required', 'key_encryption_algorithms', 'content_encryption_algorithms'] as $k) { |
28
|
|
|
$container->setParameter($path.'.'.$k, $config[$k]); |
29
|
|
|
} |
30
|
|
|
//$container->setAlias($path.'.key_set', 'jose.key_set.authorization_request_object.key_set.encryption'); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* {@inheritdoc} |
35
|
|
|
*/ |
36
|
|
|
public function name(): string |
37
|
|
|
{ |
38
|
|
|
return 'encryption'; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* {@inheritdoc} |
43
|
|
|
*/ |
44
|
|
|
public function getNodeDefinition(NodeDefinition $node) |
45
|
|
|
{ |
46
|
|
|
|
47
|
|
|
$node |
|
|
|
|
48
|
|
|
->children() |
49
|
|
|
->booleanNode('required') |
50
|
|
|
->info('If true, incoming request objects must be encrypted.') |
51
|
|
|
->defaultFalse() |
52
|
|
|
->end() |
53
|
|
|
->arrayNode('key_encryption_algorithms') |
54
|
|
|
->info('Supported key encryption algorithms.') |
55
|
|
|
->useAttributeAsKey('name') |
56
|
|
|
->prototype('scalar')->end() |
57
|
|
|
->treatNullLike([]) |
58
|
|
|
->end() |
59
|
|
|
->arrayNode('content_encryption_algorithms') |
60
|
|
|
->info('Supported content encryption algorithms.') |
61
|
|
|
->useAttributeAsKey('name') |
62
|
|
|
->prototype('scalar')->end() |
63
|
|
|
->treatNullLike([]) |
64
|
|
|
->end() |
65
|
|
|
->end(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* {@inheritdoc} |
70
|
|
|
*/ |
71
|
|
|
public function prepend(array $bundleConfig, string $path, ContainerBuilder $container) |
72
|
|
|
{ |
73
|
|
|
parent::prepend($bundleConfig, $path, $container); |
74
|
|
|
|
75
|
|
|
Assertion::keyExists($bundleConfig['key_set'], 'encryption', 'The encryption key set must be enabled.'); |
76
|
|
|
//ConfigurationHelper::addKeyset($container, 'authorization_request_object.key_set.encryption', 'jwkset', ['value' => $bundleConfig['key_set']['encryption']]); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|