Skip to content

Commit e99b440

Browse files
committed
Replace static calls with non-static ones
1 parent 717c0ad commit e99b440

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/SAML2/HTTPArtifact.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use SimpleSAML\Configuration;
99
use SimpleSAML\Metadata\MetaDataStorageHandler;
1010
use SimpleSAML\Module\saml\Message as MSG;
11-
use SimpleSAML\Store;
12-
use SimpleSAML\Utils\HTTP;
11+
use SimpleSAML\Store\StoreFactory;
12+
use SimpleSAML\Utils;
1313

1414
use SAML2\Utilities\Temporal;
1515
use SAML2\XML\saml\Issuer;
@@ -38,7 +38,10 @@ class HTTPArtifact extends Binding
3838
public function getRedirectURL(Message $message) : string
3939
{
4040
/** @psalm-suppress UndefinedClass */
41-
$store = Store::getInstance();
41+
$config = Configuration::getInstance();
42+
43+
/** @psalm-suppress UndefinedClass */
44+
$store = StoreFactory::getInstance($config->getString('store.type'));
4245
if ($store === false) {
4346
throw new \Exception('Unable to send artifact without a datastore configured.');
4447
}
@@ -66,7 +69,7 @@ public function getRedirectURL(Message $message) : string
6669
if ($destination === null) {
6770
throw new \Exception('Cannot get redirect URL, no destination set in the message.');
6871
}
69-
$httpUtils = new HTTP();
72+
$httpUtils = new Utils\HTTP();
7073
return $httpUtils->addURLparameters($destination, $params);
7174
}
7275

src/SAML2/SOAPClient.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
use SAML2\Exception\InvalidArgumentException;
1313
use SAML2\Exception\UnparseableXmlException;
1414
use SimpleSAML\Configuration;
15-
use SimpleSAML\Utils\Config;
16-
use SimpleSAML\Utils\Crypto;
15+
use SimpleSAML\Utils;
1716
//use SoapClient as BuiltinSoapClient;
1817
use SOAP_1_1;
1918

@@ -58,17 +57,20 @@ public function send(Message $msg, Configuration $srcMetadata, Configuration $ds
5857
if ($srcMetadata->hasValue('saml.SOAPClient.certificate')) {
5958
$cert = $srcMetadata->getValue('saml.SOAPClient.certificate');
6059
if ($cert !== false) {
61-
$ctxOpts['ssl']['local_cert'] = Config::getCertPath(
60+
$configUtils = new Utils\Config();
61+
$ctxOpts['ssl']['local_cert'] = $configUtils->getCertPath(
6262
$srcMetadata->getString('saml.SOAPClient.certificate')
6363
);
6464
if ($srcMetadata->hasValue('saml.SOAPClient.privatekey_pass')) {
6565
$ctxOpts['ssl']['passphrase'] = $srcMetadata->getString('saml.SOAPClient.privatekey_pass');
6666
}
6767
}
6868
} else {
69+
$cryptoUtils = new Utils\Crypto();
70+
6971
/* Use the SP certificate and privatekey if it is configured. */
70-
$privateKey = Crypto::loadPrivateKey($srcMetadata);
71-
$publicKey = Crypto::loadPublicKey($srcMetadata);
72+
$privateKey = $cryptoUtils->loadPrivateKey($srcMetadata);
73+
$publicKey = $cryptoUtils->loadPublicKey($srcMetadata);
7274
if ($privateKey !== null && $publicKey !== null && isset($publicKey['PEM'])) {
7375
$keyCertData = $privateKey['PEM'].$publicKey['PEM'];
7476
$file = $container->getTempDir().'/'.sha1($keyCertData).'.pem';

0 commit comments

Comments
 (0)