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\StepupSelfService\SelfServiceBundle\Form\Type; |
20
|
|
|
|
21
|
|
|
use Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider\ViewConfig; |
22
|
|
|
use Symfony\Component\Form\AbstractType; |
23
|
|
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
24
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
25
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
26
|
|
|
use Symfony\Component\Routing\RouterInterface; |
27
|
|
|
|
28
|
|
|
class InitiateGssfType extends AbstractType |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @var RouterInterface |
32
|
|
|
*/ |
33
|
|
|
private $router; |
34
|
|
|
|
35
|
|
|
public function __construct(RouterInterface $router) |
36
|
|
|
{ |
37
|
|
|
$this->router = $router; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
41
|
|
|
{ |
42
|
|
|
$action = $this->router->generate('ss_registration_gssf_authenticate', ['provider' => $options['provider']]); |
43
|
|
|
/** @var ViewConfig $secondFactorConfig */ |
44
|
|
|
$builder |
45
|
|
|
->add('submit', SubmitType::class, [ |
46
|
|
|
'attr' => ['class' => 'btn btn-primary'], |
47
|
|
|
/** @Ignore from translation message extraction */ |
48
|
|
|
'label' => $options['label'] |
49
|
|
|
]) |
50
|
|
|
->setAction($action); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function configureOptions(OptionsResolver $resolver) |
54
|
|
|
{ |
55
|
|
|
$resolver->setRequired(['provider']); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function getBlockPrefix() |
59
|
|
|
{ |
60
|
|
|
return 'ss_initiate_gssf'; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|