diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php index 21c0da4728ba5ceb5ea23f57f7465d3cbd7b718a..f5a4b2d284e9cfc2424a980e01a8586346b7100a 100644 --- a/lib/SimpleSAML/Error/Error.php +++ b/lib/SimpleSAML/Error/Error.php @@ -269,7 +269,7 @@ class Error extends Exception call_user_func($show_function, $config, $data); Assert::true(false); } else { - $t = new Template($config, 'error.twig', 'errors'); + $t = new Template($config, 'error.twig'); // Include translations for the module that holds the included template if ($this->includeTemplate !== null) { diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php index eaa58c1230364c134eda0254e8f241ecac86d3ed..f8468dd03bc8d3da9163c872391019301226db99 100644 --- a/lib/SimpleSAML/Locale/Translate.php +++ b/lib/SimpleSAML/Locale/Translate.php @@ -37,13 +37,11 @@ class Translate * Constructor * * @param \SimpleSAML\Configuration $configuration Configuration object - * @param string|null $defaultDictionary The default dictionary where tags will come from. */ - public function __construct(Configuration $configuration, ?string $defaultDictionary = null) + public function __construct(Configuration $configuration) { $this->configuration = $configuration; $this->language = new Language($configuration); - $this->defaultDictionary = $defaultDictionary; } diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php index 39d475e8750ad9e25ca7f212a99be92bf965a4f6..5abcd97c39ea631ec3dac8273f05a1d297b758a6 100644 --- a/lib/SimpleSAML/XHTML/IdPDisco.php +++ b/lib/SimpleSAML/XHTML/IdPDisco.php @@ -587,7 +587,7 @@ class IdPDisco throw new \Exception('Invalid value for the \'idpdisco.layout\' option.'); } - $t = new Template($this->config, $templateFile, 'disco'); + $t = new Template($this->config, $templateFile); $newlist = []; foreach ($idpList as $entityid => $data) { diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 768e36bd00b337d753a8662fc30a0bd4dedb66ee..bb18d8f2c0d6e9ee0f01fae436d2a3b5484327d5 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -116,9 +116,8 @@ class Template extends Response * * @param \SimpleSAML\Configuration $configuration Configuration object * @param string $template Which template file to load - * @param string|null $defaultDictionary The default dictionary where tags will come from. */ - public function __construct(Configuration $configuration, string $template, string $defaultDictionary = null) + public function __construct(Configuration $configuration, string $template) { $this->configuration = $configuration; $this->template = $template; @@ -134,7 +133,7 @@ class Template extends Response ); // initialize internationalization system - $this->translator = new Translate($configuration, $defaultDictionary); + $this->translator = new Translate($configuration); $this->localization = new Localization($configuration); // check if we need to attach a theme controller diff --git a/modules/admin/lib/Controller/Test.php b/modules/admin/lib/Controller/Test.php index c74462d2dd91f5b69231195c1f647170accde0c3..44845142ce112d52414b2448a93807274c973416 100644 --- a/modules/admin/lib/Controller/Test.php +++ b/modules/admin/lib/Controller/Test.php @@ -145,7 +145,7 @@ class Test $nameId = $authsource->getAuthData('saml:sp:NameID') ?? false; $httpUtils = new Utils\HTTP(); - $t = new Template($this->config, 'admin:status.twig', 'attributes'); + $t = new Template($this->config, 'admin:status.twig'); $l = $t->getLocalization(); $l->addAttributeDomains(); $t->data = [ diff --git a/modules/core/lib/Controller/Login.php b/modules/core/lib/Controller/Login.php index 50a4f3cb0d86d7f462224afaca6b7e598b735af6..db4f724b7c72eac62cbc208454a03554f9fc6d82 100644 --- a/modules/core/lib/Controller/Login.php +++ b/modules/core/lib/Controller/Login.php @@ -89,7 +89,7 @@ class Login $session = Session::getSessionFromRequest(); - $t = new Template($this->config, 'auth_status.twig', 'attributes'); + $t = new Template($this->config, 'auth_status.twig'); $l = $t->getLocalization(); $l->addAttributeDomains(); $t->data['header'] = '{status:header_saml20_sp}'; diff --git a/modules/cron/lib/Controller/Cron.php b/modules/cron/lib/Controller/Cron.php index f90e0e116e705181fedaa33d1840d35513aa2c56..114d2261e40acc587030a51272ba6ffc30e77891 100644 --- a/modules/cron/lib/Controller/Cron.php +++ b/modules/cron/lib/Controller/Cron.php @@ -105,7 +105,7 @@ class Cron ]; } - $t = new Template($this->config, 'cron:croninfo.twig', 'cron:cron'); + $t = new Template($this->config, 'cron:croninfo.twig'); $t->data['urls'] = $urls; return $t; } @@ -157,7 +157,7 @@ class Cron } if ($output === 'xhtml') { - $t = new Template($this->config, 'cron:croninfo-result.twig', 'cron:cron'); + $t = new Template($this->config, 'cron:croninfo-result.twig'); $t->data['tag'] = $croninfo['tag']; $t->data['time'] = $time; $t->data['url'] = $url; diff --git a/tests/modules/core/lib/Auth/Process/PHPTest.php b/tests/modules/core/lib/Auth/Process/PHPTest.php index 40644af95466ffe59713d6cce26bf6fca4e1b8b6..28493d48b068f3a35f1482e3eed6d716a2c7a31b 100644 --- a/tests/modules/core/lib/Auth/Process/PHPTest.php +++ b/tests/modules/core/lib/Auth/Process/PHPTest.php @@ -53,7 +53,7 @@ class PHPTest extends TestCase { $config = [ 'code' => ' - $attributes["key"] = array("value"); + $attributes["key"] = ["value"]; ', ]; $request = ['Attributes' => []]; @@ -74,7 +74,7 @@ class PHPTest extends TestCase { $config = [ 'code' => ' - $attributes["orig2"] = array("value0"); + $attributes["orig2"] = ["value0"]; ', ]; $request = [ @@ -130,7 +130,7 @@ class PHPTest extends TestCase $config = [ 'code' => ' - $attributes["orig2"] = array("value0"); + $attributes["orig2"] = ["value0"]; $state["newKey"] = ["newValue"]; $state["Destination"]["attributes"][] = "givenName"; ', diff --git a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php index 34a740d4171ecd4eb858cff96b86b3df3cea0bb2..3054455362b082080df926d98ab875101a0f5caa 100644 --- a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php +++ b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php @@ -120,7 +120,7 @@ class TargetedIDTest extends TestCase 'identifyingAttribute' => 'eduPersonPrincipalName', ]; - $request = array( + $request = [ 'Attributes' => [ 'eduPersonPrincipalName' => ['joe'], 'eduPersonTargetedID' => [$nameid->toXML()->ownerDocument->saveXML()], @@ -133,7 +133,7 @@ class TargetedIDTest extends TestCase 'metadata-set' => 'saml20-sp-remote', 'entityid' => 'joe', ], - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; diff --git a/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php b/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php index 83be7f6e0d4f80b702b9cfad0d5787decd7c8125..0f7709ea156eae7a1bdd046e72727d475ce0473d 100644 --- a/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php +++ b/tests/modules/multiauth/lib/Auth/Source/MultiAuthTest.php @@ -33,42 +33,42 @@ class MultiAuthTest extends ClearStateTestCase ); Configuration::setPreLoadedConfig($this->config, 'config.php'); - $this->sourceConfig = Configuration::loadFromArray(array( - 'example-multi' => array( + $this->sourceConfig = Configuration::loadFromArray([ + 'example-multi' => [ 'multiauth:MultiAuth', /* * The available authentication sources. * They must be defined in this authsources.php file. */ - 'sources' => array( - 'example-saml' => array( - 'text' => array( + 'sources' => [ + 'example-saml' => [ + 'text' => [ 'en' => 'Log in using a SAML SP', 'es' => 'Entrar usando un SP SAML', - ), + ], 'css-class' => 'SAML', - ), - 'example-admin' => array( - 'text' => array( + ], + 'example-admin' => [ + 'text' => [ 'en' => 'Log in using the admin password', 'es' => 'Entrar usando la contraseña de administrador', - ), - ), - ), + ], + ], + ], 'preselect' => 'example-saml', - ), + ], - 'example-saml' => array( + 'example-saml' => [ 'saml:SP', 'entityId' => 'my-entity-id', 'idp' => 'my-idp', - ), + ], - 'example-admin' => array( + 'example-admin' => [ 'core:AdminPassword', - ), - )); + ], + ]); Configuration::setPreLoadedConfig($this->sourceConfig, 'authsources.php'); } @@ -79,11 +79,11 @@ class MultiAuthTest extends ClearStateTestCase { $this->expectException(Exception::class); $this->expectExceptionMessage('The required "sources" config option was not found'); - $sourceConfig = Configuration::loadFromArray(array( - 'example-multi' => array( + $sourceConfig = Configuration::loadFromArray([ + 'example-multi' => [ 'multiauth:MultiAuth', - ), - )); + ], + ]); Configuration::setPreLoadedConfig($sourceConfig, 'authsources.php'); @@ -97,42 +97,42 @@ class MultiAuthTest extends ClearStateTestCase { $this->expectException(Exception::class); $this->expectExceptionMessage('The optional "preselect" config option must be present in "sources"'); - $sourceConfig = Configuration::loadFromArray(array( - 'example-multi' => array( + $sourceConfig = Configuration::loadFromArray([ + 'example-multi' => [ 'multiauth:MultiAuth', /* * The available authentication sources. * They must be defined in this authsources.php file. */ - 'sources' => array( - 'example-saml' => array( - 'text' => array( + 'sources' => [ + 'example-saml' => [ + 'text' => [ 'en' => 'Log in using a SAML SP', 'es' => 'Entrar usando un SP SAML', - ), + ], 'css-class' => 'SAML', - ), - 'example-admin' => array( - 'text' => array( + ], + 'example-admin' => [ + 'text' => [ 'en' => 'Log in using the admin password', 'es' => 'Entrar usando la contraseña de administrador', - ), - ), - ), + ], + ], + ], 'preselect' => 'other', - ), + ], - 'example-saml' => array( + 'example-saml' => [ 'saml:SP', 'entityId' => 'my-entity-id', 'idp' => 'my-idp', - ), + ], - 'example-admin' => array( + 'example-admin' => [ 'core:AdminPassword', - ), - )); + ], + ]); Configuration::setPreLoadedConfig($sourceConfig, 'authsources.php'); new MultiAuth(['AuthId' => 'example-multi'], $sourceConfig->getArray('example-multi')); @@ -143,41 +143,41 @@ class MultiAuthTest extends ClearStateTestCase */ public function testPreselectIsOptional(): void { - $sourceConfig = Configuration::loadFromArray(array( - 'example-multi' => array( + $sourceConfig = Configuration::loadFromArray([ + 'example-multi' => [ 'multiauth:MultiAuth', /* * The available authentication sources. * They must be defined in this authsources.php file. */ - 'sources' => array( - 'example-saml' => array( - 'text' => array( + 'sources' => [ + 'example-saml' => [ + 'text' => [ 'en' => 'Log in using a SAML SP', 'es' => 'Entrar usando un SP SAML', - ), + ], 'css-class' => 'SAML', - ), - 'example-admin' => array( - 'text' => array( + ], + 'example-admin' => [ + 'text' => [ 'en' => 'Log in using the admin password', 'es' => 'Entrar usando la contraseña de administrador', - ), - ), - ), - ), + ], + ], + ], + ], - 'example-saml' => array( + 'example-saml' => [ 'saml:SP', 'entityId' => 'my-entity-id', 'idp' => 'my-idp', - ), + ], - 'example-admin' => array( + 'example-admin' => [ 'core:AdminPassword', - ), - )); + ], + ]); Configuration::setPreLoadedConfig($sourceConfig, 'authsources.php'); diff --git a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php index ba0b5472e546d8da731f9bba4d7860d1ce2273f2..64c64aba23880e4a233518b143b5ad11fe6fec72 100644 --- a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php +++ b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php @@ -228,7 +228,7 @@ class NameIDAttributeTest extends TestCase ], 'saml:sp:NameID' => $nameId, ]; - $this->processFilter(array(), $request); + $this->processFilter([], $request); $this->assertEquals("{$nameId->getFormat()}", Constants::NAMEID_UNSPECIFIED); $this->assertEquals("{$nameId->getNameQualifier()}", $idpId); $this->assertEquals("{$nameId->getSPNameQualifier()}", $spId);