Conditions | 5 |
Paths | 4 |
Total Lines | 29 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
22 | public function getFirstAssertion(\LightSaml\Model\Protocol\Response $response) |
||
23 | { |
||
24 | |||
25 | $ownProvider = Saml::getInstance()->getProvider()->findOwn(); |
||
26 | |||
27 | if ($ownProvider->keychain && |
||
28 | $response->getFirstEncryptedAssertion() && |
||
29 | $this->isAssertionDecrypted === false |
||
30 | ) { |
||
31 | Saml::getInstance()->getResponse()->decryptAssertions( |
||
32 | $response, |
||
33 | $ownProvider->keychain |
||
34 | ); |
||
35 | /** |
||
36 | * try to only do this once |
||
37 | */ |
||
38 | $this->isAssertionDecrypted = true; |
||
39 | } |
||
40 | |||
41 | $assertions = $response->getAllAssertions(); |
||
42 | |||
43 | if (! isset($assertions[0])) { |
||
44 | throw new InvalidMessage("Invalid message. No assertions found in response."); |
||
45 | } |
||
46 | /** |
||
47 | * Just grab the first one for now. |
||
48 | */ |
||
49 | return $assertions[0]; |
||
50 | } |
||
51 | } |
||
52 |