Skip to content

Commit fc8441a

Browse files
committed
Update SignatureKeyPairConfig
1 parent d291371 commit fc8441a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/ValueAbstracts/SignatureKeyPairConfig.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SignatureKeyPairConfig
1111
/**
1212
* @param \SimpleSAML\OpenID\Algorithms\SignatureAlgorithmEnum $signatureAlgorithm Signature algorithm
1313
* to use for signing JWTs.
14-
* @param \SimpleSAML\OpenID\ValueAbstracts\KeyPairFilenameConfig $keyPairConfig Key pair configuration to use for
14+
* @param \SimpleSAML\OpenID\ValueAbstracts\KeyPairConfigInterface $keyPairConfig Key pair configuration to use for
1515
* signing JWTs.
1616
*/
1717
public function __construct(
@@ -27,7 +27,7 @@ public function getSignatureAlgorithm(): SignatureAlgorithmEnum
2727
}
2828

2929

30-
public function getKeyPairConfig(): KeyPairFilenameConfig
30+
public function getKeyPairConfig(): KeyPairConfigInterface
3131
{
3232
return $this->keyPairConfig;
3333
}

src/ValueAbstracts/SignatureKeyPairConfigBag.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace SimpleSAML\OpenID\ValueAbstracts;
66

7+
use SimpleSAML\OpenID\Exceptions\OpenIdException;
8+
79
class SignatureKeyPairConfigBag
810
{
911
/**
@@ -69,4 +71,15 @@ public function getFirst(): ?SignatureKeyPairConfig
6971
{
7072
return $this->signatureKeyPairConfigs[array_key_first($this->signatureKeyPairConfigs)] ?? null;
7173
}
74+
75+
76+
/**
77+
* @throws \SimpleSAML\OpenID\Exceptions\OpenIdException
78+
*/
79+
public function getFirstOrFail(): SignatureKeyPairConfig
80+
{
81+
return $this->getFirst() ?? throw new OpenIdException(
82+
'Signature key pair config is not set.',
83+
);
84+
}
7285
}

0 commit comments

Comments
 (0)