Passed
Pull Request — main (#308)
by Paul
12:52 queued 05:50
created

GssfMetadataController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 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 Psr\Log\LoggerInterface;
24
use Surfnet\SamlBundle\Http\XMLResponse;
25
use Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider\MetadataFactoryCollection;
26
use Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider\ProviderRepository;
27
use Surfnet\StepupSelfService\SelfServiceBundle\Controller\Controller;
28
use Surfnet\StepupSelfService\SelfServiceBundle\Service\InstitutionConfigurationOptionsService;
29
use Symfony\Component\Routing\Attribute\Route;
30
31
/**
32
 * Controls registration with Generic SAML Stepup Providers (GSSPs), yielding Generic SAML Second Factors (GSSFs).
33
 */
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...
34
final class GssfMetadataController extends Controller
35
{
36
    public function __construct(
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
37
        LoggerInterface           $logger,
38
        InstitutionConfigurationOptionsService     $configurationOptionsService,
39
        private readonly ProviderRepository        $providerRepository,
40
        private readonly MetadataFactoryCollection $metadataFactoryCollection,
41
    ) {
42
        parent::__construct($logger, $configurationOptionsService);
43
    }
44
     #[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...
45
        path: '/registration/gssf/{provider}/metadata',
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 9 spaces, but found 8.
Loading history...
46
        name: 'ss_registration_gssf_saml_metadata',
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 9 spaces, but found 8.
Loading history...
47
        methods: ['GET'],
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 9 spaces, but found 8.
Loading history...
48
    )]
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 5 spaces, but found 4.
Loading history...
49
    public function metadata(string $provider): XMLResponse
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function metadata()
Loading history...
50
    {
51
        $this->assertSecondFactorEnabled($provider);
52
53
        $provider = $this->providerRepository->get($provider);
54
        $factory = $this->metadataFactoryCollection->getByIdentifier($provider->getName());
55
56
        return new XMLResponse($factory->generate()->__toString());
57
    }
58
59
}
60