1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the LightSAML-Core package. |
5
|
|
|
* |
6
|
|
|
* (c) Milos Tomic <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace LightSaml\Builder\Profile; |
13
|
|
|
|
14
|
|
|
use LightSaml\Build\Container\BuildContainerInterface; |
15
|
|
|
use LightSaml\Builder\Context\ProfileContextBuilder; |
16
|
|
|
|
17
|
|
|
abstract class AbstractProfileBuilder implements ProfileBuilderInterface |
18
|
|
|
{ |
19
|
|
|
/** @var BuildContainerInterface */ |
20
|
|
|
protected $container; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param BuildContainerInterface $buildContainer |
24
|
|
|
*/ |
25
|
3 |
|
public function __construct(BuildContainerInterface $buildContainer) |
26
|
|
|
{ |
27
|
3 |
|
$this->container = $buildContainer; |
28
|
3 |
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @return \LightSaml\Action\CompositeAction |
32
|
|
|
*/ |
33
|
3 |
|
public function buildAction() |
34
|
|
|
{ |
35
|
3 |
|
return $this->getActionBuilder()->build(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return \LightSaml\Context\Profile\ProfileContext |
40
|
|
|
*/ |
41
|
3 |
|
public function buildContext() |
42
|
|
|
{ |
43
|
3 |
|
$builder = new ProfileContextBuilder(); |
44
|
|
|
$builder |
45
|
3 |
|
->setProfileId($this->getProfileId()) |
46
|
3 |
|
->setRequest($this->container->getSystemContainer()->getRequest()) |
47
|
3 |
|
->setProfileRole($this->getProfileRole()) |
48
|
3 |
|
->setOwnEntityDescriptorProvider($this->container->getOwnContainer()->getOwnEntityDescriptorProvider()) |
49
|
|
|
; |
50
|
|
|
|
51
|
3 |
|
return $builder->build(); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
abstract protected function getProfileId(); |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
|
|
abstract protected function getProfileRole(); |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return \LightSaml\Builder\Action\ActionBuilderInterface |
66
|
|
|
*/ |
67
|
|
|
abstract protected function getActionBuilder(); |
68
|
|
|
} |
69
|
|
|
|