Passed
Push — main ( 1ee078...e7e8e3 )
by Michiel
26:57 queued 16:51
created

GssfMetadataController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 21
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A metadata() 0 13 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/**
6
 * Copyright 2023 SURFnet bv
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
20
21
namespace Surfnet\StepupSelfService\SelfServiceBundle\Controller\Registration\Gssf;
22
23
use Surfnet\SamlBundle\Http\XMLResponse;
24
use Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider\MetadataFactoryCollection;
25
use Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider\ProviderRepository;
26
use Surfnet\StepupSelfService\SelfServiceBundle\Service\ControllerCheckerService;
27
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
28
use Symfony\Component\Routing\Attribute\Route;
29
30
/**
31
 * Controls registration with Generic SAML Stepup Providers (GSSPs), yielding Generic SAML Second Factors (GSSFs).
32
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
33
final class GssfMetadataController extends AbstractController
34
{
35
    public function __construct(
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
36
        private readonly ProviderRepository        $providerRepository,
37
        private readonly MetadataFactoryCollection $metadataFactoryCollection,
38
        private readonly ControllerCheckerService $checkerService,
39
    ) {
40
    }
41
     #[Route(
0 ignored issues
show
Coding Style introduced by
Opening statement of multi-line function call not indented correctly; expected 4 spaces but found 5
Loading history...
42
         path: '/registration/gssf/{provider}/metadata',
43
         name: 'ss_registration_gssf_saml_metadata',
44
         methods: ['GET'],
45
     )]
46
    public function metadata(string $provider): XMLResponse
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function metadata()
Loading history...
47
    {
48
        $this->checkerService->assertSecondFactorEnabled($provider);
49
50
        $provider = $this->providerRepository->get($provider);
51
        $factory = $this->metadataFactoryCollection->getByIdentifier($provider->getName());
52
53
        return new XMLResponse($factory->generate()->__toString());
54
    }
55
}
56