Passed
Pull Request — main (#308)
by Paul
15:08 queued 08:20
created

TestAuthenticationRequestFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 37
rs 10
c 1
b 0
f 0
wmc 2
1
<?php
2
3
/**
4
 * Copyright 2017 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
 */
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...
18
19
namespace Surfnet\StepupSelfService\SelfServiceBundle\Service\TestSecondFactor;
20
21
use Surfnet\SamlBundle\Entity\IdentityProvider;
22
use Surfnet\SamlBundle\Entity\ServiceProvider;
23
use Surfnet\SamlBundle\SAML2\AuthnRequestFactory;
24
use Surfnet\StepupBundle\Value\Loa;
25
26
final readonly class TestAuthenticationRequestFactory
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_READONLY, expecting T_CLASS on line 26 at column 6
Loading history...
Coding Style introduced by
Missing doc comment for class TestAuthenticationRequestFactory
Loading history...
27
{
28
    public function __construct(private ServiceProvider $serviceProvider, private IdentityProvider $identityProvider)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
29
    {
30
    }
31
32
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $nameId should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $loa should have a doc-comment as per coding-style.
Loading history...
33
     *
34
     * @return \Surfnet\SamlBundle\SAML2\AuthnRequest
35
     */
36
    public function createSecondFactorTestRequest(string $nameId, Loa $loa)
37
    {
38
        $authenticationRequest = AuthnRequestFactory::createNewRequest(
39
            $this->serviceProvider,
40
            $this->identityProvider
41
        );
42
43
        $authenticationRequest->setSubject($nameId);
44
        $authenticationRequest->setAuthenticationContextClassRef((string) $loa);
45
46
        return $authenticationRequest;
47
    }
48
}
49