|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright 2014 SURFnet bv |
|
5
|
|
|
* |
|
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
7
|
|
|
* you may not use this file except in compliance with the License. |
|
8
|
|
|
* You may obtain a copy of the License at |
|
9
|
|
|
* |
|
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11
|
|
|
* |
|
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15
|
|
|
* See the License for the specific language governing permissions and |
|
16
|
|
|
* limitations under the License. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace Surfnet\StepupRa\RaBundle\Security\Factory; |
|
20
|
|
|
|
|
21
|
|
|
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; |
|
22
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeDefinition; |
|
23
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
24
|
|
|
use Symfony\Component\DependencyInjection\ChildDefinition; |
|
25
|
|
|
|
|
26
|
|
|
class SamlFactory implements SecurityFactoryInterface |
|
27
|
|
|
{ |
|
28
|
|
|
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint) |
|
29
|
|
|
{ |
|
30
|
|
|
$providerId = 'security.authentication.provider.saml.' . $id; |
|
31
|
|
|
$container->setDefinition( |
|
32
|
|
|
$providerId, |
|
33
|
|
|
new ChildDefinition('ra.security.authentication.provider.saml') |
|
34
|
|
|
); |
|
35
|
|
|
|
|
36
|
|
|
$listenerId = 'security.authentication.listener.saml.' . $id; |
|
37
|
|
|
$container->setDefinition( |
|
38
|
|
|
$listenerId, |
|
39
|
|
|
new ChildDefinition('ra.security.authentication.listener') |
|
40
|
|
|
); |
|
41
|
|
|
|
|
42
|
|
|
$cookieHandlerId = 'security.logout.handler.cookie_clearing.' . $id; |
|
43
|
|
|
$cookieHandler = $container->setDefinition( |
|
44
|
|
|
$cookieHandlerId, |
|
45
|
|
|
new ChildDefinition('security.logout.handler.cookie_clearing') |
|
46
|
|
|
); |
|
47
|
|
|
$cookieHandler->addArgument([]); |
|
48
|
|
|
|
|
49
|
|
|
return array($providerId, $listenerId, $defaultEntryPoint); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
public function getPosition() |
|
53
|
|
|
{ |
|
54
|
|
|
return 'pre_auth'; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getKey() |
|
58
|
|
|
{ |
|
59
|
|
|
return 'saml'; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function addConfiguration(NodeDefinition $builder) |
|
63
|
|
|
{ |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|