| Conditions | 4 |
| Paths | 4 |
| Total Lines | 34 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | public function getByEntityId($entityId) |
||
| 27 | { |
||
| 28 | $qb = $this->pool->getQueryBuilderForTable('tx_mksamlauth_domain_model_identityprovider'); |
||
| 29 | $qb->select('*'); |
||
| 30 | $qb->from('tx_mksamlauth_domain_model_identityprovider'); |
||
| 31 | $qb->where($qb->expr()->eq('idp_entity_id', '?')); |
||
| 32 | $qb->setMaxResults(1); |
||
| 33 | $qb->setParameters([$entityId]); |
||
| 34 | |||
| 35 | if (false === $stmt = $qb->execute()) { |
||
|
|
|||
| 36 | return null; |
||
| 37 | } |
||
| 38 | |||
| 39 | if (false === $row = $stmt->fetch()) { |
||
| 40 | return null; |
||
| 41 | } |
||
| 42 | |||
| 43 | $certificate = new X509Certificate(); |
||
| 44 | $certificate->loadPem($row['certificate']); |
||
| 45 | |||
| 46 | $privateKey = null; |
||
| 47 | if (0 < strlen($row['cert_key'])) { |
||
| 48 | $privateKey = KeyHelper::createPrivateKey( |
||
| 49 | $row['cert_key'], |
||
| 50 | $row['passphrase'], |
||
| 51 | false, |
||
| 52 | $certificate->getSignatureAlgorithm() |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | |||
| 56 | $credential = new X509Credential($certificate, $privateKey); |
||
| 57 | $credential->setEntityId($entityId); |
||
| 58 | |||
| 59 | return [$credential]; |
||
| 60 | } |
||
| 63 |