GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AuthnRequest::isValid()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 9.584
c 0
b 0
f 0
cc 3
nc 2
nop 2
crap 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: dsmrt
5
 * Date: 1/10/18
6
 * Time: 11:23 AM
7
 */
8
9
namespace flipbox\saml\idp\services\messages;
10
11
use craft\base\Component;
12
use flipbox\saml\core\exceptions\InvalidMessage;
13
use flipbox\saml\core\helpers\MessageHelper;
14
use flipbox\saml\core\records\AbstractProvider;
15
use flipbox\saml\idp\records\ProviderRecord;
16
use flipbox\saml\idp\Saml;
17
use SAML2\AuthnRequest as SamlAuthnRequest;
18
use SAML2\Utils;
19
20
class AuthnRequest extends Component
21
{
22
23 2
    public function isValid(SamlAuthnRequest $authnRequest, AbstractProvider $serviceProvider)
24
    {
25
        //TODO validate Destination
26
27
        // Validate Signature
28 2
        $signingKey = $serviceProvider->signingXMLSecurityKey();
29
30 2
        if ($signingKey && ($sig = Utils::validateElement($authnRequest->toSignedXML()))) {
31 2
            $authnRequest->addValidator(
32
                [
33 2
                    Utils::class,
34
                    'validateSignature',
35
                ],
36 2
                $sig
37
            );
38
39 2
            $authnRequest->validate($signingKey);
40
        }
41
42 2
        return true;
43
    }
44
}
45