diff --git a/attributemap/addurnprefix.php b/attributemap/addurnprefix.php index 9d9877c0002173f18a53d51aaf50a2e7da9dd87c..c8623954f9284a5b784e78cea3e050bd19895218 100644 --- a/attributemap/addurnprefix.php +++ b/attributemap/addurnprefix.php @@ -1,6 +1,6 @@ <?php -$attributemap = array( +$attributemap = [ 'sn' => 'urn:mace:dir:attribute-def:sn', 'telephoneNumber' => 'urn:mace:dir:attribute-def:telephoneNumber', 'facsimileTelephoneNumber' => 'urn:mace:dir:attribute-def:facsimileTelephoneNumber', @@ -17,4 +17,4 @@ $attributemap = array( 'eduPersonEntitlement' => 'urn:mace:dir:attribute-def:eduPersonEntitlement', 'eduPersonOrgDN' => 'urn:mace:dir:attribute-def:eduPersonOrgDN', 'eduPersonOrgUnitDN' => 'urn:mace:dir:attribute-def:eduPersonOrgUnitDN', -); +]; diff --git a/attributemap/deprecatedSchacNS.php b/attributemap/deprecatedSchacNS.php index 5f90e03ab7a95cf2720c3706674cb80a7d71840e..4a613348e15ed5f84f236a755c76e8d1c26421be 100644 --- a/attributemap/deprecatedSchacNS.php +++ b/attributemap/deprecatedSchacNS.php @@ -11,7 +11,7 @@ if (!defined('SCHAC_NEW_NS')) { define('SCHAC_NEW_NS', 'urn:schac:attribute-def:'); } -$attributemap = array( +$attributemap = [ SCHAC_NEW_NS.'schacCountryOfCitizenship' => SCHAC_OLD_NS.'schacCountryOfCitizenship', SCHAC_NEW_NS.'schacCountryOfResidence' => SCHAC_OLD_NS.'schacCountryOfResidence', SCHAC_NEW_NS.'schacDateOfBirth' => SCHAC_OLD_NS.'schacDateOfBirth', @@ -32,4 +32,4 @@ $attributemap = array( SCHAC_NEW_NS.'schacUserPresenceID' => SCHAC_OLD_NS.'schacUserPresenceID', SCHAC_NEW_NS.'schacUserPrivateAttribute' => SCHAC_OLD_NS.'schacUserPrivateAttribute', SCHAC_NEW_NS.'schacUserStatus' => SCHAC_OLD_NS.'schacUserStatus', -); +]; diff --git a/attributemap/facebook2name.php b/attributemap/facebook2name.php index 5867ea7edfc87e56c1338bcb99b06f4bcc98f035..e567a69f20572cdbeaa1328cab5316cab1cea20d 100644 --- a/attributemap/facebook2name.php +++ b/attributemap/facebook2name.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ // Generated Facebook Attributes 'facebook_user' => 'eduPersonPrincipalName', // username OR uid @ facebook.com @@ -15,4 +15,4 @@ $attributemap = array( 'facebook.profile_url' => 'labeledURI', 'facebook.locale' => 'preferredLanguage', 'facebook.about_me' => 'description', -); +]; diff --git a/attributemap/feide-oid.php b/attributemap/feide-oid.php index dc94cd7a4ea344c4cac679d3219c5d8454af861d..45a1a28a4050205489689511b4b975648bd82ecf 100644 --- a/attributemap/feide-oid.php +++ b/attributemap/feide-oid.php @@ -1,6 +1,6 @@ <?php -$attributemap = array( +$attributemap = [ 'mobile' => 'urn:mace:dir:attribute-def:mobile', 'displayName' => 'urn:oid:2.16.840.1.113730.3.1.241', -); +]; diff --git a/attributemap/linkedin2name.php b/attributemap/linkedin2name.php index 97231dd4b37f63d09c697e8f41e9da769f5542ed..9b654682d8652a0a41ab630b4ea2bb1ef8d36e68 100644 --- a/attributemap/linkedin2name.php +++ b/attributemap/linkedin2name.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ // See http://developer.linkedin.com/docs/DOC-1061 for LinkedIn Profile fields. // NB: JSON response requires the conversion of field names from hyphened to camelCase. @@ -15,4 +15,4 @@ $attributemap = array( 'linkedin.id' => 'uid', // alpha + mixed case user id 'linkedin.headline' => 'title', 'linkedin.summary' => 'description', -); +]; diff --git a/attributemap/name2claim.php b/attributemap/name2claim.php index 482bb6d8bd3606e8fa5d2f2675c999bce4c98878..7b03b104539ad251a30519989c0b920ba77b1763 100644 --- a/attributemap/name2claim.php +++ b/attributemap/name2claim.php @@ -1,5 +1,5 @@ <?php // Maps AD LDAP to Claims from http://msdn.microsoft.com/en-us/library/hh159803.aspx -$attributemap = array( +$attributemap = [ 'c' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country', 'givenName' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname', 'mail' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress', @@ -10,4 +10,4 @@ $attributemap = array( 'st' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/stateorprovince', 'streetaddress' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress', 'telephonenumber' => 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/otherphone', -); +]; diff --git a/attributemap/name2oid.php b/attributemap/name2oid.php index 1a5e10ca27e6746149668f4cfd91687d5ea759db..c99f0e0b371e493a5dd6f865fccc8aef93feef85 100644 --- a/attributemap/name2oid.php +++ b/attributemap/name2oid.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ 'aRecord' => 'urn:oid:0.9.2342.19200300.100.1.26', 'aliasedEntryName' => 'urn:oid:2.5.4.1', 'aliasedObjectName' => 'urn:oid:2.5.4.1', @@ -189,4 +189,4 @@ $attributemap = array( 'userid' => 'urn:oid:0.9.2342.19200300.100.1.1', 'x121Address' => 'urn:oid:2.5.4.24', 'x500UniqueIdentifier' => 'urn:oid:2.5.4.45', -); +]; diff --git a/attributemap/name2urn.php b/attributemap/name2urn.php index 9286f6fe3b9a25b246512d5ccfaeaf56bcf5dfea..03190f3090a673497a4c2d5f09665c0175657b93 100644 --- a/attributemap/name2urn.php +++ b/attributemap/name2urn.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ 'aRecord' => 'urn:mace:dir:attribute-def:aRecord', 'aliasedEntryName' => 'urn:mace:dir:attribute-def:aliasedEntryName', 'aliasedObjectName' => 'urn:mace:dir:attribute-def:aliasedObjectName', @@ -186,4 +186,4 @@ $attributemap = array( 'userid' => 'urn:mace:dir:attribute-def:userid', 'x121Address' => 'urn:mace:dir:attribute-def:x121Address', 'x500UniqueIdentifier' => 'urn:mace:dir:attribute-def:x500UniqueIdentifier', -); +]; diff --git a/attributemap/newSchacNS.php b/attributemap/newSchacNS.php index 8b3d2a75685f392c9c73c56431b2e31c947d6c78..16e67394eecf567af9ffb263c21e02e5964efad7 100644 --- a/attributemap/newSchacNS.php +++ b/attributemap/newSchacNS.php @@ -11,7 +11,7 @@ if (!defined('SCHAC_NEW_NS')) { define('SCHAC_NEW_NS', 'urn:schac:attribute-def:'); } -$attributemap = array( +$attributemap = [ SCHAC_OLD_NS.'schacCountryOfCitizenship' => SCHAC_NEW_NS.'schacCountryOfCitizenship', SCHAC_OLD_NS.'schacCountryOfResidence' => SCHAC_NEW_NS.'schacCountryOfResidence', SCHAC_OLD_NS.'schacDateOfBirth' => SCHAC_NEW_NS.'schacDateOfBirth', @@ -32,4 +32,4 @@ $attributemap = array( SCHAC_OLD_NS.'schacUserPresenceID' => SCHAC_NEW_NS.'schacUserPresenceID', SCHAC_OLD_NS.'schacUserPrivateAttribute' => SCHAC_NEW_NS.'schacUserPrivateAttribute', SCHAC_OLD_NS.'schacUserStatus' => SCHAC_NEW_NS.'schacUserStatus', -); +]; diff --git a/attributemap/oid-feide.php b/attributemap/oid-feide.php index e20b7a88500056734152c19768e61b2df7ea477a..c6bc2148d289c0d3ed9e442c02872025301a397a 100644 --- a/attributemap/oid-feide.php +++ b/attributemap/oid-feide.php @@ -1,6 +1,6 @@ <?php -$attributemap = array( +$attributemap = [ 'urn:oid:0.9.2342.19200300.100.1.41' => 'mobile', 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6' => 'eduPersonPrincipalName', 'urn:oid:0.9.2342.19200300.100.1.3' => 'mail', @@ -9,4 +9,4 @@ $attributemap = array( 'urn:oid:2.5.4.4' => 'sn', 'urn:oid:2.5.4.42' => 'givenName', 'urn:oid:2.16.756.1.2.5.1.1.1' => 'eduPerson', -); +]; diff --git a/attributemap/oid2name.php b/attributemap/oid2name.php index e1ce887d6e61ef1e8509d58f05707da251f830b7..f36dd1cab3b173df320c424f78b05a8e5a455a49 100644 --- a/attributemap/oid2name.php +++ b/attributemap/oid2name.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ 'urn:oid:0.9.2342.19200300.100.1.1' => 'uid', 'urn:oid:0.9.2342.19200300.100.1.10' => 'manager', 'urn:oid:0.9.2342.19200300.100.1.11' => 'documentIdentifier', @@ -167,4 +167,4 @@ $attributemap = array( 'urn:oid:2.5.4.7' => 'l', 'urn:oid:2.5.4.8' => 'st', 'urn:oid:2.5.4.9' => 'street', -); +]; diff --git a/attributemap/oid2urn.php b/attributemap/oid2urn.php index cefb99ce762a69f0bdb6f69cd1f0ee38275d782d..a2b0a78e32e63655ca946a2d85a05d86d1e29a26 100644 --- a/attributemap/oid2urn.php +++ b/attributemap/oid2urn.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ 'urn:oid:0.9.2342.19200300.100.1.1' => 'urn:mace:dir:attribute-def:uid', 'urn:oid:0.9.2342.19200300.100.1.10' => 'urn:mace:dir:attribute-def:manager', 'urn:oid:0.9.2342.19200300.100.1.11' => 'urn:mace:dir:attribute-def:documentIdentifier', @@ -164,4 +164,4 @@ $attributemap = array( 'urn:oid:2.5.4.7' => 'urn:mace:dir:attribute-def:l', 'urn:oid:2.5.4.8' => 'urn:mace:dir:attribute-def:st', 'urn:oid:2.5.4.9' => 'urn:mace:dir:attribute-def:street', -); +]; diff --git a/attributemap/openid2name.php b/attributemap/openid2name.php index 624074b02cf4ffb8f13e1bf8919f767156f30736..1cef43ef2cef2b7e0ebbed04cfe47da204e42bf6 100644 --- a/attributemap/openid2name.php +++ b/attributemap/openid2name.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ // Simple Registration + AX Schema 'http://axschema.org/namePerson/friendly' => 'displayName', // Alias/Username -> displayName 'openid.sreg.nickname' => 'displayName', @@ -30,4 +30,4 @@ $attributemap = array( 'http://axschema.org/contact/phone/fax' => 'facsimileTelephoneNumber', // Phone (fax) // Further attributes can be found at http://www.axschema.org/types/ -); +]; diff --git a/attributemap/removeurnprefix.php b/attributemap/removeurnprefix.php index 6a7c920d59fb9761fd2b72b75382057799b1d3b9..f9ac92f5edb3115251c14f571f5d373905a308fe 100644 --- a/attributemap/removeurnprefix.php +++ b/attributemap/removeurnprefix.php @@ -1,6 +1,6 @@ <?php -$attributemap = array( +$attributemap = [ 'urn:mace:dir:attribute-def:sn' => 'sn', 'urn:mace:dir:attribute-def:telephoneNumber' => 'telephoneNumber', 'urn:mace:dir:attribute-def:facsimileTelephoneNumber' => 'facsimileTelephoneNumber', @@ -17,4 +17,4 @@ $attributemap = array( 'urn:mace:dir:attribute-def:eduPersonEntitlement' => 'eduPersonEntitlement', 'urn:mace:dir:attribute-def:eduPersonOrgDN' => 'eduPersonOrgDN', 'urn:mace:dir:attribute-def:eduPersonOrgUnitDN' => 'eduPersonOrgUnitDN', -); +]; diff --git a/attributemap/test.php b/attributemap/test.php index a89ad869f7ea0606e95bded4133360245ad97faf..8ddd84b6980ea06d58548c81cdd4710066693238 100644 --- a/attributemap/test.php +++ b/attributemap/test.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ 'mobile' => 'urn:mace:dir:attribute-def:mobile' -); +]; diff --git a/attributemap/twitter2name.php b/attributemap/twitter2name.php index 27c9e755a1b478625846a20c6000ea173ae7ee7d..00f65317a26ad6e11a10b1d6c11c4d025180dfb5 100644 --- a/attributemap/twitter2name.php +++ b/attributemap/twitter2name.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ // Generated Twitter Attributes 'twitter_screen_n_realm' => 'eduPersonPrincipalName', // screen_name@twitter.com @@ -11,4 +11,4 @@ $attributemap = array( 'twitter.url' => 'labeledURI', 'twitter.lang' => 'preferredLanguage', 'twitter.description' => 'description', -); +]; diff --git a/attributemap/urn2name.php b/attributemap/urn2name.php index fc8d4d97db5a0de8cfaeb2c21ac6b1907b71174d..8cf8bffd7d408414cc3ccc719fe57ccda866303d 100644 --- a/attributemap/urn2name.php +++ b/attributemap/urn2name.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ 'urn:mace:dir:attribute-def:aRecord' => 'aRecord', 'urn:mace:dir:attribute-def:aliasedEntryName' => 'aliasedEntryName', 'urn:mace:dir:attribute-def:aliasedObjectName' => 'aliasedObjectName', @@ -186,4 +186,4 @@ $attributemap = array( 'urn:mace:terena.org:attribute-def:schacUserStatus' => 'schacUserStatus', 'urn:oasis:names:tc:SAML:attribute:pairwise-id' => 'pairwise-id', 'urn:oasis:names:tc:SAML:attribute:subject-id' => 'subject-id', -); +]; diff --git a/attributemap/urn2oid.php b/attributemap/urn2oid.php index fda382b93ab6de4c9e55c3b37b6cd2ddd5886339..4abf467844205819687bee888882586f4e3e8cec 100644 --- a/attributemap/urn2oid.php +++ b/attributemap/urn2oid.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ 'urn:mace:dir:attribute-def:aRecord' => 'urn:oid:0.9.2342.19200300.100.1.26', 'urn:mace:dir:attribute-def:aliasedEntryName' => 'urn:oid:2.5.4.1', 'urn:mace:dir:attribute-def:aliasedObjectName' => 'urn:oid:2.5.4.1', @@ -185,4 +185,4 @@ $attributemap = array( 'urn:mace:terena.org:attribute-def:schacUserPresenceID' => 'urn:oid:1.3.6.1.4.1.25178.1.2.12', 'urn:mace:terena.org:attribute-def:schacUserPrivateAttribute' => 'urn:oid:1.3.6.1.4.1.25178.1.2.18', 'urn:mace:terena.org:attribute-def:schacUserStatus' => 'urn:oid:1.3.6.1.4.1.25178.1.2.19', -); +]; diff --git a/attributemap/windowslive2name.php b/attributemap/windowslive2name.php index 1c5496c90dd63e3c9006c38ff13644cda5b37402..3c3ffa1f00c91b488597a062c96731e7082149b5 100644 --- a/attributemap/windowslive2name.php +++ b/attributemap/windowslive2name.php @@ -1,5 +1,5 @@ <?php -$attributemap = array( +$attributemap = [ // Generated Windows Live ID Attributes 'windowslive_user' => 'eduPersonPrincipalName', // uid @ windowslive.com @@ -19,4 +19,4 @@ $attributemap = array( 'windowslive.mail' => 'mail', 'windowslive.preferredLanguage' => 'preferredLanguage', -); +]; diff --git a/bin/importPdoMetadata.php b/bin/importPdoMetadata.php index b930b99f2169324759c3a6a0632e752328d3d77b..abf4fdd4842f5a6ec3c6641d82664a01e330e769 100755 --- a/bin/importPdoMetadata.php +++ b/bin/importPdoMetadata.php @@ -14,7 +14,7 @@ foreach ($config['metadata.sources'] as $s) { $mdshp->initDatabase(); foreach (glob("metadata/*.php") as $filename) { - $metadata = array(); + $metadata = []; require_once $filename; $set = basename($filename, ".php"); echo "importing set '$set'...".PHP_EOL; diff --git a/bin/memcacheSync.php b/bin/memcacheSync.php index 278cd0f6dcb3bf62d84e00360185741b27a0b654..0b5ca9c85980c3c3b7558b4dda257c7cafe21b97 100755 --- a/bin/memcacheSync.php +++ b/bin/memcacheSync.php @@ -35,7 +35,7 @@ $warnBigSlab = 0; // We use the stats interface to determine which servers exists $stats = \SimpleSAML\Memcache::getRawStats(); -$keys = array(); +$keys = []; foreach ($stats as $group) { foreach ($group as $server => $state) { @@ -109,7 +109,7 @@ function getServerKeys($server) } // Read list of slabs - $slabs = array(); + $slabs = []; while (($line = fgets($socket)) !== false) { $line = rtrim($line); if ($line === 'END') { @@ -125,7 +125,7 @@ function getServerKeys($server) } // Dump keys in slabs - $keys = array(); + $keys = []; foreach ($slabs as $slab) { if (fwrite($socket, "stats cachedump ".$slab." 1000000\r\n") === false) { diff --git a/composer.json b/composer.json index 0aee2a3240d0887b2ccaec4bb733e22a02e35874..475ad79d09878d0bec77a0f1e51b61537d0b11df 100644 --- a/composer.json +++ b/composer.json @@ -36,12 +36,12 @@ "ext-hash": "*", "ext-json": "*", "ext-mbstring": "*", - "simplesamlphp/saml2": "~3.2", - "robrichards/xmlseclibs": "dev-master#93f8c07976b36b6050ab341ab5850484dc897ce0 as 3.0.2", + "simplesamlphp/saml2": "^3.2", + "robrichards/xmlseclibs": "^3.0", "whitehat101/apr1-md5": "~1.0", - "twig/twig": "~1.0", + "twig/twig": "~1.0 || ~2.0", "gettext/gettext": "^4.6", - "jaimeperez/twig-configurable-i18n": "^1.2" + "jaimeperez/twig-configurable-i18n": "^2.0" }, "require-dev": { "phpunit/phpunit": "~4.8.35", diff --git a/composer.lock b/composer.lock index 495ce830fcd3b57925f436ee3a7a38c2b4194b60..4054e22f02d7fd76fa0b105dce86da4c02a64a0a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a7d27841fb528e220ac63d4fa2bbc21f", + "content-hash": "b9c34fc504ecc863bc6fe8fecd0f838e", "packages": [ { "name": "gettext/gettext", - "version": "v4.6.0", + "version": "v4.6.1", "source": { "type": "git", "url": "https://github.com/oscarotero/Gettext.git", - "reference": "cae84aff39a87e07bd6e5cddb5adb720a0ffa357" + "reference": "854ff5f5aaf92d2af7080ba8fc15718b27b5c89a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oscarotero/Gettext/zipball/cae84aff39a87e07bd6e5cddb5adb720a0ffa357", - "reference": "cae84aff39a87e07bd6e5cddb5adb720a0ffa357", + "url": "https://api.github.com/repos/oscarotero/Gettext/zipball/854ff5f5aaf92d2af7080ba8fc15718b27b5c89a", + "reference": "854ff5f5aaf92d2af7080ba8fc15718b27b5c89a", "shasum": "" }, "require": { @@ -66,7 +66,7 @@ "po", "translation" ], - "time": "2018-06-26T16:51:09+00:00" + "time": "2018-08-27T15:40:19+00:00" }, { "name": "gettext/languages", @@ -131,16 +131,16 @@ }, { "name": "jaimeperez/twig-configurable-i18n", - "version": "v1.2", + "version": "v2.0", "source": { "type": "git", "url": "https://github.com/jaimeperez/twig-configurable-i18n.git", - "reference": "75d4926fd102c9e62219ad7f94a6136d2f2ccd93" + "reference": "4ccf150ba9f28d2e31d0622ecc9b81cdc6a2638b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jaimeperez/twig-configurable-i18n/zipball/75d4926fd102c9e62219ad7f94a6136d2f2ccd93", - "reference": "75d4926fd102c9e62219ad7f94a6136d2f2ccd93", + "url": "https://api.github.com/repos/jaimeperez/twig-configurable-i18n/zipball/4ccf150ba9f28d2e31d0622ecc9b81cdc6a2638b", + "reference": "4ccf150ba9f28d2e31d0622ecc9b81cdc6a2638b", "shasum": "" }, "require": { @@ -171,7 +171,7 @@ "translation", "twig" ], - "time": "2016-10-03T12:34:15+00:00" + "time": "2018-10-10T09:12:46+00:00" }, { "name": "psr/log", @@ -222,16 +222,16 @@ }, { "name": "robrichards/xmlseclibs", - "version": "dev-master", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/robrichards/xmlseclibs.git", - "reference": "93f8c07976b36b6050ab341ab5850484dc897ce0" + "reference": "1f4de0c0d121922aafd8c62c2a9f5e528830cf38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/93f8c07976b36b6050ab341ab5850484dc897ce0", - "reference": "93f8c07976b36b6050ab341ab5850484dc897ce0", + "url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/1f4de0c0d121922aafd8c62c2a9f5e528830cf38", + "reference": "1f4de0c0d121922aafd8c62c2a9f5e528830cf38", "shasum": "" }, "require": { @@ -256,20 +256,20 @@ "xml", "xmldsig" ], - "time": "2018-03-23T11:10:08+00:00" + "time": "2018-09-27T13:24:13+00:00" }, { "name": "simplesamlphp/saml2", - "version": "v3.2", + "version": "v3.2.2", "source": { "type": "git", "url": "https://github.com/simplesamlphp/saml2.git", - "reference": "43590bc9614c1df5bd7b1639088f7d904842892b" + "reference": "b3a040ec186f4a3749228b8c13642c5295fc451b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/43590bc9614c1df5bd7b1639088f7d904842892b", - "reference": "43590bc9614c1df5bd7b1639088f7d904842892b", + "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/b3a040ec186f4a3749228b8c13642c5295fc451b", + "reference": "b3a040ec186f4a3749228b8c13642c5295fc451b", "shasum": "" }, "require": { @@ -313,28 +313,145 @@ } ], "description": "SAML2 PHP library from SimpleSAMLphp", - "time": "2018-07-12T09:56:19+00:00" + "time": "2018-09-27T14:09:06+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-08-06T14:22:27+00:00" }, { "name": "twig/extensions", - "version": "v1.5.1", + "version": "v1.5.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig-extensions.git", - "reference": "d188c76168b853481cc75879ea045bf93d718e9c" + "reference": "2c1a86526d0044065220d1b51ac08348bea5ca82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/d188c76168b853481cc75879ea045bf93d718e9c", - "reference": "d188c76168b853481cc75879ea045bf93d718e9c", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/2c1a86526d0044065220d1b51ac08348bea5ca82", + "reference": "2c1a86526d0044065220d1b51ac08348bea5ca82", "shasum": "" }, "require": { - "twig/twig": "~1.27|~2.0" + "twig/twig": "^1.27|^2.0" }, "require-dev": { - "symfony/phpunit-bridge": "~3.3@dev", - "symfony/translation": "~2.3|~3.0" + "symfony/phpunit-bridge": "^3.4", + "symfony/translation": "^2.7|^3.4" }, "suggest": { "symfony/translation": "Allow the time_diff output to be translated" @@ -364,29 +481,30 @@ } ], "description": "Common additional features for Twig that do not directly belong in core", - "homepage": "http://twig.sensiolabs.org/doc/extensions/index.html", "keywords": [ "i18n", "text" ], - "time": "2017-06-08T18:19:53+00:00" + "time": "2018-05-22T13:26:07+00:00" }, { "name": "twig/twig", - "version": "v1.35.3", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f" + "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", - "reference": "b48680b6eb7d16b5025b9bfc4108d86f6b8af86f", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/6a5f676b77a90823c2d4eaf76137b771adf31323", + "reference": "6a5f676b77a90823c2d4eaf76137b771adf31323", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/container": "^1.0", @@ -396,7 +514,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.35-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -425,16 +543,16 @@ }, { "name": "Twig Team", - "homepage": "http://twig.sensiolabs.org/contributors", + "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", + "homepage": "https://twig.symfony.com", "keywords": [ "templating" ], - "time": "2018-03-20T04:25:58+00:00" + "time": "2018-07-13T07:18:09+00:00" }, { "name": "whitehat101/apr1-md5", @@ -546,16 +664,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.1.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08" + "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/c919dc6c62e221fc6406f861ea13433c0aa24f08", - "reference": "c919dc6c62e221fc6406f861ea13433c0aa24f08", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/b8e9745fb9b06ea6664d8872c4505fb16df4611c", + "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c", "shasum": "" }, "require": { @@ -586,39 +704,39 @@ "Xdebug", "performance" ], - "time": "2018-04-11T15:42:36+00:00" + "time": "2018-08-31T19:07:57+00:00" }, { "name": "doctrine/annotations", - "version": "v1.2.7", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", - "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/54cacc9b81758b14e3ce750f205a393d52339e97", + "reference": "54cacc9b81758b14e3ce750f205a393d52339e97", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": ">=5.3.2" + "php": "^5.6 || ^7.0" }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^5.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Annotations\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" } }, "notification-url": "https://packagist.org/downloads/", @@ -654,7 +772,7 @@ "docblock", "parser" ], - "time": "2015-08-31T12:32:49+00:00" + "time": "2017-02-24T16:22:25+00:00" }, { "name": "doctrine/instantiator", @@ -766,49 +884,51 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.2.20", + "version": "v2.13.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "f1631f0747ad2a9dd3de8d7873b71f6573f8d0c2" + "reference": "7136aa4e0c5f912e8af82383775460d906168a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/f1631f0747ad2a9dd3de8d7873b71f6573f8d0c2", - "reference": "f1631f0747ad2a9dd3de8d7873b71f6573f8d0c2", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7136aa4e0c5f912e8af82383775460d906168a10", + "reference": "7136aa4e0c5f912e8af82383775460d906168a10", "shasum": "" }, "require": { "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.0", + "composer/xdebug-handler": "^1.2", "doctrine/annotations": "^1.2", "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.3.6 || >=7.0 <7.3", - "sebastian/diff": "^1.4", - "symfony/console": "^2.4 || ^3.0 || ^4.0", - "symfony/event-dispatcher": "^2.1 || ^3.0 || ^4.0", - "symfony/filesystem": "^2.4 || ^3.0 || ^4.0", - "symfony/finder": "^2.2 || ^3.0 || ^4.0", - "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0", - "symfony/polyfill-php54": "^1.0", - "symfony/polyfill-php55": "^1.3", + "php": "^5.6 || >=7.0 <7.3", + "php-cs-fixer/diff": "^1.3", + "symfony/console": "^3.2 || ^4.0", + "symfony/event-dispatcher": "^3.0 || ^4.0", + "symfony/filesystem": "^3.0 || ^4.0", + "symfony/finder": "^3.0 || ^4.0", + "symfony/options-resolver": "^3.0 || ^4.0", "symfony/polyfill-php70": "^1.0", "symfony/polyfill-php72": "^1.4", - "symfony/process": "^2.3 || ^3.0 || ^4.0", - "symfony/stopwatch": "^2.5 || ^3.0 || ^4.0" + "symfony/process": "^3.0 || ^4.0", + "symfony/stopwatch": "^3.0 || ^4.0" }, "conflict": { - "hhvm": "<3.18" + "hhvm": "*" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^1.0.1 || ^2.0 || ^3.0", + "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", "justinrainbow/json-schema": "^5.0", "keradus/cli-executor": "^1.1", "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^1.0.2", - "phpunit/phpunit": "^4.8.35 || ^5.4.3", - "symfony/phpunit-bridge": "^3.2.2 || ^4.0" + "php-coveralls/php-coveralls": "^2.1", + "php-cs-fixer/accessible-object": "^1.0", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", + "phpunitgoodpractices/traits": "^1.5.1", + "symfony/phpunit-bridge": "^4.0" }, "suggest": { "ext-mbstring": "For handling non-UTF8 characters in cache signature.", @@ -820,6 +940,11 @@ "php-cs-fixer" ], "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.13-dev" + } + }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" @@ -828,6 +953,7 @@ "tests/Test/AbstractFixerTestCase.php", "tests/Test/AbstractIntegrationCaseFactory.php", "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/Assert/AssertTokensTrait.php", "tests/Test/IntegrationCase.php", "tests/Test/IntegrationCaseFactory.php", "tests/Test/IntegrationCaseFactoryInterface.php", @@ -850,49 +976,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2018-06-02T17:26:04+00:00" - }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "files": [ - "lib/password.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" - ], - "time": "2014-11-20T16:49:30+00:00" + "time": "2018-08-23T13:15:44+00:00" }, { "name": "mikey179/vfsStream", @@ -942,33 +1026,29 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.17", + "version": "v9.99.99", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", - "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": "^7" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*" + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -987,41 +1067,195 @@ "pseudorandom", "random" ], - "time": "2018-07-04T16:31:37+00:00" + "time": "2018-07-02T15:55:56+00:00" + }, + { + "name": "php-cs-fixer/diff", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", + "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "symfony/process": "^3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "SpacePossum" + } + ], + "description": "sebastian/diff v2 backport support for PHP5.6", + "homepage": "https://github.com/PHP-CS-Fixer", + "keywords": [ + "diff" + ], + "time": "2018-02-15T16:58:55+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.5", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", - "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -1033,23 +1267,23 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2016-01-25T08:17:30+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -1061,12 +1295,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -1099,7 +1333,7 @@ "spy", "stub" ], - "time": "2018-04-18T13:57:24+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1851,37 +2085,45 @@ }, { "name": "symfony/console", - "version": "v2.8.42", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7" + "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e8e59b74ad1274714dad2748349b55e3e6e630c7", - "reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7", + "url": "https://api.github.com/repos/symfony/console/zipball/3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", + "reference": "3b2b415d4c48fbefca7dc742aa0a0171bfae4e0b", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/debug": "^2.7.2|~3.0.0", + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/polyfill-mbstring": "~1.0" }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" }, "suggest": { "psr/log-implementation": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1908,37 +2150,36 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-05-15T21:17:45+00:00" + "time": "2018-10-02T16:33:53+00:00" }, { "name": "symfony/debug", - "version": "v2.8.42", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "a26ddce7fe4e884097d72435653bc7e703411f26" + "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/a26ddce7fe4e884097d72435653bc7e703411f26", - "reference": "a26ddce7fe4e884097d72435653bc7e703411f26", + "url": "https://api.github.com/repos/symfony/debug/zipball/0a612e9dfbd2ccce03eb174365f31ecdca930ff6", + "reference": "0a612e9dfbd2ccce03eb174365f31ecdca930ff6", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0" }, "conflict": { "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/class-loader": "~2.2|~3.0.0", - "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2|~3.0.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1965,31 +2206,34 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-06-22T15:01:26+00:00" + "time": "2018-10-02T16:33:53+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.42", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "9b69aad7d4c086dc94ebade2d5eb9145da5dac8c" + "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9b69aad7d4c086dc94ebade2d5eb9145da5dac8c", - "reference": "9b69aad7d4c086dc94ebade2d5eb9145da5dac8c", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", + "reference": "b2e1f19280c09a42dc64c0b72b80fe44dd6e88fb", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/dependency-injection": "", @@ -1998,7 +2242,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2025,30 +2269,30 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-04-06T07:35:03+00:00" + "time": "2018-07-26T09:06:28+00:00" }, { "name": "symfony/filesystem", - "version": "v2.8.42", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "0f685c099aca7ba86bcc31850186dbfe84a4a8a1" + "reference": "d69930fc337d767607267d57c20a7403d0a822a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/0f685c099aca7ba86bcc31850186dbfe84a4a8a1", - "reference": "0f685c099aca7ba86bcc31850186dbfe84a4a8a1", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d69930fc337d767607267d57c20a7403d0a822a4", + "reference": "d69930fc337d767607267d57c20a7403d0a822a4", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2075,29 +2319,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2018-06-21T09:24:14+00:00" + "time": "2018-10-02T12:28:39+00:00" }, { "name": "symfony/finder", - "version": "v2.8.42", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "995cd7c28a0778cece02e2133b4d813dc509dfc3" + "reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/995cd7c28a0778cece02e2133b4d813dc509dfc3", - "reference": "995cd7c28a0778cece02e2133b4d813dc509dfc3", + "url": "https://api.github.com/repos/symfony/finder/zipball/54ba444dddc5bd5708a34bd095ea67c6eb54644d", + "reference": "54ba444dddc5bd5708a34bd095ea67c6eb54644d", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2124,29 +2368,29 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2018-06-19T11:07:17+00:00" + "time": "2018-10-03T08:46:40+00:00" }, { "name": "symfony/options-resolver", - "version": "v2.8.42", + "version": "v3.4.17", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "d9077ee91fdd64695dc754dc153fc00ada7ade97" + "reference": "1cf7d8e704a9cc4164c92e430f2dfa3e6983661d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/d9077ee91fdd64695dc754dc153fc00ada7ade97", - "reference": "d9077ee91fdd64695dc754dc153fc00ada7ade97", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1cf7d8e704a9cc4164c92e430f2dfa3e6983661d", + "reference": "1cf7d8e704a9cc4164c92e430f2dfa3e6983661d", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -2178,148 +2422,35 @@ "configuration", "options" ], - "time": "2018-05-30T04:18:42+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2018-04-30T19:57:29+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-09-17T17:29:18+00:00" }, { - "name": "symfony/polyfill-php54", - "version": "v1.8.0", + "name": "symfony/polyfill-php70", + "version": "v1.9.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "6c3a2b84c6025e4ea3f6a19feac35408c64b22e1" + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/6c3a2b84c6025e4ea3f6a19feac35408c64b22e1", - "reference": "6c3a2b84c6025e4ea3f6a19feac35408c64b22e1", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934", + "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934", "shasum": "" }, "require": { + "paragonie/random_compat": "~1.0|~2.0|~9.99", "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php54\\": "" + "Symfony\\Polyfill\\Php70\\": "" }, "files": [ "bootstrap.php" @@ -2342,63 +2473,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2018-04-26T10:06:28+00:00" - }, - { - "name": "symfony/polyfill-php55", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "a39456128377a85f2c5707fcae458678560cba46" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/a39456128377a85f2c5707fcae458678560cba46", - "reference": "a39456128377a85f2c5707fcae458678560cba46", - "shasum": "" - }, - "require": { - "ircmaxell/password-compat": "~1.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2406,41 +2481,37 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { - "name": "symfony/polyfill-php70", - "version": "v1.8.0", + "name": "symfony/polyfill-php72", + "version": "v1.9.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0", "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" + "Symfony\\Polyfill\\Php72\\": "" }, "files": [ "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2457,7 +2528,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2465,37 +2536,37 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { - "name": "symfony/polyfill-php72", - "version": "v1.8.0", + "name": "symfony/process", + "version": "v3.4.17", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46" + "url": "https://github.com/symfony/process.git", + "reference": "1dc2977afa7d70f90f3fefbcd84152813558910e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/a4576e282d782ad82397f3e4ec1df8e0f0cafb46", - "reference": "a4576e282d782ad82397f3e4ec1df8e0f0cafb46", + "url": "https://api.github.com/repos/symfony/process/zipball/1dc2977afa7d70f90f3fefbcd84152813558910e", + "reference": "1dc2977afa7d70f90f3fefbcd84152813558910e", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" + "Symfony\\Component\\Process\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2504,50 +2575,44 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "Symfony Process Component", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-10-02T12:28:39+00:00" }, { - "name": "symfony/process", - "version": "v2.8.42", + "name": "symfony/stopwatch", + "version": "v3.4.17", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "542d88b350c42750fdc14e73860ee96dd423e95d" + "url": "https://github.com/symfony/stopwatch.git", + "reference": "05e52a39de52ba690aebaed462b2bc8a9649f0a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/542d88b350c42750fdc14e73860ee96dd423e95d", - "reference": "542d88b350c42750fdc14e73860ee96dd423e95d", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/05e52a39de52ba690aebaed462b2bc8a9649f0a4", + "reference": "05e52a39de52ba690aebaed462b2bc8a9649f0a4", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Process\\": "" + "Symfony\\Component\\Stopwatch\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2567,36 +2632,46 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2018-05-27T07:40:52+00:00" + "time": "2018-10-02T12:28:39+00:00" }, { - "name": "symfony/stopwatch", - "version": "v2.8.42", + "name": "symfony/yaml", + "version": "v3.4.17", "source": { "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "57021208ad9830f8f8390c1a9d7bb390f32be89e" + "url": "https://github.com/symfony/yaml.git", + "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/57021208ad9830f8f8390c1a9d7bb390f32be89e", - "reference": "57021208ad9830f8f8390c1a9d7bb390f32be89e", + "url": "https://api.github.com/repos/symfony/yaml/zipball/640b6c27fed4066d64b64d5903a86043f4a4de7f", + "reference": "640b6c27fed4066d64b64d5903a86043f4a4de7f", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" + "Symfony\\Component\\Yaml\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2616,41 +2691,41 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Stopwatch Component", + "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:36:31+00:00" + "time": "2018-10-02T16:33:53+00:00" }, { - "name": "symfony/yaml", - "version": "v2.8.42", + "name": "webmozart/assert", + "version": "1.3.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff" + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff", - "reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/polyfill-ctype": "~1.8" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "1.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "Webmozart\\Assert\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2658,31 +2733,22 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2018-05-01T22:52:40+00:00" - } - ], - "aliases": [ - { - "alias": "3.0.2", - "alias_normalized": "3.0.2.0", - "version": "9999999-dev", - "package": "robrichards/xmlseclibs" + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" } ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "robrichards/xmlseclibs": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/config-templates/acl.php b/config-templates/acl.php index e208952eb3e8f5b92b74c0eef9ee01cb9660e376..cb760d0aa7c024715049a69c6e7ee56ad0d06a43 100644 --- a/config-templates/acl.php +++ b/config-templates/acl.php @@ -4,56 +4,56 @@ * This file defines "named" access control lists, which can * be reused in several places. */ -$config = array( - 'adminlist' => array( - //array('allow', 'equals', 'mail', 'admin1@example.org'), - //array('allow', 'has', 'groups', 'admin'), +$config = [ + 'adminlist' => [ + //['allow', 'equals', 'mail', 'admin1@example.org'], + //['allow', 'has', 'groups', 'admin'], // The default action is to deny access. - ), + ], - 'example-simple' => array( - array('allow', 'equals', 'mail', 'admin1@example.org'), - array('allow', 'equals', 'mail', 'admin2@example.org'), + 'example-simple' => [ + ['allow', 'equals', 'mail', 'admin1@example.org'], + ['allow', 'equals', 'mail', 'admin2@example.org'], // The default action is to deny access. - ), + ], - 'example-deny-some' => array( - array('deny', 'equals', 'mail', 'eviluser@example.org'), - array('allow'), // Allow everybody else. - ), + 'example-deny-some' => [ + ['deny', 'equals', 'mail', 'eviluser@example.org'], + ['allow'], // Allow everybody else. + ], - 'example-maildomain' => array( - array('allow', 'equals-preg', 'mail', '/@example\.org$/'), + 'example-maildomain' => [ + ['allow', 'equals-preg', 'mail', '/@example\.org$/'], // The default action is to deny access. - ), + ], - 'example-allow-employees' => array( - array('allow', 'has', 'eduPersonAffiliation', 'employee'), + 'example-allow-employees' => [ + ['allow', 'has', 'eduPersonAffiliation', 'employee'], // The default action is to deny access. - ), + ], - 'example-allow-employees-not-students' => array( - array('deny', 'has', 'eduPersonAffiliation', 'student'), - array('allow', 'has', 'eduPersonAffiliation', 'employee'), + 'example-allow-employees-not-students' => [ + ['deny', 'has', 'eduPersonAffiliation', 'student'], + ['allow', 'has', 'eduPersonAffiliation', 'employee'], // The default action is to deny access. - ), - - 'example-deny-student-except-one' => array( - array('deny', 'and', - array('has', 'eduPersonAffiliation', 'student'), - array('not', 'equals', 'mail', 'user@example.org'), - ), - array('allow'), - ), - - 'example-allow-or' => array( - array('allow', 'or', - array('equals', 'eduPersonAffiliation', 'student', 'member'), - array('equals', 'mail', 'someuser@example2.org'), - ), - ), - - 'example-allow-all' => array( - array('allow'), - ), -); + ], + + 'example-deny-student-except-one' => [ + ['deny', 'and', + ['has', 'eduPersonAffiliation', 'student'], + ['not', 'equals', 'mail', 'user@example.org'], + ], + ['allow'], + ], + + 'example-allow-or' => [ + ['allow', 'or', + ['equals', 'eduPersonAffiliation', 'student', 'member'], + ['equals', 'mail', 'someuser@example2.org'], + ], + ], + + 'example-allow-all' => [ + ['allow'], + ], +]; diff --git a/config-templates/authmemcookie.php b/config-templates/authmemcookie.php index cf2031addbc34bde7e8cfb70eea0f10d4256c32c..fac02813814cd56c09cd69ce3b526408d35da4e9 100644 --- a/config-templates/authmemcookie.php +++ b/config-templates/authmemcookie.php @@ -4,7 +4,7 @@ * This is the configuration file for the Auth MemCookie example. */ -$config = array( +$config = [ /* * The authentication source that should be used. * @@ -70,4 +70,4 @@ $config = array( * 'memcache.port' => 11211, */ 'memcache.port' => 11211, -); +]; diff --git a/config-templates/authsources.php b/config-templates/authsources.php index 5550b6d557b11c068fe534fc445c02ce409400b5..c637594c900dd522a18e47ff81fccb50b21d618e 100644 --- a/config-templates/authsources.php +++ b/config-templates/authsources.php @@ -1,19 +1,19 @@ <?php -$config = array( +$config = [ // This is a authentication source which handles admin authentication. - 'admin' => array( + 'admin' => [ // The default is to use core:AdminPassword, but it can be replaced with // any authentication source. 'core:AdminPassword', - ), + ], // An authentication source which can authenticate against both SAML 2.0 // and Shibboleth 1.3 IdPs. - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', // The entity ID of this SP. @@ -46,7 +46,7 @@ $config = array( /*'attributes.required' => array ( 'urn:oid:x.x.x.x', ),*/ - ), + ], /* @@ -331,4 +331,4 @@ $config = array( ), */ -); +]; diff --git a/config-templates/config.php b/config-templates/config.php index 54121b5faac74832007f2a85bcba2c7490266098..f3f776351e53a2fbb308fdd3c8de49f480f4f713 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -4,7 +4,7 @@ * */ -$config = array( +$config = [ /******************************* | BASIC CONFIGURATION OPTIONS | @@ -150,7 +150,7 @@ $config = array( * Example: * 'trusted.url.domains' => array('sp.example.com', 'app.example.com'), */ - 'trusted.url.domains' => array(), + 'trusted.url.domains' => [], /* * Enable regular expression matching of trusted.url.domains. @@ -214,11 +214,11 @@ $config = array( * If you want to disable debugging completely, unset this option or set it to an * empty array. */ - 'debug' => array( + 'debug' => [ 'saml' => false, 'backtraces' => true, 'validatexml' => false, - ), + ], /* * When 'showerrors' is enabled, all error messages and stack traces will be output @@ -316,7 +316,7 @@ $config = array( * This is an array of outputs. Each output has at least a 'class' option, which * selects the output. */ - 'statistics.out' => array(// Log statistics to the normal log. + 'statistics.out' => [// Log statistics to the normal log. /* array( 'class' => 'core:Log', @@ -330,7 +330,7 @@ $config = array( 'directory' => '/var/log/stats', ), */ - ), + ], @@ -377,13 +377,18 @@ $config = array( */ 'database.username' => 'simplesamlphp', 'database.password' => 'secret', - 'database.options' => array(), + 'database.options' => [], /* * (Optional) Table prefix */ 'database.prefix' => '', + /* + * (Optional) Driver options + */ + 'database.driver_options' => [], + /* * True or false if you would like a persistent database connection */ @@ -397,9 +402,9 @@ $config = array( * * Configuration options in the slave array are exactly the same as the * options for the master (shown above) with the exception of the table - * prefix. + * prefix and driver options. */ - 'database.slaves' => array( + 'database.slaves' => [ /* array( 'dsn' => 'mysql:host=myslave;dbname=saml', @@ -408,7 +413,7 @@ $config = array( 'persistent' => false, ), */ - ), + ], @@ -623,11 +628,11 @@ $config = array( * ), * */ - 'memcache_store.servers' => array( - array( - array('hostname' => 'localhost'), - ), - ), + 'memcache_store.servers' => [ + [ + ['hostname' => 'localhost'], + ], + ], /* * This value allows you to set a prefix for memcache-keys. The default @@ -665,7 +670,7 @@ $config = array( /* * Language-related options. */ - 'language' => array( + 'language' => [ /* * An array in the form 'language' => <list of alternative languages>. * @@ -685,23 +690,23 @@ $config = array( * not available, we look for translations in "nb" (Norwegian BokmĂĄl), * and so on, in that order. */ - 'priorities' => array( - 'no' => array('nb', 'nn', 'en', 'se'), - 'nb' => array('no', 'nn', 'en', 'se'), - 'nn' => array('no', 'nb', 'en', 'se'), - 'se' => array('nb', 'no', 'nn', 'en'), - ), - ), + 'priorities' => [ + 'no' => ['nb', 'nn', 'en', 'se'], + 'nb' => ['no', 'nn', 'en', 'se'], + 'nn' => ['no', 'nb', 'en', 'se'], + 'se' => ['nb', 'no', 'nn', 'en'], + ], + ], /* * Languages available, RTL languages, and what language is the default. */ - 'language.available' => array( + 'language.available' => [ 'en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'ca', 'fr', 'it', 'nl', 'lb', 'cs', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-br', 'tr', 'ja', 'zh', 'zh-tw', 'ru', 'et', 'he', 'id', 'sr', 'lv', 'ro', 'eu', 'el', 'af' - ), - 'language.rtl' => array('ar', 'dv', 'fa', 'ur', 'he'), + ], + 'language.rtl' => ['ar', 'dv', 'fa', 'ur', 'he'], 'language.default' => 'en', /* @@ -849,7 +854,7 @@ $config = array( * Authentication processing filters that will be executed for all IdPs * Both Shibboleth and SAML 2.0 */ - 'authproc.idp' => array( + 'authproc.idp' => [ /* Enable the authproc filter below to add URN prefixes to all attributes 10 => array( 'class' => 'core:AttributeMap', 'addurnprefix' @@ -861,11 +866,11 @@ $config = array( // Adopts language from attribute to use in UI 30 => 'core:LanguageAdaptor', - 45 => array( + 45 => [ 'class' => 'core:StatisticsWithAttribute', 'attributename' => 'realm', 'type' => 'saml20-idp-SSO', - ), + ], /* When called without parameters, it will fallback to filter attributes ‹the old way› * by checking the 'attributes' parameter in metadata on IdP hosted and SP remote. @@ -896,13 +901,13 @@ $config = array( */ // If language is set in Consent module it will be added as an attribute. 99 => 'core:LanguageAdaptor', - ), + ], /* * Authentication processing filters that will be executed for all SPs * Both Shibboleth and SAML 2.0 */ - 'authproc.sp' => array( + 'authproc.sp' => [ /* 10 => array( 'class' => 'core:AttributeMap', 'removeurnprefix' @@ -925,7 +930,7 @@ $config = array( // Adopts language from attribute to use in UI 90 => 'core:LanguageAdaptor', - ), + ], @@ -1013,9 +1018,9 @@ $config = array( * array('type' => 'flatfile') * ), */ - 'metadata.sources' => array( - array('type' => 'flatfile'), - ), + 'metadata.sources' => [ + ['type' => 'flatfile'], + ], /* * Should signing of generated metadata be enabled by default. @@ -1086,4 +1091,4 @@ $config = array( * The prefix we should use on our Redis datastore. */ 'store.redis.prefix' => 'SimpleSAMLphp', -); +]; diff --git a/dictionaries/admin.translation.json b/dictionaries/admin.translation.json index 28742f46bead11bf762aba2dcce6829192db3cbb..7f5f18abbdbc4d57dfdc8f92a55beafdc632eb34 100644 --- a/dictionaries/admin.translation.json +++ b/dictionaries/admin.translation.json @@ -885,8 +885,7 @@ "sr": "Shib 1.3 Davalac Identiteta (udaljeni)", "ro": "Furnizor de identitate Shib 1.3 (distant)", "ru": "\u041f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Shib 1.3 (\u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435)", - "eu": "Shib 1.3 Identitate hornitzailea (Urrunekoa)", - "eu": "\u03a0\u03ac\u03c1\u03bf\u03c7\u03bf\u03c2 \u03a4\u03b1\u03c5\u03c4\u03cc\u03c4\u03b7\u03c4\u03b1\u03c2 Shib 1.3 (\u0391\u03c0\u03bf\u03bc\u03b1\u03ba\u03c1\u03c5\u03c3\u03bc\u03ad\u03bd\u03bf\u03c2)" + "eu": "Shib 1.3 Identitate hornitzailea (Urrunekoa)" }, "metaover_group_metadata.wsfed-sp-hosted": { "no": "WS-Federation tjenesteleverand\u00f8r (intern)", diff --git a/docs/simplesamlphp-advancedfeatures.md b/docs/simplesamlphp-advancedfeatures.md index adb7c2486569474a69930c1dc1117b1b3de6fbfc..a1ee444dd36a5da77d1f6e681b21999a94ec7cad 100644 --- a/docs/simplesamlphp-advancedfeatures.md +++ b/docs/simplesamlphp-advancedfeatures.md @@ -41,9 +41,9 @@ In `metadata/saml20-idp-hosted.php`: In `config/authsources.php`: - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', - ), + ], diff --git a/docs/simplesamlphp-artifact-idp.md b/docs/simplesamlphp-artifact-idp.md index b07985a854b40c7c43f40351b702ac3aee88976e..fcbf0079d1f36c43bf1bca98cbd1d547cabe747b 100644 --- a/docs/simplesamlphp-artifact-idp.md +++ b/docs/simplesamlphp-artifact-idp.md @@ -35,11 +35,11 @@ Enabling artifact on the IdP To enable the IdP to send artifacts, you must add the `saml20.sendartifact` option to the `saml20-idp-hosted` metadata file: - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ [....] 'auth' => 'example-userpass', 'saml20.sendartifact' => TRUE, - ); + ]; Add new metadata to SPs @@ -49,13 +49,13 @@ After enabling the Artifact binding, your IdP metadata will change to add a Arti You therefore need to update the metadata for your IdP at your SPs. `saml20-idp-remote` metadata for SimpleSAMLphp SPs should contain something like: - 'ArtifactResolutionService' => array( - array( + 'ArtifactResolutionService' => [ + [ 'index' => 0, 'Location' => 'https://idp.example.org/simplesaml/saml2/idp/ArtifactResolutionService.php', 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP', - ), - ), + ], + ], SP metadata on the IdP @@ -66,16 +66,16 @@ This means that you must use the complex endpoint format in `saml20-sp-remote` m In general, that should look something like: 'AssertionConsumerService' => array ( - array( + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', 'Location' => 'https://sp.example.org/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp', 'index' => 0, - ), - array( + ], + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', 'Location' => 'https://sp.example.org/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp', 'index' => 2, - ), + ], ), (The specific values of the various fields will vary depending on the SP.) @@ -89,9 +89,9 @@ You may therefore have to add the webserver certificate to the metadata that you To do this, you need to set the `https.certificate` option in the `saml20-idp-hosted` metadata file. That option should refer to a file containing the webserver certificate. - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ [....] 'auth' => 'example-userpass', 'saml20.sendartifact' => TRUE, 'https.certificate' => '/etc/apache2/webserver.crt', - ); + ]; diff --git a/docs/simplesamlphp-artifact-sp.md b/docs/simplesamlphp-artifact-sp.md index 6b18119ce8ab464b71959fee98c0a88d26f4a2cf..7571454e611061fcfde9e06300d3282b47b10357 100644 --- a/docs/simplesamlphp-artifact-sp.md +++ b/docs/simplesamlphp-artifact-sp.md @@ -19,11 +19,11 @@ When this is done, you can add the metadata of your SP to the IdP, and test the Example configuration --------------------- - 'artifact-sp' => array( + 'artifact-sp' => [ 'saml:SP', 'ProtocolBinding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', 'privatekey' => 'sp.example.org.pem', 'certificate' => 'sp.example.org.crt', - ), + ], See the [SP configuration reference](./saml:sp) for a description of the options. diff --git a/docs/simplesamlphp-authproc.md b/docs/simplesamlphp-authproc.md index d082a8255c805ad2bce82db7880956b31b4f4f3e..d66762e4bb0487265cb13bed7b220c564d001348 100644 --- a/docs/simplesamlphp-authproc.md +++ b/docs/simplesamlphp-authproc.md @@ -44,20 +44,20 @@ How to configure Auth Proc Filters The configuration of *Auth Proc Filters* is a list of filters with priority as *index*. Here is an example of *Auth Proc Filters* configured in `config.php`: - 'authproc.idp' => array( - 10 => array( + 'authproc.idp' => [ + 10 => [ 'class' => 'core:AttributeMap', 'addurnprefix' - ), + ], 20 => 'core:TargetedID', 50 => 'core:AttributeLimit', - 90 => array( + 90 => [ 'class' => 'consent:Consent', 'store' => 'consent:Cookie', 'focus' => 'yes', 'checked' => TRUE - ), - ), + ], + ], This configuration will execute *Auth Proc Filters* one by one, with the priority value in increasing order. When *Auth Proc Filters* is configured in multiple places, in example both globally, in the hosted IdP and remote SP metadata, then the list is interleaved sorted by priority. @@ -73,18 +73,18 @@ When you know the class definition of a filter, and the priority, the simple way This is analogous to: - 20 => array( + 20 => [ 'class' => 'core:TargetedID' - ), + ], Some *Auth Proc Filters* have optional or required *parameters*. To send parameters to *Auth Proc Filters*, you need to choose the second of the two alernatives above. Here is an example of provided parameters to the consent module: - 90 => array( + 90 => [ 'class' => 'consent:Consent', 'store' => 'consent:Cookie', 'focus' => 'yes', 'checked' => TRUE - ), + ], ### Filters in `config.php` @@ -105,15 +105,15 @@ The filters in `authproc.sp` will be executed at the SP side regardless of which Filters can be added both in `hosted` and `remote` metadata. Here is an example of a filter added in a metadata file: - '__DYNAMIC:1__' => array( + '__DYNAMIC:1__' => [ 'host' => '__DEFAULT_', 'privatekey' => 'example.org.pem', 'certificate' => 'example.org.crt', 'auth' => 'feide', - 'authproc' => array( + 'authproc' => [ 40 => 'preprodwarning:Warning', - ), - ) + ], + ] The example above is in `saml20-idp-hosted`. @@ -145,6 +145,7 @@ The following filters are included in the SimpleSAMLphp distribution: - [`expirycheck:ExpiryDate`](./expirycheck:expirycheck): Block access to accounts that have expired. - [`preprodwarning:Warning`](./preprodwarning:warning): Warn the user about accessing a test IdP. - [`saml:AttributeNameID`](./saml:nameid): Generate custom NameID with the value of an attribute. +- [`saml:AuthnContextClassRef`](./saml:authproc_authncontextclassref): Set the authentication context in the response. - [`saml:ExpectedAuthnContextClassRef`](./saml:authproc_expectedauthncontextclassref): Verify the user's authentication context. - [`saml:FilterScopes`](./saml:filterscopes): Filter attribute values with scopes forbidden for an IdP. - [`saml:NameIDAttribute`](./saml:nameidattribute): Create an attribute based on the NameID we receive from the IdP. diff --git a/docs/simplesamlphp-automated_metadata.md b/docs/simplesamlphp-automated_metadata.md index 54eba451099d4108c77a6968d694e109f400116a..cc40de2ceb6f5367dc6edf95b91e5462f0d40ddd 100644 --- a/docs/simplesamlphp-automated_metadata.md +++ b/docs/simplesamlphp-automated_metadata.md @@ -68,43 +68,43 @@ Now we are going to proceed to configure the metarefresh module. First, edit the Here's an example of a possible configuration for both the Kalmar Federation and UK Access Management Federation: - $config = array( - 'sets' => array( - 'kalmar' => array( - 'cron' => array('hourly'), - 'sources' => array( - array( + $config = [ + 'sets' => [ + 'kalmar' => [ + 'cron' => ['hourly'], + 'sources' => [ + [ 'src' => 'https://kalmar.feide.no/simplesaml/module.php/aggregator/?id=kalmarcentral&mimetype=text/plain&exclude=norway', - 'certificates' => array( + 'certificates' => [ 'current.crt', 'rollover.crt', - ), - 'template' => array( - 'tags' => array('kalmar'), - 'authproc' => array( - 51 => array('class' => 'core:AttributeMap', 'oid2name'), - ), - ), - ), - ), + ], + 'template' => [ + 'tags' => ['kalmar'], + 'authproc' => [ + 51 => ['class' => 'core:AttributeMap', 'oid2name'], + ], + ], + ], + ], 'expireAfter' => 60*60*24*4, // Maximum 4 days cache time. 'outputDir' => 'metadata/metarefresh-kalmar/', 'outputFormat' => 'flatfile', - ), - 'uk' => array( - 'cron' => array('hourly'), - 'sources' => array( - array( + ], + 'uk' => [ + 'cron' => ['hourly'], + 'sources' => [ + [ 'src' => 'http://metadata.ukfederation.org.uk/ukfederation-metadata.xml', 'validateFingerprint' => 'D0:E8:40:25:F0:B1:2A:CC:74:22:ED:C3:87:04:BC:29:BB:7B:9A:40', - ), - ), + ], + ], 'expireAfter' => 60*60*24*4, // Maximum 4 days cache time. 'outputDir' => 'metadata/metarefresh-ukaccess/', 'outputFormat' => 'serialize', - ), - ) - ); + ], + ] + ]; The configuration consists of one or more metadata sets. Each metadata set has its own configuration, representing a metadata set of sources. @@ -180,11 +180,11 @@ web-server write access to the output directories. Following the previous exampl Now you can configure SimpleSAMLphp to use the metadata fetched by metarefresh. Edit the main config.php file, and modify the `metadata.sources` directive accordingly: - 'metadata.sources' => array( - array('type' => 'flatfile'), - array('type' => 'flatfile', 'directory' => 'metadata/metarefresh-kalmar'), - array('type' => 'serialize', 'directory' => 'metadata/metarefresh-ukaccess'), - ), + 'metadata.sources' => [ + ['type' => 'flatfile'], + ['type' => 'flatfile', 'directory' => 'metadata/metarefresh-kalmar'], + ['type' => 'serialize', 'directory' => 'metadata/metarefresh-ukaccess'], + ], Remember that the `type` parameter here must match the `outputFormat` in the configuration of the module. diff --git a/docs/simplesamlphp-customauth.md b/docs/simplesamlphp-customauth.md index a11a3e5ce38090bcc06200c943396e34bcd80232..ac9b04e2456248c8ab91e7667136b500b1ee069c 100644 --- a/docs/simplesamlphp-customauth.md +++ b/docs/simplesamlphp-customauth.md @@ -45,11 +45,11 @@ Create the file `modules/mymodule/lib/Auth/Source/MyAuth.php` with the following if ($username !== 'theusername' || $password !== 'thepassword') { throw new \SimpleSAML\Error\Error('WRONGUSERPASS'); } - return array( - 'uid' => array('theusername'), - 'displayName' => array('Some Random User'), - 'eduPersonAffiliation' => array('member', 'employee'), - ); + return [ + 'uid' => ['theusername'], + 'displayName' => ['Some Random User'], + 'eduPersonAffiliation' => ['member', 'employee'], + ]; } } @@ -78,19 +78,19 @@ Before we can test our authentication source, we must add an entry for it in `co The entry looks like this: - 'myauthinstance' => array( + 'myauthinstance' => [ 'mymodule:MyAuth', - ), + ], You can add it to the beginning of the list, so that the file looks something like this: <?php - $config = array( - 'myauthinstance' => array( + $config = [ + 'myauthinstance' => [ 'mymodule:MyAuth', - ), + ], /* Other authentication sources follow. */ - ); + ]; `myauthinstance` is the name of this instance of the authentication source. (You are allowed to have multiple instances of an authentication source with different configuration.) @@ -124,7 +124,7 @@ In that file you should locate the `auth`-option for your IdP, and change it to <?php /* ... */ - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ /* ... */ /* * Authentication source to use. Must be one that is configured in @@ -132,7 +132,7 @@ In that file you should locate the `auth`-option for your IdP, and change it to */ 'auth' => 'myauthinstance', /* ... */ - ); + ]; You can then test logging in to the IdP. If you have logged in previously, you may need to log out first. @@ -189,22 +189,22 @@ The complete class file should look like this: if ($username !== $this->username || $password !== $this->password) { throw new \SimpleSAML\Error\Error('WRONGUSERPASS'); } - return array( - 'uid' => array($this->username), - 'displayName' => array('Some Random User'), - 'eduPersonAffiliation' => array('member', 'employee'), - ); + return [ + 'uid' => [$this->username], + 'displayName' => ['Some Random User'], + 'eduPersonAffiliation' => ['member', 'employee'], + ]; } } We can then update our entry in `config/authsources.php` with the configuration options: - 'myauthinstance' => array( + 'myauthinstance' => [ 'mymodule:MyAuth', 'username' => 'theconfigusername', 'password' => 'theconfigpassword', - ), + ], Next, you should go to the "Test configured authentication sources" page again, and test logging in. Note that we have updated the username & password to "theconfigusername" and "theconfigpassword". @@ -314,7 +314,7 @@ The class follows: */ $st = $db->prepare('SELECT username, password_hash, full_name FROM userdb WHERE username=:username'); - if (!$st->execute(array('username' => $username))) { + if (!$st->execute(['username' => $username])) { throw new Exception('Failed to query database for user.'); } @@ -334,11 +334,11 @@ The class follows: } /* Create the attribute array of the user. */ - $attributes = array( - 'uid' => array($username), - 'displayName' => array($row['full_name']), - 'eduPersonAffiliation' => array('member', 'employee'), - ); + $attributes = [ + 'uid' => [$username], + 'displayName' => [$row['full_name']], + 'eduPersonAffiliation' => ['member', 'employee'], + ]; /* Return the attributes. */ return $attributes; @@ -348,10 +348,10 @@ The class follows: And configured in `config/authsources.php`: - 'myauthinstance' => array( + 'myauthinstance' => [ 'mymodule:MyAuth', 'dsn' => 'mysql:host=sql.example.org;dbname=userdatabase', 'username' => 'db_username', 'password' => 'secret_db_password', - ), + ], diff --git a/docs/simplesamlphp-database.md b/docs/simplesamlphp-database.md index 01fbd5d9421491514722d9295c8780572f8b1b53..b9a797a00b2bcf5fc3fec803d0aaab577e1e5ad9 100644 --- a/docs/simplesamlphp-database.md +++ b/docs/simplesamlphp-database.md @@ -47,20 +47,20 @@ Since the database class allows administrators to configure master and slave dat The write function takes 2 parameters: SQL, params. $table = $db->applyPrefix("test"); - $values = array( + $values = [ 'id' => 20, 'data' => 'Some data', - ); + ]; $query = $db->write("INSERT INTO $table (id, data) VALUES (:id, :data)", $values); The values specified in the $values array will be bound to the placeholders and will be executed on the master. By default, values are binded as PDO::PARAM_STR. If you need to override this, you can specify it in the values array. $table = $db->applyPrefix("test"); - $values = array( - 'id' => array(20, PDO::PARAM_INT), + $values = [ + 'id' => [20, PDO::PARAM_INT], 'data' => 'Some data', - ); + ]; $query = $db->write("INSERT INTO $table (id, data) VALUES (:id, :data)", $values); @@ -75,17 +75,17 @@ Since the database class allows administrators to configure master and slave dat The read function takes 2 parameters: SQL, params. $table = $db->applyPrefix("test"); - $values = array( + $values = [ 'id' => 20, - ); + ]; $query = $db->read("SELECT * FROM $table WHERE id = :id", $values); The values specified in the $values array will be bound to the placeholders and will be executed on the selected slave. By default, values are binded as PDO::PARAM_STR. If you need to override this, you can specify it in the values array. $table = $db->applyPrefix("test"); - $values = array( - 'id' => array(20, PDO::PARAM_INT), - ); + $values = [ + 'id' => [20, PDO::PARAM_INT], + ]; $query = $db->read("SELECT * FROM $table WHERE id = :id", $values); diff --git a/docs/simplesamlphp-ecp-idp.md b/docs/simplesamlphp-ecp-idp.md index 28ac7f90a125dc2b14c1915cfa46755d82009453..566df182d610f989b349ee5a74aa4631d5ff3f3d 100644 --- a/docs/simplesamlphp-ecp-idp.md +++ b/docs/simplesamlphp-ecp-idp.md @@ -19,11 +19,11 @@ Enabling ECP Profile on the IdP To enable the IdP to send ECP assertions you must add the `saml20.ecp` option to the `saml20-idp-hosted` metadata file: - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ [....] 'auth' => 'example-userpass', 'saml20.ecp' => true, - ); + ]; Note: authentication filters that require interaction with the user will not work with ECP. diff --git a/docs/simplesamlphp-errorhandling.md b/docs/simplesamlphp-errorhandling.md index 1c9c8097c824cc265c0e7e9c6acd12cfc268b955..f7251550b6ccc801c6d7ed25c504217099b2b4fb 100644 --- a/docs/simplesamlphp-errorhandling.md +++ b/docs/simplesamlphp-errorhandling.md @@ -205,11 +205,11 @@ The code for handling this becomes something like: $procChain = [...]; - $state = array( + $state = [ 'ReturnURL' => \SimpleSAML\Utils\HTTP::getSelfURLNoQuery(), \SimpleSAML\Auth\State::EXCEPTION_HANDLER_URL => \SimpleSAML\Utils\HTTP::getSelfURLNoQuery(), [...], - ) + ] try { $procChain->processState($state); diff --git a/docs/simplesamlphp-googleapps.md b/docs/simplesamlphp-googleapps.md index 3eba11a6a634d221c2fcbcbe29ded49a87c9685b..5f8cfbd3c03cc938d92c869bf398c4360f4d3e1e 100644 --- a/docs/simplesamlphp-googleapps.md +++ b/docs/simplesamlphp-googleapps.md @@ -100,17 +100,17 @@ The next step is to create an authentication source with this module. An authent In this example we will use `example-userpass`, and hence that section is what matters and will be used. <?php - $config = array( - 'example-userpass' => array( + $config = [ + 'example-userpass' => [ 'exampleauth:UserPass', - 'student:studentpass' => array( - 'uid' => array('student'), - ), - 'employee:employeepass' => array( - 'uid' => array('employee'), - ), - ), - ); + 'student:studentpass' => [ + 'uid' => ['student'], + ], + 'employee:employeepass' => [ + 'uid' => ['employee'], + ], + ], + ]; ?> This configuration creates two users - `student` and `employee`, with the passwords `studentpass` and `employeepass`. The username and password are stored in the array index `student:studentpass` for the `student`-user. The attributes (only `uid` in this example) will be returned by the IdP when the user logs on. @@ -127,7 +127,7 @@ If you want to setup a SAML 2.0 IdP for Google Apps, you need to configure two m This is the configuration of the IdP itself. Here is some example config: // The SAML entity ID is the index of this config. Dynamic:X will automatically generate an entity ID (recommended) - $metadata['__DYNAMIC:1__'] => array( + $metadata['__DYNAMIC:1__'] => [ // The hostname of the server (VHOST) that this SAML entity will use. 'host' => '__DEFAULT__', @@ -137,7 +137,7 @@ This is the configuration of the IdP itself. Here is some example config: 'certificate' => 'googleappsidp.crt', 'auth' => 'example-userpass', - ) + ] **Note**: You can only have one entry in the file with host equal to `__DEFAULT__`, therefore you should replace the existing entry with this one, instead of adding this entry as a new entry in the file. @@ -152,12 +152,12 @@ In the `saml20-sp-remote.php` file we will configure an entry for G Suite (Googl * at G Suite. E.g. if your google account is foo.com, and you have a user with email john@foo.com, then you * must set the simplesaml.nameidattribute to be the name of an attribute that for this user has the value of 'john'. */ - $metadata['https://www.google.com/a/g.feide.no'] => array( + $metadata['https://www.google.com/a/g.feide.no'] => [ 'AssertionConsumerService' => 'https://www.google.com/a/g.feide.no/acs', 'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress', 'simplesaml.nameidattribute' => 'uid', 'simplesaml.attributes' => false - ); + ]; You must also map some attributes received from the authentication module into email field sent to Google Apps. In this example, the `uid` attribute is set. When you later configure the IdP to connect to a LDAP directory or some other authentication source, make sure that the `uid` attribute is set properly, or you can configure another attribute to use here. The `uid` attribute contains the local part of the user name. diff --git a/docs/simplesamlphp-hok-idp.md b/docs/simplesamlphp-hok-idp.md index e34a6b827d844699abbf85dbe2abf1c5c31befbe..a2315bf7481a9ca598b4d015c693941310d0a51e 100644 --- a/docs/simplesamlphp-hok-idp.md +++ b/docs/simplesamlphp-hok-idp.md @@ -29,11 +29,11 @@ Enabling HoK SSO Profile on the IdP To enable the IdP to send HoK assertions you must add the `saml20.hok.assertion` option to the `saml20-idp-hosted` metadata file: - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ [....] 'auth' => 'example-userpass', 'saml20.hok.assertion' => TRUE, - ); + ]; Add new metadata to SPs ----------------------- @@ -62,16 +62,16 @@ This means that you have to use the complex endpoint format in `saml20-sp-remote In general, this should look like the following code: 'AssertionConsumerService' => array ( - array( + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', 'Location' => 'https://sp.example.org/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp', 'index' => 0, - ), - array( + ], + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser', 'Location' => 'https://sp.example.org/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp', 'index' => 4, - ), + ], ), (The specific values of the various fields will vary depending on the SP.) diff --git a/docs/simplesamlphp-hok-sp.md b/docs/simplesamlphp-hok-sp.md index a687896c529cba118c98845dddb0123b5a6000bd..4b12a113af316f9463c06bfb7c9b2eed95b057a1 100644 --- a/docs/simplesamlphp-hok-sp.md +++ b/docs/simplesamlphp-hok-sp.md @@ -31,10 +31,10 @@ To enable support for the HoK SSO Profile in the SP, the `saml20.hok.assertion` This option can also be enabled in the `saml20-idp-remote` metadata file, but in that case the endpoint will not be added to the SP metadata. You must also send authentication requests specifying the Holder-of-Key profile to the IdP. This is controlled by the `ProtocolBinding` option in the SP configuration. - 'hok-sp' => array( + 'hok-sp' => [ 'saml:SP', 'saml20.hok.assertion' => TRUE, 'ProtocolBinding' => 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser', - ), + ], When this is done, you can add the metadata of your SP to the IdP and test the authentication. diff --git a/docs/simplesamlphp-idp.md b/docs/simplesamlphp-idp.md index 3654d237f20b1a6d9bca0b2418f745cd596291c2..1401d1d543800e8b414786c0f4d8660cecff6b1e 100644 --- a/docs/simplesamlphp-idp.md +++ b/docs/simplesamlphp-idp.md @@ -96,26 +96,26 @@ The next step is to create an authentication source with this module. An authent In this setup, this file should contain a single entry: <?php - $config = array( - 'example-userpass' => array( + $config = [ + 'example-userpass' => [ 'exampleauth:UserPass', - 'student:studentpass' => array( - 'uid' => array('student'), - 'eduPersonAffiliation' => array('member', 'student'), - ), - 'employee:employeepass' => array( - 'uid' => array('employee'), - 'eduPersonAffiliation' => array('member', 'employee'), - ), - ), - ); + 'student:studentpass' => [ + 'uid' => ['student'], + 'eduPersonAffiliation' => ['member', 'student'], + ], + 'employee:employeepass' => [ + 'uid' => ['employee'], + 'eduPersonAffiliation' => ['member', 'employee'], + ], + ], + ]; This configuration creates two users - `student` and `employee`, with the passwords `studentpass` and `employeepass`. The username and password is stored in the array index (`student:studentpass` for the `student`-user. The attributes for each user is configured in the array referenced by the index. For the student user, these are: - array( - 'uid' => array('student'), - 'eduPersonAffiliation' => array('member', 'student'), - ), + [ + 'uid' => ['student'], + 'eduPersonAffiliation' => ['member', 'student'], + ], The attributes will be returned by the IdP when the user logs on. @@ -145,7 +145,7 @@ The SAML 2.0 IdP is configured by the metadata stored in This is a minimal configuration: <?php - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ /* * The hostname for this IdP. This makes it possible to run multiple * IdPs from the same configuration. '__DEFAULT__' means that this one @@ -165,7 +165,7 @@ This is a minimal configuration: * user. This must match one of the entries in config/authsources.php. */ 'auth' => 'example-userpass', - ); + ]; For more information about available options in the idp-hosted metadata files, see the [IdP hosted reference](simplesamlphp-reference-idp-hosted). @@ -179,10 +179,10 @@ We therefore recommended enabling this in new installations. This can be done by adding the following to the saml20-idp-hosted configuration: 'attributes.NameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri', - 'authproc' => array( + 'authproc' => [ // Convert LDAP names to oids. - 100 => array('class' => 'core:AttributeMap', 'name2oid'), - ), + 100 => ['class' => 'core:AttributeMap', 'name2oid'], + ], Adding SPs to the IdP @@ -193,10 +193,10 @@ This is configured by metadata stored in `metadata/saml20-sp-remote.php`. This is a minimal example of a `metadata/saml20-sp-remote.php` metadata file for a SimpleSAMLphp SP: <?php - $metadata['https://sp.example.org/simplesaml/module.php/saml/sp/metadata.php/default-sp'] = array( + $metadata['https://sp.example.org/simplesaml/module.php/saml/sp/metadata.php/default-sp'] = [ 'AssertionConsumerService' => 'https://sp.example.org/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp', 'SingleLogoutService' => 'https://sp.example.org/simplesaml/module.php/saml/sp/saml2-logout.php/default-sp', - ); + ]; Note that the URI in the entityID and the URLs to the AssertionConsumerService and SingleLogoutService endpoints change between different service providers. If you have the metadata of the remote SP as an XML file, you can use the built-in XML to SimpleSAMLphp metadata converter, which by default is available as `/admin/metadata-converter.php` in your SimpleSAMLphp installation. @@ -252,7 +252,7 @@ To send the RelayState parameter from a SimpleSAMLphp IdP, specify it in the que To set it in the SP configuration, add it to `authsources.php`: - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', 'RelayState' => 'https://sp.example.org/welcome.php', - ), + ], diff --git a/docs/simplesamlphp-maintenance.md b/docs/simplesamlphp-maintenance.md index cfd2d7e3766a20921ea6e9b0b1fc89e0c106d534..ff4581b034555c381e814763afddcb3d0383f299 100644 --- a/docs/simplesamlphp-maintenance.md +++ b/docs/simplesamlphp-maintenance.md @@ -96,26 +96,26 @@ Here are two examples of configuration of memcache session handling: Example of redundant configuration with load balancing: This configuration makes it possible to lose both servers in the a-group or both servers in the b-group without losing any sessions. Note that sessions will be lost if one server is lost from both the a-group and the b-group. - 'memcache_store.servers' => array( - array( - array('hostname' => 'mc_a1'), - array('hostname' => 'mc_a2'), - ), - array( - array('hostname' => 'mc_b1'), - array('hostname' => 'mc_b2'), - ), - ), + 'memcache_store.servers' => [ + [ + ['hostname' => 'mc_a1'], + ['hostname' => 'mc_a2'], + ], + [ + ['hostname' => 'mc_b1'], + ['hostname' => 'mc_b2'], + ], + ], **Example 2. Example of simple configuration with only one memcache server** Example of simple configuration with only one memcache server, running on the same computer as the web server: Note that all sessions will be lost if the memcache server crashes. - 'memcache_store.servers' => array( - array( - array('hostname' => 'localhost'), - ), - ), + 'memcache_store.servers' => [ + [ + ['hostname' => 'localhost'], + ], + ], The expiration value (`memcache_store.expires`) is the duration for which data should be retained in memcache. Data are dropped from the memcache servers when this time expires. The time will be reset every time the data is written to the memcache servers. @@ -170,11 +170,11 @@ Several metadata storage backends are available by default, including `flatfile` example configuration of different metadata sources in use at the same time: ``` -'metadata.sources' => array( - array('type' => 'flatfile'), - array('type' => 'flatfile', 'directory' => 'metadata/metarefresh-kalmar'), - array('type' => 'serialize', 'directory' => 'metadata/metarefresh-ukaccess'), -), +'metadata.sources' => [ + ['type' => 'flatfile'], + ['type' => 'flatfile', 'directory' => 'metadata/metarefresh-kalmar'], + ['type' => 'serialize', 'directory' => 'metadata/metarefresh-ukaccess'], +], ``` You may also implement your own metadata storage handler, in a very similar way to how you would implement @@ -245,7 +245,7 @@ To add support for a new language, add your new language to the `language.availa /* * Languages available and which language is default */ - 'language.available' => array('en', 'no', 'da', 'es', 'xx'), + 'language.available' => ['en', 'no', 'da', 'es', 'xx'], 'language.default' => 'en', Please use the standardized two-character @@ -255,11 +255,11 @@ You also can set the default language. You should ensure that the default langua All strings that can be localized are found in the files `dictionaries/`. Add a new entry for each string, with your language code, like this: - 'user_pass_header' => array( + 'user_pass_header' => [ 'en' => 'Enter your username and password', 'no' => 'Skriv inn brukernavn og passord', 'xx' => 'Pooa jujjique jamba', - ), + ], You can translate as many of the texts as you would like; a full translation is not required unless you want to make this the default language. From the end users point of view, it looks best if all text fragments used in a given screen or form is in one single language. diff --git a/docs/simplesamlphp-metadata-endpoints.md b/docs/simplesamlphp-metadata-endpoints.md index 9bca9088db0db348b6d3a4ecd37cc03b0f5b827d..7200c9187de4ede82b371c1ec2de02306d06e319 100644 --- a/docs/simplesamlphp-metadata-endpoints.md +++ b/docs/simplesamlphp-metadata-endpoints.md @@ -32,10 +32,10 @@ It can be used when there is only a single endpoint that uses the default bindin Array of strings ---------------- - 'AssertionConsumerService' => array( + 'AssertionConsumerService' => [ 'https://site1.example.org/ACS', 'https://site2.example.org/ACS', - ), + ], This endpoint format can be used to represent multiple endpoints, all of which use the default binding. @@ -43,28 +43,28 @@ This endpoint format can be used to represent multiple endpoints, all of which u Array of arrays --------------- - 'AssertionConsumerService' => array( - array( + 'AssertionConsumerService' => [ + [ 'index' => 1, 'isDefault' => TRUE, 'Location' => 'https://sp.example.org/ACS', 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', - ), - array( + ], + [ 'index' => 2, 'Location' => 'https://sp.example.org/ACS', 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', - ), - ), + ], + ], This endpoint format allows for specifying multiple endpoints with different bindings. It can also be used to specify the ResponseLocation attribute on endpoints, e.g. on `SingleLogoutService`: - 'SingleLogoutService' => array( - array( + 'SingleLogoutService' => [ + [ 'Location' => 'https://sp.example.org/LogoutRequest', 'ResponseLocation' => 'https://sp.example.org/LogoutResponse', 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', - ), - ), + ], + ], diff --git a/docs/simplesamlphp-metadata-extensions-attributes.md b/docs/simplesamlphp-metadata-extensions-attributes.md index 7e3c1c0bccccc91098d294970d10c410547331d1..832bc9c7d99106362f7cf65d34ccddb118524338 100644 --- a/docs/simplesamlphp-metadata-extensions-attributes.md +++ b/docs/simplesamlphp-metadata-extensions-attributes.md @@ -19,14 +19,14 @@ The `metadata/saml20-idp-hosted.php` entries are used to define the metadata extension items. An example of this is: <?php - $metadata['entity-id-1'] = array( + $metadata['entity-id-1'] = [ /* ... */ - 'EntityAttributes' => array( - 'urn:simplesamlphp:v1:simplesamlphp' => array('is', 'really', 'cool'), - '{urn:simplesamlphp:v1}foo' => array('bar'), - ), + 'EntityAttributes' => [ + 'urn:simplesamlphp:v1:simplesamlphp' => ['is', 'really', 'cool'], + '{urn:simplesamlphp:v1}foo' => ['bar'], + ], /* ... */ - ); + ]; The OASIS specification primarily defines how to include arbitrary `Attribute` and `Assertion` elements within the metadata for an IdP. @@ -43,9 +43,9 @@ metadata. Each item in the `EntityAttributes` array defines a new array. Each item in this array produces a separte `<AttributeValue>` element within the `<Attribute>` element. - 'EntityAttributes' => array( - 'urn:simplesamlphp:v1:simplesamlphp' => array('is', 'really', 'cool'), - ), + 'EntityAttributes' => [ + 'urn:simplesamlphp:v1:simplesamlphp' => ['is', 'really', 'cool'], + ], This generates: @@ -58,9 +58,9 @@ This generates: Each `<Attribute>` element requires a `NameFormat` attribute. This is specified using curly braces at the beginning of the key name: - 'EntityAttributes' => array( - '{urn:simplesamlphp:v1}foo' => array('bar'), - ), + 'EntityAttributes' => [ + '{urn:simplesamlphp:v1}foo' => ['bar'], + ], This generates: @@ -76,17 +76,17 @@ Generated XML Metadata Examples If given the following configuration... - $metadata['https://www.example.com/saml/saml2/idp/metadata.php'] = array( + $metadata['https://www.example.com/saml/saml2/idp/metadata.php'] = [ 'host' => 'www.example.com', 'certificate' => 'example.com.crt', 'privatekey' => 'example.com.pem', 'auth' => 'example-userpass', - 'EntityAttributes' => array( - 'urn:simplesamlphp:v1:simplesamlphp' => array('is', 'really', 'cool'), - '{urn:simplesamlphp:v1}foo' => array('bar'), - ), - ); + 'EntityAttributes' => [ + 'urn:simplesamlphp:v1:simplesamlphp' => ['is', 'really', 'cool'], + '{urn:simplesamlphp:v1}foo' => ['bar'], + ], + ]; ... will generate the following XML metadata: diff --git a/docs/simplesamlphp-metadata-extensions-rpi.md b/docs/simplesamlphp-metadata-extensions-rpi.md index 4799de19bb347347794dbf86222e071aa5e93a93..a6dc868e772c3da16b1524074eecc539b17c5e64 100644 --- a/docs/simplesamlphp-metadata-extensions-rpi.md +++ b/docs/simplesamlphp-metadata-extensions-rpi.md @@ -59,54 +59,54 @@ Examples Service Provider: - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', 'entityID' => NULL, ... - 'RegistrationInfo' => array( + 'RegistrationInfo' => [ 'authority' => 'urn:mace:sp.example.org', 'instant' => '2008-01-17T11:28:03.577Z', - 'policies' => array('en' => 'http://sp.example.org/policy', 'es' => 'http://sp.example.org/politica'), - ), - ), + 'policies' => ['en' => 'http://sp.example.org/policy', 'es' => 'http://sp.example.org/politica'], + ], + ], Identity Provider: - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ 'host' => '__DEFAULT__', ... - 'RegistrationInfo' => array( + 'RegistrationInfo' => [ 'authority' => 'urn:mace:idp.example.org', 'instant' => '2008-01-17T11:28:03.577Z', - ), - ); + ], + ]; `aggregator` module: - $config = array( - 'aggregators' => array( + $config = [ + 'aggregators' => [ ... - ), + ], 'maxDuration' => 60*60*24*5, 'reconstruct' => FALSE, ... - 'RegistrationInfo' => array( + 'RegistrationInfo' => [ 'authority' => 'urn:mace:example.federation', 'instant' => '2008-01-17T11:28:03Z', - 'policies' => array('en' => 'http://example.org/federation_policy', 'es' => 'https://example.org/politica_federacion'), - ), - ); + 'policies' => ['en' => 'http://example.org/federation_policy', 'es' => 'https://example.org/politica_federacion'], + ], + ]; `aggregator2` module: - $config = array( - 'example.org' => array( - 'sources' => array( + $config = [ + 'example.org' => [ + 'sources' => [ ... - ), - 'RegistrationInfo' => array( + ], + 'RegistrationInfo' => [ 'authority' => 'urn:mace:example.federation', - 'policies' => array('en' => 'http://example.org/federation_policy', 'es' => 'https://example.org/politica_federacion'), - ), - ), - ); + 'policies' => ['en' => 'http://example.org/federation_policy', 'es' => 'https://example.org/politica_federacion'], + ], + ], + ]; diff --git a/docs/simplesamlphp-metadata-extensions-ui.md b/docs/simplesamlphp-metadata-extensions-ui.md index f9627b93e6206bc0c53e26c5e091058335c640ef..10dd3aba08de0354cc3da718aed118717aeef3d3 100644 --- a/docs/simplesamlphp-metadata-extensions-ui.md +++ b/docs/simplesamlphp-metadata-extensions-ui.md @@ -23,72 +23,72 @@ the relevant entry in `authsources.php`. An example for an IdP: <?php - $metadata['entity-id-1'] = array( + $metadata['entity-id-1'] = [ /* ... */ - 'UIInfo' => array( - 'DisplayName' => array( + 'UIInfo' => [ + 'DisplayName' => [ 'en' => 'English name', 'es' => 'Nombre en Español', - ), - 'Description' => array( + ], + 'Description' => [ 'en' => 'English description', 'es' => 'DescripciĂłn en Español', - ), - 'InformationURL' => array( + ], + 'InformationURL' => [ 'en' => 'http://example.com/info/en', 'es' => 'http://example.com/info/es', - ), - 'PrivacyStatementURL' => array( + ], + 'PrivacyStatementURL' => [ 'en' => 'http://example.com/privacy/en', 'es' => 'http://example.com/privacy/es', - ), - 'Keywords' => array( - 'en' => array('communication', 'federated session'), - 'es' => array('comunicaciĂłn', 'sesiĂłn federated'), - ), - 'Logo' => array( - array( + ], + 'Keywords' => [ + 'en' => ['communication', 'federated session'], + 'es' => ['comunicaciĂłn', 'sesiĂłn federated'], + ], + 'Logo' => [ + [ 'url' => 'http://example.com/logo1.png', 'height' => 200, 'width' => 400, 'lang' => 'en', - ), - array( + ], + [ 'url' => 'http://example.com/logo2.png', 'height' => 201, 'width' => 401, - ), - ), - ), - 'DiscoHints' => array( - 'IPHint' => array('130.59.0.0/16', '2001:620::0/96'), - 'DomainHint' => array('example.com', 'www.example.com'), - 'GeolocationHint' => array('geo:47.37328,8.531126', 'geo:19.34343,12.342514'), - ), + ], + ], + ], + 'DiscoHints' => [ + 'IPHint' => ['130.59.0.0/16', '2001:620::0/96'], + 'DomainHint' => ['example.com', 'www.example.com'], + 'GeolocationHint' => ['geo:47.37328,8.531126', 'geo:19.34343,12.342514'], + ], /* ... */ - ); + ]; And for an SP it could look like this: <?php - $config = array( + $config = [ - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', - 'UIInfo' => array( - 'DisplayName' => array( + 'UIInfo' => [ + 'DisplayName' => [ 'en' => 'English name', 'es' => 'Nombre en Español' - ), - 'Description' => array( + ], + 'Description' => [ 'en' => 'English description', 'es' => 'DescripciĂłn en Español' - ), - ), + ], + ], /* ... */ - ), - ); + ], + ]; The OASIS specification primarily defines how an entity can communicate metadata related to IdP or service discovery and identification. There @@ -106,52 +106,52 @@ about an IdP or SP. These properties are all children of the `UIInfo` key. *Note*: Most elements are localized strings that specify the language using the array key as the language-code: - 'DisplayName' => array( + 'DisplayName' => [ 'en' => 'English name', 'es' => 'Nombre en Español', - ), + ], `DisplayName` : The localized list of names for this entity - 'DisplayName' => array( + 'DisplayName' => [ 'en' => 'English name', 'es' => 'Nombre en Español', - ), + ], `Description` : The localized list of statements used to describe this entity - 'Description' => array( + 'Description' => [ 'en' => 'English description', 'es' => 'DescripciĂłn en Español', - ), + ], `InformationURL` : A localized list of URLs where more information about the entity is located. - 'InformationURL' => array( + 'InformationURL' => [ 'en' => 'http://example.com/info/en', 'es' => 'http://example.com/info/es', - ), + ], `PrivacyStatementURL` : A localized list of URLs where the entity's privacy statement is located. - 'PrivacyStatementURL' => array( + 'PrivacyStatementURL' => [ 'en' => 'http://example.com/privacy/en', 'es' => 'http://example.com/privacy/es', - ), + ], `Keywords` : A localized list of keywords used to describe the entity - 'Keywords' => array( - 'en' => array('communication', 'federated session'), - 'es' => array('comunicaciĂłn', 'sesiĂłn federated'), - ), + 'Keywords' => [ + 'en' => ['communication', 'federated session'], + 'es' => ['comunicaciĂłn', 'sesiĂłn federated'], + ], : *Note*: The `+` (plus) character is forbidden by specification from being part of a Keyword. @@ -159,19 +159,19 @@ using the array key as the language-code: `Logo` : The logos used to represent the entity - 'Logo' => array( - array( + 'Logo' => [ + [ 'url' => 'http://example.com/logo1.png', 'height' => 200, 'width' => 400, 'lang' => 'en', - ), - array( + ], + [ 'url' => 'http://example.com/logo2.png', 'height' => 201, 'width' => 401, - ), - ), + ], + ], : An optional `lang` key containing a language-code is supported for localized logos. @@ -188,20 +188,20 @@ key. : This is a list of both IPv4 and IPv6 addresses in CIDR notation services by or associated with this entity. - 'IPHint' => array('130.59.0.0/16', '2001:620::0/96'), + 'IPHint' => ['130.59.0.0/16', '2001:620::0/96'], `DomainHint` : This specifies a list of domain names serviced by or associated with this entity. - 'DomainHint' => array('example.com', 'www.example.com'), + 'DomainHint' => ['example.com', 'www.example.com'], `GeolocationHint` : This specifies a list of geographic coordinates associated with, or serviced by, the entity. Coordinates are given in URI form using the geo URI scheme [RFC5870](http://www.ietf.org/rfc/rfc5870.txt). - 'GeolocationHint' => array('geo:47.37328,8.531126', 'geo:19.34343,12.342514'), + 'GeolocationHint' => ['geo:47.37328,8.531126', 'geo:19.34343,12.342514'], Generated XML Metadata Examples @@ -209,52 +209,52 @@ Generated XML Metadata Examples If given the following configuration... - $metadata['https://www.example.com/saml/saml2/idp/metadata.php'] = array( + $metadata['https://www.example.com/saml/saml2/idp/metadata.php'] = [ 'host' => 'www.example.com', 'certificate' => 'example.com.crt', 'privatekey' => 'example.com.pem', 'auth' => 'example-userpass', - 'UIInfo' => array( - 'DisplayName' => array( + 'UIInfo' => [ + 'DisplayName' => [ 'en' => 'English name', 'es' => 'Nombre en Español', - ), - 'Description' => array( + ], + 'Description' => [ 'en' => 'English description', 'es' => 'DescripciĂłn en Español', - ), - 'InformationURL' => array( + ], + 'InformationURL' => [ 'en' => 'http://example.com/info/en', 'es' => 'http://example.com/info/es', - ), - 'PrivacyStatementURL' => array( + ], + 'PrivacyStatementURL' => [ 'en' => 'http://example.com/privacy/en', 'es' => 'http://example.com/privacy/es', - ), - 'Keywords' => array( - 'en' => array('communication', 'federated session'), - 'es' => array('comunicaciĂłn', 'sesiĂłn federated'), - ), - 'Logo' => array( - array( + ], + 'Keywords' => [ + 'en' => ['communication', 'federated session'], + 'es' => ['comunicaciĂłn', 'sesiĂłn federated'], + ], + 'Logo' => [ + [ 'url' => 'http://example.com/logo1.png', 'height' => 200, 'width' => 400, - ), - array( + ], + [ 'url' => 'http://example.com/logo2.png', 'height' => 201, 'width' => 401, - ), - ), - ), - 'DiscoHints' => array( - 'IPHint' => array('130.59.0.0/16', '2001:620::0/96'), - 'DomainHint' => array('example.com', 'www.example.com'), - 'GeolocationHint' => array('geo:47.37328,8.531126', 'geo:19.34343,12.342514'), - ), - ); + ], + ], + ], + 'DiscoHints' => [ + 'IPHint' => ['130.59.0.0/16', '2001:620::0/96'], + 'DomainHint' => ['example.com', 'www.example.com'], + 'GeolocationHint' => ['geo:47.37328,8.531126', 'geo:19.34343,12.342514'], + ], + ]; ... will generate the following XML metadata: diff --git a/docs/simplesamlphp-metadata-pdostoragehandler.md b/docs/simplesamlphp-metadata-pdostoragehandler.md index 82656fb09be835821cfcf385c543c3f7f1d902e9..9724a6d2e0c60ad36c535a0f3139d9cd7a18ef09 100644 --- a/docs/simplesamlphp-metadata-pdostoragehandler.md +++ b/docs/simplesamlphp-metadata-pdostoragehandler.md @@ -35,10 +35,10 @@ You will first need to configure a PDO metadata source. Here is an example of flatfile plus PDO: - 'metadata.sources' => array( - array('type' => 'flatfile'), - array('type' => 'pdo'), - ), + 'metadata.sources' => [ + ['type' => 'flatfile'], + ['type' => 'pdo'], + ], diff --git a/docs/simplesamlphp-modules.md b/docs/simplesamlphp-modules.md index 300cfb8022fa41456b89c4613d5913ffca713717..ed0df99828b979396e83715f80337c86592c6a10 100644 --- a/docs/simplesamlphp-modules.md +++ b/docs/simplesamlphp-modules.md @@ -150,26 +150,26 @@ authentication source. A typical configuration entry for an authentication source looks like this: - 'example-static' => array( + 'example-static' => [ /* This maps to modules/exampleauth/lib/Auth/Source/Static.php */ 'exampleauth:Static', /* The following is configuration which is passed on to * the exampleauth:Static authentication source. */ 'uid' => 'testuser', - 'eduPersonAffiliation' => array('member', 'employee'), - 'cn' => array('Test User'), - ), + 'eduPersonAffiliation' => ['member', 'employee'], + 'cn' => ['Test User'], + ], To use this authentication source in a SAML 2.0 IdP, set the `auth`-option of the IdP to `'example-static'`: - '__DYNAMIC:1__' => array( + '__DYNAMIC:1__' => [ 'host' => '__DEFAULT__', 'privatekey' => 'example.org.pem', 'certificate' => 'example.org.crt', 'auth' => 'example-static', - ), + ], ### Creating authentication sources diff --git a/docs/simplesamlphp-reference-idp-hosted.md b/docs/simplesamlphp-reference-idp-hosted.md index 4f6fcd7a0325e34cb18240bef03eee77846e9526..276d9b7f66c5bb354a9ad3b141ad11eb210af78a 100644 --- a/docs/simplesamlphp-reference-idp-hosted.md +++ b/docs/simplesamlphp-reference-idp-hosted.md @@ -9,14 +9,14 @@ Both files have the following format: <?php /* The index of the array is the entity ID of this IdP. */ - $metadata['entity-id-1'] = array( + $metadata['entity-id-1'] = [ 'host' => 'idp.example.org', /* Configuration options for the first IdP. */ - ); - $metadata['entity-id-2'] = array( + ]; + $metadata['entity-id-2'] = [ 'host' => '__DEFAULT__', /* Configuration options for the default IdP. */ - ); + ]; /* ... */ The entity ID should be an URI. It can, also be on the form @@ -54,33 +54,33 @@ Common options : Specify contacts in addition to the technical contact configured through config/config.php. For example, specifying a support contact: - 'contacts' => array( - array( + 'contacts' => [ + [ 'contactType' => 'support', 'emailAddress' => 'support@example.org', 'givenName' => 'John', 'surName' => 'Doe', 'telephoneNumber' => '+31(0)12345678', 'company' => 'Example Inc.', - ), - ), + ], + ], : If you have support for a trust framework that requires extra attributes on the contact person element in your IdP metadata (for example, SIRTFI), you can specify an array of attributes on a contact. - 'contacts' => array( - array( + 'contacts' => [ + [ 'contactType' => 'other', 'emailAddress' => 'mailto:abuse@example.org', 'givenName' => 'John', 'surName' => 'Doe', 'telephoneNumber' => '+31(0)12345678', 'company' => 'Example Inc.', - 'attributes' => array( + 'attributes' => [ 'xmlns:remd' => 'http://refeds.org/metadata', 'remd:contactType' => 'http://refeds.org/metadata/contactType/security', - ), - ), - ), + ], + ], + ], `host` : The hostname for this IdP. One IdP can also have the `host`-option @@ -96,10 +96,10 @@ Common options : This option can be translated into multiple languages by specifying the value as an array of language-code to translated name: - 'OrganizationName' => array( + 'OrganizationName' => [ 'en' => 'Example organization', 'no' => 'Eksempel organisation', - ), + ], : *Note*: If you specify this option, you must also specify the `OrganizationURL` option. @@ -430,7 +430,7 @@ These are some examples of IdP metadata * We use the '__DYNAMIC:1__' entity ID so that the entity ID * will be autogenerated. */ - $metadata['__DYNAMIC:1__'] = array( + $metadata['__DYNAMIC:1__'] = [ /* * We use '__DEFAULT__' as the hostname so we won't have to * enter a hostname. @@ -446,4 +446,4 @@ These are some examples of IdP metadata * from config/authsources.php. */ 'auth' => 'example-userpass', - ); + ]; diff --git a/docs/simplesamlphp-reference-idp-remote.md b/docs/simplesamlphp-reference-idp-remote.md index 7908ebc3966748e4cce3b5bb1fe91ab56b610391..af324ef4d681f19973c632ac442dc3f02ae956b4 100644 --- a/docs/simplesamlphp-reference-idp-remote.md +++ b/docs/simplesamlphp-reference-idp-remote.md @@ -7,12 +7,12 @@ This is a reference for metadata options available for `metadata/saml20-idp-remo <?php /* The index of the array is the entity ID of this IdP. */ - $metadata['entity-id-1'] = array( + $metadata['entity-id-1'] = [ /* Configuration options for the first IdP. */ - ); - $metadata['entity-id-2'] = array( + ]; + $metadata['entity-id-2'] = [ /* Configuration options for the second IdP. */ - ); + ]; /* ... */ @@ -50,10 +50,10 @@ The following options are common between both the SAML 2.0 protocol and Shibbole : This option can be translated into multiple languages by specifying the value as an array of language-code to translated name: - 'OrganizationName' => array( + 'OrganizationName' => [ 'en' => 'Example organization', 'no' => 'Eksempel organisation', - ), + ], : *Note*: If you specify this option, you must also specify the `OrganizationURL` option. @@ -80,10 +80,10 @@ The following options are common between both the SAML 2.0 protocol and Shibbole : This option can be translated into multiple languages by specifying the value as an array of language-code to translated name: - 'name' => array( + 'name' => [ 'en' => 'A service', 'no' => 'En tjeneste', - ), + ], `scope` : An array with scopes valid for this IdP. diff --git a/docs/simplesamlphp-reference-sp-remote.md b/docs/simplesamlphp-reference-sp-remote.md index 75e7a64bc5a092ac3349874c2c4045339c2a33c0..4bdb73ce853a58e7eab35d5a7fcb9dd343f8fd80 100644 --- a/docs/simplesamlphp-reference-sp-remote.md +++ b/docs/simplesamlphp-reference-sp-remote.md @@ -9,12 +9,12 @@ Both files have the following format: <?php /* The index of the array is the entity ID of this SP. */ - $metadata['entity-id-1'] = array( + $metadata['entity-id-1'] = [ /* Configuration options for the first SP. */ - ); - $metadata['entity-id-2'] = array( + ]; + $metadata['entity-id-2'] = [ /* Configuration options for the second SP. */ - ); + ]; /* ... */ @@ -54,10 +54,10 @@ and Shibboleth 1.3 protocol: : This option can be translated into multiple languages by specifying the value as an array of language-code to translated name: - 'name' => array( + 'name' => [ 'en' => 'A service', 'no' => 'En tjeneste', - ), + ], `OrganizationName` : The name of the organization responsible for this SPP. @@ -65,10 +65,10 @@ and Shibboleth 1.3 protocol: : This option can be translated into multiple languages by specifying the value as an array of language-code to translated name: - 'OrganizationName' => array( + 'OrganizationName' => [ 'en' => 'Example organization', 'no' => 'Eksempel organisation', - ), + ], : *Note*: If you specify this option, you must also specify the `OrganizationURL` option. @@ -378,8 +378,9 @@ idp is in the intersection the discoveryservice will go directly to the idp. **Example: Configuration for scoping** - 'IDPList' => array('https://idp1.wayf.dk', 'https://idp2.wayf.dk'), + 'IDPList' => ['https://idp1.wayf.dk', 'https://idp2.wayf.dk'], + Shibboleth 1.3 options ---------------------- diff --git a/docs/simplesamlphp-scoping.md b/docs/simplesamlphp-scoping.md index 3124122ed0d4bb0c3ecf2d65292ba4a6b371b4f9..c821b30e7926bf56fbffb5f217ae14643a2c99f8 100644 --- a/docs/simplesamlphp-scoping.md +++ b/docs/simplesamlphp-scoping.md @@ -55,11 +55,11 @@ The ProxyCount and IDPList option can be specified in the following places: Example configuration: # Add the IDPList - 'IDPList' => array( + 'IDPList' => [ 'IdPEntityID1', 'IdPEntityID2', 'IdPEntityID3', - ), + ], # Set ProxyCount 'ProxyCount' => 2, diff --git a/docs/simplesamlphp-sp-api.md b/docs/simplesamlphp-sp-api.md index cc43e4bcd8d18f70c562e263f7f5a8cf5e4c11f3..07c851f9d2c73a46daafead3f5b79cf474273a50 100644 --- a/docs/simplesamlphp-sp-api.md +++ b/docs/simplesamlphp-sp-api.md @@ -42,7 +42,7 @@ Check whether the user is authenticated with this authentication source. `requireAuth` ------------- - void requireAuth(array $params = array()) + void requireAuth(array $params = []) Make sure that the user is authenticated. This function will only return if the user is authenticated. @@ -65,17 +65,17 @@ See the documentation for the `login`-function for a description of the paramete * Return the user to the frontpage after authentication, don't post * the current POST data. */ - $auth->requireAuth(array( + $auth->requireAuth([ 'ReturnTo' => 'https://sp.example.org/', 'KeepPost' => FALSE, - )); + ]); print("Hello, authenticated user!"); `login` ------------- - void login(array $params = array()) + void login(array $params = []) Start a login operation. This function will always start a new authentication process. @@ -108,10 +108,10 @@ The [`saml:SP`](./saml:sp) authentication source also defines some parameters. ### Example # Send a passive authentication request. - $auth->login(array( + $auth->login([ 'isPassive' => TRUE, 'ErrorURL' => 'https://.../error_handler.php', - )); + ]); `logout` @@ -149,11 +149,11 @@ Logout, and redirect to the specified URL. Same as the previous, but check the result of the logout operation afterwards. - $auth->logout(array( + $auth->logout([ 'ReturnTo' => 'https://sp.example.org/logged_out.php', 'ReturnStateParam' => 'LogoutState', 'ReturnStateStage' => 'MyLogoutState', - )); + ]); And in logged_out.php: @@ -178,10 +178,10 @@ If the user isn't authenticated, an empty array will be returned. The attributes will be returned as an associative array with the name of the attribute as the key and the value as an array of one or more strings: - array( - 'uid' => array('testuser'), - 'eduPersonAffiliation' => array('student', 'member'), - ) + [ + 'uid' => ['testuser'], + 'eduPersonAffiliation' => ['student', 'member'], + ] ### Example diff --git a/docs/simplesamlphp-sp-migration.md b/docs/simplesamlphp-sp-migration.md index 92187b802ebccd51be22412e4aa67db448953618..8827b3e237b414f6b7ff75ab8b63a09605fe1413 100644 --- a/docs/simplesamlphp-sp-migration.md +++ b/docs/simplesamlphp-sp-migration.md @@ -25,15 +25,15 @@ To do this, we open `config/authsources.php`. Create the file if it does not exi If you create the file, it should look like this: <?php - $config = array( + $config = [ /* Here we can add entries for authentication sources we want to use. */ - ); + ]; We are going to add an entry to this file. The entry should look something like this: - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', /* @@ -49,7 +49,7 @@ The entry should look something like this: 'idp' => NULL, /* Here you can add other options to the SP. */ - ), + ], `default-sp` is the name of the authentication source. It is used to refer to this authentication source when we use it. @@ -171,7 +171,7 @@ Blocks of code like the following: \SimpleSAML\Utilities::redirect( '/' . $config->getBaseURL() . 'saml2/sp/initSSO.php', - array('RelayState' => \SimpleSAML\Utilities::selfURL()) + ['RelayState' => \SimpleSAML\Utilities::selfURL()] ); } @@ -198,7 +198,7 @@ Redirecting to the initSLO-script: \SimpleSAML\Utilities::redirect( '/' . $config->getBaseURL() . 'saml2/sp/initSLO.php', - array('RelayState' => \SimpleSAML\Utilities::selfURL()) + ['RelayState' => \SimpleSAML\Utilities::selfURL()] ); should be replaced with a call to `logout()`: diff --git a/docs/simplesamlphp-sp.md b/docs/simplesamlphp-sp.md index 453b9b525101a2b2b10c3008c8de62df75a82b4e..24530e6a5f2ec63e050391e7e5009589174bcfaf 100644 --- a/docs/simplesamlphp-sp.md +++ b/docs/simplesamlphp-sp.md @@ -22,26 +22,26 @@ The SP is configured by an entry in `config/authsources.php`. This is a minimal `authsources.php` for a SP: <?php - $config = array( + $config = [ /* This is the name of this authentication source, and will be used to access it later. */ - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', - ), - ); + ], + ]; For more information about additional options available for the SP, see the [`saml:SP` reference](./saml:sp). If you want multiple Service Providers in the same site and installation, you can add more entries in the `authsources.php` configuration. If so remember to set the EntityID explicitly. Here is an example: - 'sp1' => array( + 'sp1' => [ 'saml:SP', 'entityID' => 'https://sp1.example.org/', - ), - 'sp2' => array( + ], + 'sp2' => [ 'saml:SP', 'entityID' => 'https://sp2.example.org/', - ), + ], ### Enabling a certificate for your Service Provider @@ -55,11 +55,11 @@ Create a self-signed certificate in the `cert/` directory. Then edit your `authsources.php` entry, and add references to your certificate: - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', 'privatekey' => 'saml.pem', 'certificate' => 'saml.crt', - ), + ], Adding IdPs to the SP @@ -69,11 +69,11 @@ The service provider you are configuring needs to know about the identity provid This is a minimal example of a `metadata/saml20-idp-remote.php` metadata file: <?php - $metadata['https://example.com'] = array( + $metadata['https://example.com'] = [ 'SingleSignOnService' => 'https://example.com/simplesaml/saml2/idp/SSOService.php', 'SingleLogoutService' => 'https://example.com/simplesaml/saml2/idp/SingleLogoutService.php', 'certificate' => 'example.pem', - ); + ]; `example.pem` under your `cert/` directory contains the certificate the identity provider uses for signing assertions. @@ -91,9 +91,9 @@ An option in the authentication source allows you to configure which IdP should This is the `idp` option. <?php - $config = array( + $config = [ - 'default-sp' => array( + 'default-sp' => [ 'saml:SP', /* @@ -101,8 +101,8 @@ This is the `idp` option. * Can be NULL/unset, in which case the user will be shown a list of available IdPs. */ 'idp' => 'https://idp.example.com', - ), - ); + ], + ]; Exchange metadata with the IdP @@ -180,9 +180,9 @@ Each attribute name can be used as an index into $attributes to obtain the value We can also request authentication with a specific IdP: - $as->login(array( + $as->login([ 'saml:idp' => 'https://idp.example.org/', - )); + ]); Other options are also available. Take a look in the documentation for the [SP module](./saml:sp) for a list of all parameters. diff --git a/lib/SimpleSAML/Auth/Default.php b/lib/SimpleSAML/Auth/Default.php index 234f97f6ebd9b941a195e86085f0564f16ef7f5a..86c7465cd51706c59d2b46c3bbc51de9da27eb23 100644 --- a/lib/SimpleSAML/Auth/Default.php +++ b/lib/SimpleSAML/Auth/Default.php @@ -23,7 +23,7 @@ class DefaultAuth $authId, $return, $errorURL = null, - array $params = array() + array $params = [] ) { $as = self::getAuthSource($authId); @@ -64,7 +64,7 @@ class DefaultAuth $session->doLogout($authority); $state['\SimpleSAML\Auth\DefaultAuth.ReturnURL'] = $returnURL; - $state['LogoutCompletedHandler'] = array(get_class(), 'logoutCompleted'); + $state['LogoutCompletedHandler'] = [get_class(), 'logoutCompleted']; $as = Source::getById($authority); if ($as === null) { diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index 1bd7299f2fa0620121f98d5bbf1ca25afb52b3e0..c83d221f9c73d69869edf334a97e77f16a96121a 100644 --- a/lib/SimpleSAML/Auth/LDAP.php +++ b/lib/SimpleSAML/Auth/LDAP.php @@ -70,11 +70,11 @@ class LDAP ) { // Debug Logger::debug('Library - LDAP __construct(): Setup LDAP with '. - 'host=\''.$hostname. - '\', tls='.var_export($enable_tls, true). - ', debug='.var_export($debug, true). - ', timeout='.var_export($timeout, true). - ', referrals='.var_export($referrals, true)); + 'host=\''.$hostname. + '\', tls='.var_export($enable_tls, true). + ', debug='.var_export($debug, true). + ', timeout='.var_export($timeout, true). + ', referrals='.var_export($referrals, true)); /* * Set debug level before calling connect. Note that this passes @@ -92,21 +92,27 @@ class LDAP */ $resource = @ldap_connect($hostname, $port); if ($resource === false) { - throw $this->makeException('Library - LDAP __construct(): Unable to connect to \''. - $hostname.'\'', ERR_INTERNAL); + throw $this->makeException( + 'Library - LDAP __construct(): Unable to connect to \''.$hostname.'\'', + ERR_INTERNAL + ); } $this->ldap = $resource; // Enable LDAP protocol version 3 if (!@ldap_set_option($this->ldap, LDAP_OPT_PROTOCOL_VERSION, 3)) { - throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Protocol'. - ' version (LDAP_OPT_PROTOCOL_VERSION) to 3', ERR_INTERNAL); + throw $this->makeException( + 'Library - LDAP __construct(): Failed to set LDAP Protocol version (LDAP_OPT_PROTOCOL_VERSION) to 3', + ERR_INTERNAL + ); } // Set referral option if (!@ldap_set_option($this->ldap, LDAP_OPT_REFERRALS, $referrals)) { - throw $this->makeException('Library - LDAP __construct(): Failed to set LDAP Referrals'. - ' (LDAP_OPT_REFERRALS) to '.$referrals, ERR_INTERNAL); + throw $this->makeException( + 'Library - LDAP __construct(): Failed to set LDAP Referrals (LDAP_OPT_REFERRALS) to '.$referrals, + ERR_INTERNAL + ); } // Set timeouts, if supported @@ -114,12 +120,14 @@ class LDAP $this->timeout = $timeout; if ($timeout > 0) { if (!@ldap_set_option($this->ldap, LDAP_OPT_NETWORK_TIMEOUT, $timeout)) { - Logger::warning('Library - LDAP __construct(): Unable to set timeouts'. - ' (LDAP_OPT_NETWORK_TIMEOUT) to '.$timeout); + Logger::warning( + 'Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_NETWORK_TIMEOUT) to '.$timeout + ); } if (!@ldap_set_option($this->ldap, LDAP_OPT_TIMELIMIT, $timeout)) { - Logger::warning('Library - LDAP __construct(): Unable to set timeouts'. - ' (LDAP_OPT_TIMELIMIT) to '.$timeout); + Logger::warning( + 'Library - LDAP __construct(): Unable to set timeouts (LDAP_OPT_TIMELIMIT) to '.$timeout + ); } } @@ -197,6 +205,7 @@ class LDAP return new Error\AuthSource('ldap', $description); } } + return new \Exception('Unknown LDAP error.'); } @@ -239,23 +248,24 @@ class LDAP $filter = '(|'.$filter.')'; // Append LDAP filters if defined - if ($searchFilter != null) { + if ($searchFilter !== null) { $filter = "(&".$filter."".$searchFilter.")"; } // Search using generated filter Logger::debug('Library - LDAP search(): Searching base ('.$scope.') \''.$base.'\' for \''.$filter.'\''); if ($scope === 'base') { - $result = @ldap_read($this->ldap, $base, $filter, array(), 0, 0, $this->timeout, LDAP_DEREF_NEVER); + $result = @ldap_read($this->ldap, $base, $filter, [], 0, 0, $this->timeout, LDAP_DEREF_NEVER); } elseif ($scope === 'onelevel') { - $result = @ldap_list($this->ldap, $base, $filter, array(), 0, 0, $this->timeout, LDAP_DEREF_NEVER); + $result = @ldap_list($this->ldap, $base, $filter, [], 0, 0, $this->timeout, LDAP_DEREF_NEVER); } else { - $result = @ldap_search($this->ldap, $base, $filter, array(), 0, 0, $this->timeout, LDAP_DEREF_NEVER); + $result = @ldap_search($this->ldap, $base, $filter, [], 0, 0, $this->timeout, LDAP_DEREF_NEVER); } if ($result === false) { - throw $this->makeException('Library - LDAP search(): Failed search on base \''. - $base.'\' for \''.$filter.'\''); + throw $this->makeException( + 'Library - LDAP search(): Failed search on base \''.$base.'\' for \''.$filter.'\'' + ); } // Sanity checks on search results @@ -264,25 +274,32 @@ class LDAP throw $this->makeException('Library - LDAP search(): Failed to get number of entries returned'); } elseif ($count > 1) { // More than one entry is found. External error - throw $this->makeException('Library - LDAP search(): Found '.$count.' entries searching base \''. - $base.'\' for \''.$filter.'\'', ERR_AS_DATA_INCONSIST); + throw $this->makeException( + 'Library - LDAP search(): Found '.$count.' entries searching base \''.$base.'\' for \''.$filter.'\'', + ERR_AS_DATA_INCONSIST + ); } elseif ($count === 0) { // No entry is fond => wrong username is given (or not registered in the catalogue). User error - throw $this->makeException('Library - LDAP search(): Found no entries searching base \''. - $base.'\' for \''.$filter.'\'', ERR_NO_USER); + throw $this->makeException( + 'Library - LDAP search(): Found no entries searching base \''.$base.'\' for \''.$filter.'\'', + ERR_NO_USER + ); } // Resolve the DN from the search result $entry = @ldap_first_entry($this->ldap, $result); if ($entry === false) { - throw $this->makeException('Library - LDAP search(): Unable to retrieve result after searching base \''. - $base.'\' for \''.$filter.'\''); + throw $this->makeException( + 'Library - LDAP search(): Unable to retrieve result after searching base \''. + $base.'\' for \''.$filter.'\'' + ); } $dn = @ldap_get_dn($this->ldap, $entry); if ($dn === false) { - throw $this->makeException('Library - LDAP search(): Unable to get DN after searching base \''. - $base.'\' for \''.$filter.'\''); + throw $this->makeException( + 'Library - LDAP search(): Unable to get DN after searching base \''.$base.'\' for \''.$filter.'\'' + ); } return $dn; } @@ -358,7 +375,8 @@ class LDAP * * @throws \Exception * @param string|array $bases - * @param string|array $filters Array of 'attribute' => 'values' to be combined into the filter, or a raw filter string + * @param string|array $filters Array of 'attribute' => 'values' to be combined into the filter, + * or a raw filter string * @param string|array $attributes Array of attributes requested from LDAP * @param bool $and If multiple filters defined, then either bind them with & or | * @param bool $escape Weather to escape the filter values or not @@ -368,7 +386,7 @@ class LDAP public function searchformultiple( $bases, $filters, - $attributes = array(), + $attributes = [], $and = true, $escape = true, $scope = 'subtree' @@ -407,7 +425,7 @@ class LDAP foreach ($bases as $base) { if ($scope === 'base') { $result = @ldap_read($this->ldap, $base, $filter, $attributes, 0, 0, $this->timeout); - } else if ($scope === 'onelevel') { + } elseif ($scope === 'onelevel') { $result = @ldap_list($this->ldap, $base, $filter, $attributes, 0, 0, $this->timeout); } else { $result = @ldap_search($this->ldap, $base, $filter, $attributes, 0, 0, $this->timeout); @@ -590,7 +608,7 @@ class LDAP } else { // Get all attributes... // TODO: Verify that this originally was the intended behaviour. Could $attributes be a string? - $attributes = array(); + $attributes = []; } Logger::debug('Library - LDAP getAttributes(): Getting '.$description.' from DN \''.$dn.'\''); @@ -606,18 +624,20 @@ class LDAP } $attributes = @ldap_get_attributes($this->ldap, $entry); // Recycling $attributes... Possibly bad practice. if ($attributes === false) { - throw $this->makeException('Library - LDAP getAttributes(): Could not get attributes of first entry from DN \''.$dn.'\''); + throw $this->makeException( + 'Library - LDAP getAttributes(): Could not get attributes of first entry from DN \''.$dn.'\'' + ); } // Parsing each found attribute into our result set - $result = array(); // Recycling $result... Possibly bad practice. + $result = []; // Recycling $result... Possibly bad practice. for ($i = 0; $i < $attributes['count']; $i++) { // Ignore attributes that exceed the maximum allowed size $name = $attributes[$i]; $attribute = $attributes[$name]; // Deciding whether to base64 encode - $values = array(); + $values = []; for ($j = 0; $j < $attribute['count']; $j++) { $value = $attribute[$j]; @@ -629,7 +649,10 @@ class LDAP } // Base64 encode binary attributes - if (strtolower($name) === 'jpegphoto' || strtolower($name) === 'objectguid' || strtolower($name) === 'ms-ds-consistencyguid') { + if (strtolower($name) === 'jpegphoto' + || strtolower($name) === 'objectguid' + || strtolower($name) === 'ms-ds-consistencyguid' + ) { $values[] = base64_encode($value); } else { $values[] = $value; @@ -677,7 +700,9 @@ class LDAP // escape characters with a special meaning, also in the password $password = addcslashes($password, ',+"\\<>;*'); if (!$this->bind($dn, $password)) { - Logger::info('Library - LDAP validate(): Failed to authenticate \''.$username.'\' using DN \''.$dn.'\''); + Logger::info( + 'Library - LDAP validate(): Failed to authenticate \''.$username.'\' using DN \''.$dn.'\'' + ); return false; } } @@ -703,7 +728,7 @@ class LDAP * @param string|array $values Array of values to escape * @return array Array $values, but escaped */ - public static function escape_filter_value($values = array(), $singleValue = true) + public static function escape_filter_value($values = [], $singleValue = true) { // Parameter validation $values = \SimpleSAML\Utils\Arrays::arrayize($values); diff --git a/lib/SimpleSAML/Auth/ProcessingChain.php b/lib/SimpleSAML/Auth/ProcessingChain.php index b265ccd08588d0717e1278fe4894a4f8ec416b34..9f7daf3a3b2bb55cf4576fa3935c1003a269b293 100644 --- a/lib/SimpleSAML/Auth/ProcessingChain.php +++ b/lib/SimpleSAML/Auth/ProcessingChain.php @@ -52,7 +52,7 @@ class ProcessingChain assert(is_array($idpMetadata)); assert(is_array($spMetadata)); - $this->filters = array(); + $this->filters = []; $config = \SimpleSAML\Configuration::getInstance(); $configauthproc = $config->getArray('authproc.'.$mode, null); @@ -101,7 +101,7 @@ class ProcessingChain } } /* $i now points to the filter which should preceede the current filter. */ - array_splice($target, $i + 1, 0, array($filter)); + array_splice($target, $i + 1, 0, [$filter]); } } @@ -116,11 +116,11 @@ class ProcessingChain { assert(is_array($filterSrc)); - $parsedFilters = array(); + $parsedFilters = []; foreach ($filterSrc as $priority => $filter) { if (is_string($filter)) { - $filter = array('class' => $filter); + $filter = ['class' => $filter]; } if (!is_array($filter)) { @@ -255,7 +255,7 @@ class ProcessingChain * in $state['ReturnURL']. */ $id = State::saveState($state, self::COMPLETED_STAGE); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($state['ReturnURL'], array(self::AUTHPARAM => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($state['ReturnURL'], [self::AUTHPARAM => $id]); } else { /* Pass the state to the function defined in $state['ReturnCall']. */ @@ -316,7 +316,7 @@ class ProcessingChain * * @param string $id The state identifier. * @see State::parseStateID() - * @return Array The state referenced by the $id parameter. + * @return array The state referenced by the $id parameter. */ public static function fetchProcessedState($id) { @@ -336,10 +336,10 @@ class ProcessingChain if (isset($state['Destination']['userid.attribute'])) { $attributeName = $state['Destination']['userid.attribute']; - \SimpleSAML\Logger::warning("The 'userid.attribute' option has been deprecated."); + \SimpleSAML\Logger::debug("The 'userid.attribute' option has been deprecated."); } elseif (isset($state['Source']['userid.attribute'])) { $attributeName = $state['Source']['userid.attribute']; - \SimpleSAML\Logger::warning("The 'userid.attribute' option has been deprecated."); + \SimpleSAML\Logger::debug("The 'userid.attribute' option has been deprecated."); } else { // Default attribute $attributeName = 'eduPersonPrincipalName'; diff --git a/lib/SimpleSAML/Auth/Simple.php b/lib/SimpleSAML/Auth/Simple.php index f952ae2c3f656ce15269ccdbe606dae9cf08f470..a0a0aae44a41eb9771b95bb41b85d49c8f3b89a7 100644 --- a/lib/SimpleSAML/Auth/Simple.php +++ b/lib/SimpleSAML/Auth/Simple.php @@ -88,7 +88,7 @@ class Simple * * @param array $params Various options to the authentication request. See the documentation. */ - public function requireAuth(array $params = array()) + public function requireAuth(array $params = []) { $session = Session::getSessionFromRequest(); @@ -115,7 +115,7 @@ class Simple * * @param array $params Various options to the authentication request. */ - public function login(array $params = array()) + public function login(array $params = []) { if (array_key_exists('KeepPost', $params)) { $keepPost = (bool) $params['KeepPost']; @@ -183,9 +183,9 @@ class Simple } if (is_string($params)) { - $params = array( + $params = [ 'ReturnTo' => $params, - ); + ]; } assert(is_array($params)); @@ -204,7 +204,7 @@ class Simple $session->doLogout($this->authSource); - $params['LogoutCompletedHandler'] = array(get_class(), 'logoutCompleted'); + $params['LogoutCompletedHandler'] = [get_class(), 'logoutCompleted']; $as = Source::getById($this->authSource); if ($as !== null) { @@ -232,7 +232,7 @@ class Simple call_user_func($state['ReturnCallback'], $state); assert(false); } else { - $params = array(); + $params = []; if (isset($state['ReturnStateParam']) || isset($state['ReturnStateStage'])) { assert(isset($state['ReturnStateParam'], $state['ReturnStateStage'])); $stateID = State::saveState($state, $state['ReturnStateStage']); @@ -255,7 +255,7 @@ class Simple { if (!$this->isAuthenticated()) { // Not authenticated - return array(); + return []; } // Authenticated @@ -316,10 +316,10 @@ class Simple $returnTo = HTTP::getSelfURL(); } - $login = Module::getModuleURL('core/as_login.php', array( + $login = Module::getModuleURL('core/as_login.php', [ 'AuthId' => $this->authSource, 'ReturnTo' => $returnTo, - )); + ]); return $login; } @@ -341,10 +341,10 @@ class Simple $returnTo = HTTP::getSelfURL(); } - $logout = Module::getModuleURL('core/as_logout.php', array( + $logout = Module::getModuleURL('core/as_logout.php', [ 'AuthId' => $this->authSource, 'ReturnTo' => $returnTo, - )); + ]); return $logout; } diff --git a/lib/SimpleSAML/Auth/Source.php b/lib/SimpleSAML/Auth/Source.php index a7dc11633aadc599a99c7b1daf8de1b297fd7f22..9cd8486415c308341b93a76a550d4d7ae8fe03f1 100644 --- a/lib/SimpleSAML/Auth/Source.php +++ b/lib/SimpleSAML/Auth/Source.php @@ -55,7 +55,7 @@ abstract class Source $config = \SimpleSAML\Configuration::getConfig('authsources.php'); - $ret = array(); + $ret = []; $sources = $config->getOptions(); foreach ($sources as $id) { @@ -160,25 +160,25 @@ abstract class Source * @param array $params Extra information about the login. Different authentication requestors may provide different * information. Optional, will default to an empty array. */ - public function initLogin($return, $errorURL = null, array $params = array()) + public function initLogin($return, $errorURL = null, array $params = []) { assert(is_string($return) || is_array($return)); assert(is_string($errorURL) || $errorURL === null); - $state = array_merge($params, array( + $state = array_merge($params, [ '\SimpleSAML\Auth\DefaultAuth.id' => $this->authId, // TODO: remove in 2.0 '\SimpleSAML\Auth\Source.id' => $this->authId, '\SimpleSAML\Auth\DefaultAuth.Return' => $return, // TODO: remove in 2.0 '\SimpleSAML\Auth\Source.Return' => $return, '\SimpleSAML\Auth\DefaultAuth.ErrorURL' => $errorURL, // TODO: remove in 2.0 '\SimpleSAML\Auth\Source.ErrorURL' => $errorURL, - 'LoginCompletedHandler' => array(get_class(), 'loginCompleted'), - 'LogoutCallback' => array(get_class(), 'logoutCallback'), - 'LogoutCallbackState' => array( + 'LoginCompletedHandler' => [get_class(), 'loginCompleted'], + 'LogoutCallback' => [get_class(), 'logoutCallback'], + 'LogoutCallbackState' => [ '\SimpleSAML\Auth\DefaultAuth.logoutSource' => $this->authId, // TODO: remove in 2.0 '\SimpleSAML\Auth\Source.logoutSource' => $this->authId, - ), - )); + ], + ]); if (is_string($return)) { $state['\SimpleSAML\Auth\DefaultAuth.ReturnURL'] = $return; // TODO: remove in 2.0 @@ -297,7 +297,7 @@ abstract class Source self::validateSource($config, $authId); $id = $config[0]; - $info = array('AuthId' => $authId); + $info = ['AuthId' => $authId]; $authSource = null; unset($config[0]); @@ -426,15 +426,15 @@ abstract class Source if (array_key_exists('LogoutCallbackState', $state)) { $callbackState = $state['LogoutCallbackState']; } else { - $callbackState = array(); + $callbackState = []; } $id = strlen($this->authId).':'.$this->authId.$assoc; - $data = array( + $data = [ 'callback' => $callback, 'state' => $callbackState, - ); + ]; $session = \SimpleSAML\Session::getSessionFromRequest(); $session->setData( diff --git a/lib/SimpleSAML/Auth/State.php b/lib/SimpleSAML/Auth/State.php index 44454b41ff6f379eea5f2eb782dbf6143b548f89..8ee2986db0612988e7fcd8fa3154c7be6935adc4 100644 --- a/lib/SimpleSAML/Auth/State.php +++ b/lib/SimpleSAML/Auth/State.php @@ -103,7 +103,7 @@ class State public static function getPersistentAuthData(array $state) { // save persistent authentication data - $persistent = array(); + $persistent = []; if (array_key_exists('PersistentAuthData', $state)) { foreach ($state['PersistentAuthData'] as $key) { @@ -114,14 +114,14 @@ class State } // add those that should always be included - $mandatory = array( + $mandatory = [ 'Attributes', 'Expire', 'LogoutState', 'AuthInstant', 'RememberMe', 'saml:sp:NameID' - ); + ]; foreach ($mandatory as $key) { if (isset($state[$key])) { $persistent[$key] = $state[$key]; @@ -352,7 +352,7 @@ class State // Redirect to the exception handler \SimpleSAML\Utils\HTTP::redirectTrustedURL( $state[self::EXCEPTION_HANDLER_URL], - array(self::EXCEPTION_PARAM => $id) + [self::EXCEPTION_PARAM => $id] ); } elseif (array_key_exists(self::EXCEPTION_HANDLER_FUNC, $state)) { // Call the exception handler @@ -415,6 +415,6 @@ class State if (count($tmp) === 2) { $url = $tmp[1]; } - return array('id' => $id, 'url' => $url); + return ['id' => $id, 'url' => $url]; } } diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php index da3b22f8f2f415778955641335361468919357f3..6b4455400c4a1709638da0f9747f1ed696c97362 100644 --- a/lib/SimpleSAML/AuthMemCookie.php +++ b/lib/SimpleSAML/AuthMemCookie.php @@ -120,8 +120,9 @@ class AuthMemCookie $class = class_exists('Memcache') ? '\Memcache' : (class_exists('Memcached') ? '\Memcached' : false); if (!$class) { - throw new \Exception('Missing Memcached implementation.'. - ' You must install either the Memcache or Memcached extension.'); + throw new \Exception( + 'Missing Memcached implementation. You must install either the Memcache or Memcached extension.' + ); } // Create the Memcache(d) object. diff --git a/lib/SimpleSAML/Bindings/Shib13/Artifact.php b/lib/SimpleSAML/Bindings/Shib13/Artifact.php index 83df98925eae345cfb143987e1744e40a28dab3d..3ce30d977fbb3d902817729e0a071af86eb85864 100644 --- a/lib/SimpleSAML/Bindings/Shib13/Artifact.php +++ b/lib/SimpleSAML/Bindings/Shib13/Artifact.php @@ -33,7 +33,7 @@ class Artifact // We need to process the query string manually, to capture all SAMLart parameters - $artifacts = array(); + $artifacts = []; $elements = explode('&', $_SERVER['QUERY_STRING']); foreach ($elements as $element) { @@ -142,7 +142,7 @@ class Artifact $url = $idpMetadata->getDefaultEndpoint( 'ArtifactResolutionService', - array('urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding') + ['urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding'] ); $url = $url['Location']; @@ -164,21 +164,21 @@ class Artifact $spKeyCertFile = Config::getCertPath($spMetadata->getString('privatekey')); - $opts = array( - 'ssl' => array( + $opts = [ + 'ssl' => [ 'verify_peer' => true, 'cafile' => $file, 'local_cert' => $spKeyCertFile, 'capture_peer_cert' => true, 'capture_peer_chain' => true, - ), - 'http' => array( + ], + 'http' => [ 'method' => 'POST', 'content' => $request, 'header' => 'SOAPAction: http://www.oasis-open.org/committees/security'."\r\n". 'Content-Type: text/xml', - ), - ); + ], + ]; // Fetch the artifact $response = HTTP::fetch($url, $opts); diff --git a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php index 97d004c7179475dd155cf850f56589891edecf14..893682c1b8569bb0eb2e619f4f38a1b453e79c73 100644 --- a/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php +++ b/lib/SimpleSAML/Bindings/Shib13/HTTPPost.php @@ -88,11 +88,11 @@ class HTTPPost $signResponse = true; } - $signer = new Signer(array( + $signer = new Signer([ 'privatekey_array' => $privatekey, 'publickey_array' => $publickey, 'id' => ($signResponse ? 'ResponseID' : 'AssertionID'), - )); + ]); if ($idpmd->hasValue('certificatechain')) { $signer->addCertificate($idpmd->getString('certificatechain')); @@ -113,10 +113,10 @@ class HTTPPost XML::debugSAMLMessage($response, 'out'); - HTTP::submitPOSTData($shire, array( + HTTP::submitPOSTData($shire, [ 'TARGET' => $relayState, 'SAMLResponse' => base64_encode($response), - )); + ]); } diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 48dc325c52402515da6ebc96a3c7a220eacb6818..26c05307f41cecc56b51b1c8532b9165c7ac258f 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -25,7 +25,7 @@ class Configuration implements Utils\ClearableState * * @var array */ - private static $instance = array(); + private static $instance = []; /** @@ -36,7 +36,7 @@ class Configuration implements Utils\ClearableState * * @var array */ - private static $configDirs = array(); + private static $configDirs = []; /** @@ -46,7 +46,7 @@ class Configuration implements Utils\ClearableState * * @var array */ - private static $loadedConfigs = array(); + private static $loadedConfigs = []; /** @@ -125,8 +125,8 @@ class Configuration implements Utils\ClearableState try { require($filename); } catch (\ParseError $e) { - self::$loadedConfigs[$filename] = self::loadFromArray(array(), '[ARRAY]', 'simplesaml'); - throw new Error\ConfigurationError($e->getMessage(), $filename, array()); + self::$loadedConfigs[$filename] = self::loadFromArray([], '[ARRAY]', 'simplesaml'); + throw new Error\ConfigurationError($e->getMessage(), $filename, []); } } else { require($filename); @@ -163,7 +163,7 @@ class Configuration implements Utils\ClearableState throw new Error\ConfigurationError('Missing configuration file', $filename); } else { // file does not exist, but is optional, so return an empty configuration object without saving it - $cfg = new Configuration(array(), $filename); + $cfg = new Configuration([], $filename); $cfg->filename = $filename; return $cfg; } @@ -842,7 +842,7 @@ class Configuration implements Utils\ClearableState } if (!in_array($ret, $allowedValues, true)) { - $strValues = array(); + $strValues = []; foreach ($allowedValues as $av) { $strValues[] = var_export($av, true); } @@ -918,7 +918,7 @@ class Configuration implements Utils\ClearableState } if (!is_array($ret)) { - $ret = array($ret); + $ret = [$ret]; } return $ret; @@ -1040,7 +1040,7 @@ class Configuration implements Utils\ClearableState ); } - $out = array(); + $out = []; foreach ($ret as $index => $config) { $newLoc = $this->location.'['.var_export($name, true).']['. var_export($index, true).']'; @@ -1132,14 +1132,14 @@ class Configuration implements Utils\ClearableState if (!array_key_exists($endpointType, $this->configuration)) { // no endpoints of the given type - return array(); + return []; } $eps = $this->configuration[$endpointType]; if (is_string($eps)) { // for backwards-compatibility - $eps = array($eps); + $eps = [$eps]; } elseif (!is_array($eps)) { throw new \Exception($loc.': Expected array or string.'); } @@ -1150,10 +1150,10 @@ class Configuration implements Utils\ClearableState if (is_string($ep)) { // for backwards-compatibility - $ep = array( + $ep = [ 'Location' => $ep, 'Binding' => $this->getDefaultBinding($endpointType), - ); + ]; $responseLocation = $this->getString($endpointType.'Response', null); if ($responseLocation !== null) { $ep['ResponseLocation'] = $responseLocation; @@ -1286,7 +1286,7 @@ class Configuration implements Utils\ClearableState $loc = $this->location.'['.var_export($name, true).']'; if (is_string($ret)) { - $ret = array('en' => $ret,); + $ret = ['en' => $ret,]; } if (!is_array($ret)) { @@ -1327,7 +1327,7 @@ class Configuration implements Utils\ClearableState assert(is_string($prefix)); if ($this->hasValue($prefix.'keys')) { - $ret = array(); + $ret = []; foreach ($this->getArray($prefix.'keys') as $key) { if ($use !== null && isset($key[$use]) && !$key[$use]) { continue; @@ -1342,14 +1342,14 @@ class Configuration implements Utils\ClearableState } elseif ($this->hasValue($prefix.'certData')) { $certData = $this->getString($prefix.'certData'); $certData = preg_replace('/\s+/', '', $certData); - return array( - array( + return [ + [ 'encryption' => true, 'signing' => true, 'type' => 'X509Certificate', 'X509Certificate' => $certData, - ), - ); + ], + ]; } elseif ($this->hasValue($prefix.'certificate')) { $file = $this->getString($prefix.'certificate'); $file = Utils\Config::getCertPath($file); @@ -1368,18 +1368,18 @@ class Configuration implements Utils\ClearableState } $certData = preg_replace('/\s+/', '', $matches[1]); - return array( - array( + return [ + [ 'encryption' => true, 'signing' => true, 'type' => 'X509Certificate', 'X509Certificate' => $certData, - ), - ); + ], + ]; } elseif ($required === true) { throw new \SimpleSAML\Error\Exception($this->location.': Missing certificate in metadata.'); } else { - return array(); + return []; } } @@ -1390,8 +1390,8 @@ class Configuration implements Utils\ClearableState */ public static function clearInternalState() { - self::$configDirs = array(); - self::$instance = array(); - self::$loadedConfigs = array(); + self::$configDirs = []; + self::$instance = []; + self::$loadedConfigs = []; } } diff --git a/lib/SimpleSAML/Database.php b/lib/SimpleSAML/Database.php index 0ef90b7923513b498a3a1c6dcb3fec4af76bd0ca..94c9b788f14ec3e53f0162cf8f5c0e210cfb3929 100644 --- a/lib/SimpleSAML/Database.php +++ b/lib/SimpleSAML/Database.php @@ -22,7 +22,7 @@ class Database /** * This variable holds the instance of the session - Singleton approach. */ - private static $instance = array(); + private static $instance = []; /** * PDO Object for the Master database server @@ -32,7 +32,7 @@ class Database /** * Array of PDO Objects for configured database slaves */ - private $dbSlaves = array(); + private $dbSlaves = []; /** * Prefix to apply to the tables @@ -75,9 +75,9 @@ class Database */ private function __construct($config) { - $driverOptions = $config->getArray('database.driver_options', array()); + $driverOptions = $config->getArray('database.driver_options', []); if ($config->getBoolean('database.persistent', true)) { - $driverOptions = array(\PDO::ATTR_PERSISTENT => true); + $driverOptions = [\PDO::ATTR_PERSISTENT => true]; } // connect to the master @@ -89,7 +89,7 @@ class Database ); // connect to any configured slaves - $slaves = $config->getArray('database.slaves', array()); + $slaves = $config->getArray('database.slaves', []); foreach ($slaves as $slave) { array_push( $this->dbSlaves, @@ -115,16 +115,16 @@ class Database */ private static function generateInstanceId($config) { - $assembledConfig = array( - 'master' => array( + $assembledConfig = [ + 'master' => [ 'database.dsn' => $config->getString('database.dsn'), 'database.username' => $config->getString('database.username', null), 'database.password' => $config->getString('database.password', null), 'database.prefix' => $config->getString('database.prefix', ''), 'database.persistent' => $config->getBoolean('database.persistent', false), - ), - 'slaves' => $config->getArray('database.slaves', array()), - ); + ], + 'slaves' => $config->getArray('database.slaves', []), + ]; return sha1(serialize($assembledConfig)); } @@ -252,7 +252,7 @@ class Database * * @return int The number of rows affected by the query. */ - public function write($stmt, $params = array()) + public function write($stmt, $params = []) { $db = $this->dbMaster; @@ -271,9 +271,9 @@ class Database * @param string $stmt Prepared SQL statement * @param array $params Parameters * - * @return \PDOStatement object + * @return \PDOStatement|bool object */ - public function read($stmt, $params = array()) + public function read($stmt, $params = []) { $db = $this->getSlave(); diff --git a/lib/SimpleSAML/Error/Assertion.php b/lib/SimpleSAML/Error/Assertion.php index 7a5cb2dfaf990a70ad13da0d46a3b41b5b92eeec..c16f61164ceb5a1afb84f91bd9a7762b15e6449c 100644 --- a/lib/SimpleSAML/Error/Assertion.php +++ b/lib/SimpleSAML/Error/Assertion.php @@ -59,7 +59,7 @@ class Assertion extends Exception assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_QUIET_EVAL, 0); - assert_options(ASSERT_CALLBACK, array('\SimpleSAML\Error\Assertion', 'onAssertion')); + assert_options(ASSERT_CALLBACK, ['\SimpleSAML\Error\Assertion', 'onAssertion']); } diff --git a/lib/SimpleSAML/Error/AuthSource.php b/lib/SimpleSAML/Error/AuthSource.php index 6db18812164ec06b994d7860c1324bc131daec9c..e075aa7bc45a5036300550bdd440de478acaae1a 100644 --- a/lib/SimpleSAML/Error/AuthSource.php +++ b/lib/SimpleSAML/Error/AuthSource.php @@ -37,11 +37,11 @@ class AuthSource extends Error $this->authsource = $authsource; $this->reason = $reason; parent::__construct( - array( + [ 'AUTHSOURCEERROR', '%AUTHSOURCE%' => htmlspecialchars(var_export($this->authsource, true)), '%REASON%' => htmlspecialchars(var_export($this->reason, true)) - ), + ], $cause ); diff --git a/lib/SimpleSAML/Error/BadRequest.php b/lib/SimpleSAML/Error/BadRequest.php index 41bf65c1f98c0653960b9fb124c92591bd80f18e..1deb08c0bf3e9c3d2b9982868454168fc76dc29a 100644 --- a/lib/SimpleSAML/Error/BadRequest.php +++ b/lib/SimpleSAML/Error/BadRequest.php @@ -30,7 +30,7 @@ class BadRequest extends Error assert(is_string($reason)); $this->reason = $reason; - parent::__construct(array('BADREQUEST', '%REASON%' => $this->reason)); + parent::__construct(['BADREQUEST', '%REASON%' => $this->reason]); $this->httpCode = 400; } diff --git a/lib/SimpleSAML/Error/ConfigurationError.php b/lib/SimpleSAML/Error/ConfigurationError.php index 47dd0ccc9859d9c7e9b558a6e2472403980438b0..128093dad543d0991272cae7d353fc9156bfe442 100644 --- a/lib/SimpleSAML/Error/ConfigurationError.php +++ b/lib/SimpleSAML/Error/ConfigurationError.php @@ -37,7 +37,7 @@ class ConfigurationError extends Error { $file_str = ''; $reason_str = '.'; - $params = array('CONFIG'); + $params = ['CONFIG']; if ($file !== null) { $params['%FILE%'] = $file; $basepath = dirname(dirname(dirname(dirname(__FILE__)))).'/'; diff --git a/lib/SimpleSAML/Error/CriticalConfigurationError.php b/lib/SimpleSAML/Error/CriticalConfigurationError.php index 1e67a1e80d9dd7f6caee13706da426b66100bf71..d41367fbf051cd6800045888928c134a47551798 100644 --- a/lib/SimpleSAML/Error/CriticalConfigurationError.php +++ b/lib/SimpleSAML/Error/CriticalConfigurationError.php @@ -28,12 +28,12 @@ class CriticalConfigurationError extends ConfigurationError * * @var array */ - private static $minimum_config = array( + private static $minimum_config = [ 'logging.handler' => 'errorlog', 'logging.level' => \SimpleSAML\Logger::DEBUG, 'errorreporting' => false, 'debug' => true, - ); + ]; /** diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php index 9632df87de26b5b874bd03b5050aa72dae4ad633..0d8d011a0b659ded18caa3023e504d0968fcff65 100644 --- a/lib/SimpleSAML/Error/Error.php +++ b/lib/SimpleSAML/Error/Error.php @@ -79,7 +79,7 @@ class Error extends Exception unset($this->parameters[0]); $this->errorCode = $errorCode[0]; } else { - $this->parameters = array(); + $this->parameters = []; $this->errorCode = $errorCode; } @@ -165,30 +165,7 @@ class Error extends Exception */ protected function setHTTPCode() { - // Some mostly used HTTP codes - $httpCodesMap = array( - 400 => 'HTTP/1.0 400 Bad Request', - 403 => 'HTTP/1.0 403 Forbidden', - 404 => 'HTTP/1.0 404 Not Found', - 405 => 'HTTP/1.0 405 Method Not Allowed', - 500 => 'HTTP/1.0 500 Internal Server Error', - 501 => 'HTTP/1.0 501 Method Not Implemented', - 503 => 'HTTP/1.0 503 Service Temporarily Unavailable', - ); - - $httpCode = $this->httpCode; - - if (function_exists('http_response_code')) { - http_response_code($httpCode); - return; - } - - if (!array_key_exists($this->httpCode, $httpCodesMap)) { - $httpCode = 500; - \SimpleSAML\Logger::warning('HTTP response code not defined: '.var_export($this->httpCode, true)); - } - - header($httpCodesMap[$httpCode]); + http_response_code($this->httpCode); } @@ -219,7 +196,7 @@ class Error extends Exception } else { $referer = 'unknown'; } - $errorData = array( + $errorData = [ 'exceptionMsg' => $emsg, 'exceptionTrace' => $etrace, 'reportId' => $reportId, @@ -227,7 +204,7 @@ class Error extends Exception 'url' => \SimpleSAML\Utils\HTTP::getSelfURLNoQuery(), 'version' => $config->getVersion(), 'referer' => $referer, - ); + ]; $session->setData('core:errorreport', $reportId, $errorData); return $errorData; @@ -249,7 +226,7 @@ class Error extends Exception $errorData = $this->saveError(); $config = \SimpleSAML\Configuration::getInstance(); - $data = array(); + $data = []; $data['showerrors'] = $config->getBoolean('showerrors', true); $data['error'] = $errorData; $data['errorCode'] = $this->errorCode; diff --git a/lib/SimpleSAML/Error/ErrorCodes.php b/lib/SimpleSAML/Error/ErrorCodes.php index e3586589474e97cae23e8285b22c63b06e10eaa5..d15f8c46ff268d03933ec39b011f03f3547fac90 100644 --- a/lib/SimpleSAML/Error/ErrorCodes.php +++ b/lib/SimpleSAML/Error/ErrorCodes.php @@ -18,7 +18,7 @@ class ErrorCodes */ final public static function defaultGetAllErrorCodeTitles() { - return array( + return [ 'ACSPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:title_ACSPARAMS}'), 'ARSPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:title_ARSPARAMS}'), 'AUTHSOURCEERROR' => \SimpleSAML\Locale\Translate::noop('{errors:title_AUTHSOURCEERROR}'), @@ -52,7 +52,7 @@ class ErrorCodes 'UNKNOWNCERT' => \SimpleSAML\Locale\Translate::noop('{errors:title_UNKNOWNCERT}'), 'USERABORTED' => \SimpleSAML\Locale\Translate::noop('{errors:title_USERABORTED}'), 'WRONGUSERPASS' => \SimpleSAML\Locale\Translate::noop('{errors:title_WRONGUSERPASS}'), - ); + ]; } @@ -76,7 +76,7 @@ class ErrorCodes */ final public static function defaultGetAllErrorCodeDescriptions() { - return array( + return [ 'ACSPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_ACSPARAMS}'), 'ARSPARAMS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_ARSPARAMS}'), 'AUTHSOURCEERROR' => \SimpleSAML\Locale\Translate::noop('{errors:descr_AUTHSOURCEERROR}'), @@ -110,7 +110,7 @@ class ErrorCodes 'UNKNOWNCERT' => \SimpleSAML\Locale\Translate::noop('{errors:descr_UNKNOWNCERT}'), 'USERABORTED' => \SimpleSAML\Locale\Translate::noop('{errors:descr_USERABORTED}'), 'WRONGUSERPASS' => \SimpleSAML\Locale\Translate::noop('{errors:descr_WRONGUSERPASS}'), - ); + ]; } /** @@ -135,10 +135,10 @@ class ErrorCodes */ public static function getAllErrorCodeMessages() { - return array( + return [ 'title' => self::getAllErrorCodeTitles(), 'descr' => self::getAllErrorCodeDescriptions(), - ); + ]; } @@ -181,9 +181,9 @@ class ErrorCodes */ public static function getErrorCodeMessage($errorCode) { - return array( + return [ 'title' => self::getErrorCodeTitle($errorCode), 'descr' => self::getErrorCodeDescription($errorCode), - ); + ]; } } diff --git a/lib/SimpleSAML/Error/Exception.php b/lib/SimpleSAML/Error/Exception.php index 8a3b199aad3407357465a966af283e3721febb32..5ab59f4821213500199c53e50b15968bc3e58124 100644 --- a/lib/SimpleSAML/Error/Exception.php +++ b/lib/SimpleSAML/Error/Exception.php @@ -80,7 +80,7 @@ class Exception extends \Exception */ protected function initBacktrace(\Exception $exception) { - $this->backtrace = array(); + $this->backtrace = []; // position in the top function on the stack $pos = $exception->getFile().':'.$exception->getLine(); @@ -148,9 +148,9 @@ class Exception extends \Exception */ public function format($anonymize = false) { - $ret = array( + $ret = [ $this->getClass().': '.$this->getMessage(), - ); + ]; return array_merge($ret, $this->formatBacktrace($anonymize)); } @@ -166,7 +166,7 @@ class Exception extends \Exception */ public function formatBacktrace($anonymize = false) { - $ret = array(); + $ret = []; $basedir = \SimpleSAML\Configuration::getInstance()->getBaseDir(); $e = $this; @@ -197,7 +197,7 @@ class Exception extends \Exception protected function logBacktrace($level = \SimpleSAML\Logger::DEBUG) { // see if debugging is enabled for backtraces - $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', array('backtraces' => false)); + $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', ['backtraces' => false]); if (!(in_array('backtraces', $debug, true) // implicitly enabled || (array_key_exists('backtraces', $debug) && $debug['backtraces'] === true) @@ -210,13 +210,13 @@ class Exception extends \Exception $backtrace = $this->formatBacktrace(); - $callback = array('\SimpleSAML\Logger'); - $functions = array( + $callback = ['\SimpleSAML\Logger']; + $functions = [ \SimpleSAML\Logger::ERR => 'error', \SimpleSAML\Logger::WARNING => 'warning', \SimpleSAML\Logger::INFO => 'info', \SimpleSAML\Logger::DEBUG => 'debug', - ); + ]; $callback[] = $functions[$level]; foreach ($backtrace as $line) { @@ -234,13 +234,13 @@ class Exception extends \Exception */ public function log($default_level) { - $fn = array( + $fn = [ \SimpleSAML\Logger::ERR => 'logError', \SimpleSAML\Logger::WARNING => 'logWarning', \SimpleSAML\Logger::INFO => 'logInfo', \SimpleSAML\Logger::DEBUG => 'logDebug', - ); - call_user_func(array($this, $fn[$default_level]), $default_level); + ]; + call_user_func([$this, $fn[$default_level]], $default_level); } diff --git a/lib/SimpleSAML/Error/MetadataNotFound.php b/lib/SimpleSAML/Error/MetadataNotFound.php index 93e086c14e75116ef4e9dafab5091ba8e46abdbe..47636bc215e7029b885a330342cd31561cc56076 100644 --- a/lib/SimpleSAML/Error/MetadataNotFound.php +++ b/lib/SimpleSAML/Error/MetadataNotFound.php @@ -20,9 +20,9 @@ class MetadataNotFound extends Error assert(is_string($entityId)); $this->includeTemplate = 'core:no_metadata.tpl.php'; - parent::__construct(array( + parent::__construct([ 'METADATANOTFOUND', '%ENTITYID%' => htmlspecialchars(var_export($entityId, true)) - )); + ]); } } diff --git a/lib/SimpleSAML/Error/NotFound.php b/lib/SimpleSAML/Error/NotFound.php index 79f6049221186ec8e24e59bf21c4a40e39d8d714..0e618526962b0a596948e394b1f04abf046c1298 100644 --- a/lib/SimpleSAML/Error/NotFound.php +++ b/lib/SimpleSAML/Error/NotFound.php @@ -32,10 +32,10 @@ class NotFound extends Error $url = \SimpleSAML\Utils\HTTP::getSelfURL(); if ($reason === null) { - parent::__construct(array('NOTFOUND', '%URL%' => $url)); + parent::__construct(['NOTFOUND', '%URL%' => $url]); $this->message = "The requested page '$url' could not be found."; } else { - parent::__construct(array('NOTFOUNDREASON', '%URL%' => $url, '%REASON%' => $reason)); + parent::__construct(['NOTFOUNDREASON', '%URL%' => $url, '%REASON%' => $reason]); $this->message = "The requested page '$url' could not be found. ".$reason; } @@ -65,8 +65,8 @@ class NotFound extends Error */ public function format($anonymize = false) { - return array( + return [ $this->getClass().': '.$this->getMessage(), - ); + ]; } } diff --git a/lib/SimpleSAML/IdP.php b/lib/SimpleSAML/IdP.php index 6110df9c7abad24956ff47c8e434bf31609744fb..70db63b4c4284b55ef2a02edc277d0b0fc4a5b1d 100644 --- a/lib/SimpleSAML/IdP.php +++ b/lib/SimpleSAML/IdP.php @@ -19,7 +19,7 @@ class IdP * * @var array */ - private static $idpCache = array(); + private static $idpCache = []; /** * The identifier for this IdP. @@ -204,7 +204,7 @@ class IdP } elseif ($spMetadata->hasValue('OrganizationDisplayName')) { return $spMetadata->getLocalizedString('OrganizationDisplayName'); } else { - return array('en' => $spEntityId); + return ['en' => $spEntityId]; } } @@ -307,7 +307,7 @@ class IdP if (isset($state['SPMetadata'])) { $spMetadata = $state['SPMetadata']; } else { - $spMetadata = array(); + $spMetadata = []; } if (isset($state['core:SP'])) { @@ -322,7 +322,7 @@ class IdP $pc = new Auth\ProcessingChain($idpMetadata, $spMetadata, 'idp'); - $state['ReturnCall'] = array('\SimpleSAML\IdP', 'postAuthProc'); + $state['ReturnCall'] = ['\SimpleSAML\IdP', 'postAuthProc']; $state['Destination'] = $spMetadata; $state['Source'] = $idpMetadata; @@ -403,7 +403,7 @@ class IdP } $state['IdPMetadata'] = $this->getConfig()->toArray(); - $state['ReturnCallback'] = array('\SimpleSAML\IdP', 'postAuth'); + $state['ReturnCallback'] = ['\SimpleSAML\IdP', 'postAuth']; try { if ($needAuth) { @@ -485,12 +485,12 @@ class IdP if ($assocId !== null) { $this->terminateAssociation($assocId); $session = Session::getSessionFromRequest(); - $session->deleteData('core:idp-ssotime', $this->id.':'.$state['saml:SPEntityId']); + $session->deleteData('core:idp-ssotime', $this->id.';'.$state['saml:SPEntityId']); } // terminate the local session $id = Auth\State::saveState($state, 'core:Logout:afterbridge'); - $returnTo = Module::getModuleURL('core/idp/resumelogout.php', array('id' => $id)); + $returnTo = Module::getModuleURL('core/idp/resumelogout.php', ['id' => $id]); $this->authSource->logout($returnTo); @@ -535,10 +535,10 @@ class IdP { assert(is_string($url)); - $state = array( - 'Responder' => array('\SimpleSAML\IdP', 'finishLogoutRedirect'), + $state = [ + 'Responder' => ['\SimpleSAML\IdP', 'finishLogoutRedirect'], 'core:Logout:URL' => $url, - ); + ]; $this->handleLogoutRequest($state, null); assert(false); diff --git a/lib/SimpleSAML/IdP/IFrameLogoutHandler.php b/lib/SimpleSAML/IdP/IFrameLogoutHandler.php index 08c47aedbdd997c9f27577f66e8714085deb2804..b2d808cc29363bc5e1f5f37add2264b9ea783f76 100644 --- a/lib/SimpleSAML/IdP/IFrameLogoutHandler.php +++ b/lib/SimpleSAML/IdP/IFrameLogoutHandler.php @@ -56,7 +56,7 @@ class IFrameLogoutHandler implements LogoutHandlerInterface if (!is_null($assocId)) { $spName = $this->idp->getSPName($assocId); if ($spName === null) { - $spName = array('en' => $assocId); + $spName = ['en' => $assocId]; } $state['core:Logout-IFrame:From'] = $spName; @@ -64,9 +64,9 @@ class IFrameLogoutHandler implements LogoutHandlerInterface $state['core:Logout-IFrame:From'] = null; } - $params = array( + $params = [ 'id' => \SimpleSAML\Auth\State::saveState($state, 'core:Logout-IFrame'), - ); + ]; if (isset($state['core:Logout-IFrame:InitType'])) { $params['type'] = $state['core:Logout-IFrame:InitType']; } diff --git a/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php b/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php index 37218ea88bb41ef8d6a549fe7f0d11fe74972b80..32652b5617a747437bc331e86870fbdc5a3a5f81 100644 --- a/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php +++ b/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php @@ -53,7 +53,7 @@ class TraditionalLogoutHandler implements LogoutHandlerInterface try { $idp = \SimpleSAML\IdP::getByState($association); - $url = call_user_func(array($association['Handler'], 'getLogoutURL'), $idp, $association, $relayState); + $url = call_user_func([$association['Handler'], 'getLogoutURL'], $idp, $association, $relayState); HTTP::redirectTrustedURL($url); } catch (\Exception $e) { Logger::warning('Unable to initialize logout to '.var_export($id, true).'.'); diff --git a/lib/SimpleSAML/Locale/Language.php b/lib/SimpleSAML/Locale/Language.php index 56bf91b400f1bcc55e936e1a4fe4b2949721df0a..21dc94b7cf6a0f43539d147846bd45f6e8d2557a 100644 --- a/lib/SimpleSAML/Locale/Language.php +++ b/lib/SimpleSAML/Locale/Language.php @@ -18,7 +18,7 @@ class Language /** * This is the default language map. It is used to map languages codes from the user agent to other language codes. */ - private static $defaultLanguageMap = array('nb' => 'no'); + private static $defaultLanguageMap = ['nb' => 'no']; /** * The configuration to use. @@ -77,7 +77,7 @@ class Language * * @var array */ - private $language_names = array( + private $language_names = [ 'no' => 'BokmĂĄl', // Norwegian BokmĂĄl 'nn' => 'Nynorsk', // Norwegian Nynorsk 'se' => 'Sámegiella', // Northern Sami @@ -118,17 +118,17 @@ class Language 'ro' => 'RomâneČ™te', // Romanian 'eu' => 'Euskara', // Basque 'af' => 'Afrikaans', // Afrikaans - ); + ]; /** * A mapping of SSP languages to locales * * @var array */ - private $languagePosixMapping = array( + private $languagePosixMapping = [ 'no' => 'nb_NO', 'nn' => 'nn_NO', - ); + ]; /** @@ -143,7 +143,7 @@ class Language $this->defaultLanguage = $this->configuration->getString('language.default', 'en'); $this->languageParameterName = $this->configuration->getString('language.parameter.name', 'language'); $this->customFunction = $this->configuration->getArray('language.get_language_function', null); - $this->rtlLanguages = $this->configuration->getArray('language.rtl', array()); + $this->rtlLanguages = $this->configuration->getArray('language.rtl', []); if (isset($_GET[$this->languageParameterName])) { $this->setLanguage( $_GET[$this->languageParameterName], @@ -160,8 +160,8 @@ class Language */ private function getInstalledLanguages() { - $configuredAvailableLanguages = $this->configuration->getArray('language.available', array('en')); - $availableLanguages = array(); + $configuredAvailableLanguages = $this->configuration->getArray('language.available', ['en']); + $availableLanguages = []; foreach ($configuredAvailableLanguages as $code) { if (array_key_exists($code, $this->language_names) && isset($this->language_names[$code])) { $availableLanguages[] = $code; @@ -378,7 +378,7 @@ class Language public static function getLanguageCookie() { $config = \SimpleSAML\Configuration::getInstance(); - $availableLanguages = $config->getArray('language.available', array('en')); + $availableLanguages = $config->getArray('language.available', ['en']); $name = $config->getString('language.cookie.name', 'language'); if (isset($_COOKIE[$name])) { @@ -404,20 +404,20 @@ class Language $language = strtolower($language); $config = \SimpleSAML\Configuration::getInstance(); - $availableLanguages = $config->getArray('language.available', array('en')); + $availableLanguages = $config->getArray('language.available', ['en']); if (!in_array($language, $availableLanguages, true) || headers_sent()) { return; } $name = $config->getString('language.cookie.name', 'language'); - $params = array( + $params = [ 'lifetime' => ($config->getInteger('language.cookie.lifetime', 60 * 60 * 24 * 900)), 'domain' => ($config->getString('language.cookie.domain', null)), 'path' => ($config->getString('language.cookie.path', '/')), 'secure' => ($config->getBoolean('language.cookie.secure', false)), 'httponly' => ($config->getBoolean('language.cookie.httponly', false)), - ); + ]; HTTP::setCookie($name, $language, $params, false); } diff --git a/lib/SimpleSAML/Locale/Localization.php b/lib/SimpleSAML/Locale/Localization.php index faf54518489e40a96af09db1fc55f327f672a8a5..9a4543d37ae95fc21553d8653eaf39867440179d 100644 --- a/lib/SimpleSAML/Locale/Localization.php +++ b/lib/SimpleSAML/Locale/Localization.php @@ -23,47 +23,65 @@ class Localization /** * The default gettext domain. + * + * @var string */ const DEFAULT_DOMAIN = 'messages'; /** * Old internationalization backend included in SimpleSAMLphp. + * + * @var string */ const SSP_I18N_BACKEND = 'SimpleSAMLphp'; /** * An internationalization backend implemented purely in PHP. + * + * @var string */ const GETTEXT_I18N_BACKEND = 'gettext/gettext'; /** * The default locale directory + * + * @var string */ private $localeDir; /** * Where specific domains are stored + * + * @var array */ - private $localeDomainMap = array(); + private $localeDomainMap = []; /** * Pointer to currently active translator + * + * @var \Gettext\Translator */ private $translator; /** * Pointer to current Language + * + * @var Language */ private $language; /** * Language code representing the current Language + * + * @var string */ private $langcode; /** * The language backend to use + * + * @var string */ public $i18nBackend; @@ -85,6 +103,8 @@ class Localization /** * Dump the default locale directory + * + * @return string */ public function getLocaleDir() { @@ -96,6 +116,8 @@ class Localization * Get the default locale dir for a specific module aka. domain * * @param string $domain Name of module/domain + * + * @return string */ public function getDomainLocaleDir($domain) { @@ -139,6 +161,8 @@ class Localization * * @param string $domain Name of localization domain * @throws Exception If the path does not exist even for the default, fallback language + * + * @return string */ public function getLangPath($domain = self::DEFAULT_DOMAIN) { @@ -230,6 +254,8 @@ class Localization * Test to check if backend is set to default * * (if false: backend unset/there's an error) + * + * @return bool */ public function isI18NBackendDefault() { @@ -257,6 +283,8 @@ class Localization /** * Show which domains are registered + * + * @return array */ public function getRegisteredDomains() { diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php index 0e52228a1deb6221acb4ad1c29f3aa3de40a6b6c..c9e7a223d62e59d4db53530b353dc9212618f695 100644 --- a/lib/SimpleSAML/Locale/Translate.php +++ b/lib/SimpleSAML/Locale/Translate.php @@ -19,15 +19,24 @@ class Translate */ private $configuration; - private $langtext = array(); + /** + * Associative array of languages. + * + * @var array + */ + private $langtext = []; /** * Associative array of dictionaries. + * + * @var array */ - private $dictionaries = array(); + private $dictionaries = []; /** * The default dictionary. + * + * @var string|null */ private $defaultDictionary = null; @@ -38,7 +47,6 @@ class Translate */ private $language; - /** * Constructor * @@ -66,7 +74,6 @@ class Translate } } - /** * Return the internal language object used by this translator. * @@ -77,7 +84,6 @@ class Translate return $this->language; } - /** * This method retrieves a dictionary with the name given. * @@ -107,7 +113,6 @@ class Translate return $this->dictionaries[$name]; } - /** * This method retrieves a tag as an array with language => string mappings. * @@ -145,7 +150,6 @@ class Translate return $dictionary[$tag]; } - /** * Retrieve the preferred translation of a given text. * @@ -186,7 +190,6 @@ class Translate throw new \Exception('Nothing to return from translation.'); } - /** * Translate the name of an attribute. * @@ -198,7 +201,7 @@ class Translate { // normalize attribute name $normName = strtolower($name); - $normName = str_replace(array(":", "-"), "_", $normName); + $normName = str_replace([":", "-"], "_", $normName); // check for an extra dictionary $extraDict = $this->configuration->getString('attributes.extradictionary', null); @@ -219,7 +222,6 @@ class Translate return $name; } - /** * Mark a string for translation without translating it. * @@ -232,7 +234,6 @@ class Translate return $tag; } - /** * Translate a tag into the current language, with a fallback to english. * @@ -257,11 +258,11 @@ class Translate */ public function t( $tag, - $replacements = array(), + $replacements = [], // TODO: remove this for 2.0. Assume true $fallbackdefault = true, // TODO: remove this for 2.0 - $oldreplacements = array(), + $oldreplacements = [], // TODO: remove this for 2.0 $striptags = false ) { @@ -321,7 +322,6 @@ class Translate return $translated; } - /** * Return the string that should be used when no translation was found. * @@ -340,7 +340,6 @@ class Translate } } - /** * Include a translation inline instead of putting translations in dictionaries. This function is recommended to be * used ONLY for variable data, or when the translation is already provided by an external source, as a database @@ -354,7 +353,7 @@ class Translate public function includeInlineTranslation($tag, $translation) { if (is_string($translation)) { - $translation = array('en' => $translation); + $translation = ['en' => $translation]; } elseif (!is_array($translation)) { throw new \Exception("Inline translation should be string or array. Is ".gettype($translation)." now!"); } @@ -363,7 +362,6 @@ class Translate $this->langtext[$tag] = $translation; } - /** * Include a language file from the dictionaries directory. * @@ -386,7 +384,6 @@ class Translate $this->langtext = array_merge($this->langtext, $lang); } - /** * Read a dictionary file in JSON format. * @@ -404,7 +401,7 @@ class Translate if (empty($lang)) { \SimpleSAML\Logger::error('Invalid dictionary definition file ['.$definitionFile.']'); - return array(); + return []; } $translationFile = $filename.'.translation.json'; @@ -419,7 +416,6 @@ class Translate return $lang; } - /** * Read a dictionary file in PHP format. * @@ -438,10 +434,9 @@ class Translate return $lang; } - return array(); + return []; } - /** * Read a dictionary file. * @@ -468,10 +463,16 @@ class Translate \SimpleSAML\Logger::error( $_SERVER['PHP_SELF'].' - Template: Could not find dictionary file at ['.$filename.']' ); - return array(); + return []; } - + /** + * Translate a singular text. + * + * @param string $original The string before translation. + * + * @return string The translated string. + */ public static function translateSingularGettext($original) { $text = \Gettext\BaseTranslator::$current->gettext($original); @@ -485,7 +486,15 @@ class Translate return strtr($text, is_array($args[0]) ? $args[0] : $args); } - + /** + * Translate a plural text. + * + * @param string $original The string before translation. + * @param string $plural + * @param string $value + * + * @return string The translated string. + */ public static function translatePluralGettext($original, $plural, $value) { $text = \Gettext\BaseTranslator::$current->ngettext($original, $plural, $value); @@ -499,7 +508,6 @@ class Translate return strtr($text, is_array($args[0]) ? $args[0] : $args); } - /** * Pick a translation from a given array of translations for the current language. * @@ -528,14 +536,16 @@ class Translate // we don't have a translation for the current language, load alternative priorities $sspcfg = \SimpleSAML\Configuration::getInstance(); $langcfg = $sspcfg->getConfigItem('language', null); - $priorities = array(); + $priorities = []; if ($langcfg instanceof \SimpleSAML\Configuration) { - $priorities = $langcfg->getArray('priorities', array()); + $priorities = $langcfg->getArray('priorities', []); } - foreach ($priorities[$context['currentLanguage']] as $lang) { - if (isset($translations[$lang])) { - return $translations[$lang]; + if ( !empty($priorities[$context['currentLanguage']]) ) { + foreach ($priorities[$context['currentLanguage']] as $lang) { + if (isset($translations[$lang])) { + return $translations[$lang]; + } } } diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index 3c569a1faf9eee0c94975ade725f50e0ede194db..c18276ec04a58f081e16054c4b23ceca44090c1e 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -30,14 +30,14 @@ class Logger /** * @var array */ - private static $capturedLog = array(); + private static $capturedLog = []; /** * Array with messages logged before the logging handler was initialized. * * @var array */ - private static $earlyLog = array(); + private static $earlyLog = []; /** * List of log levels. @@ -46,7 +46,7 @@ class Logger * * @var array */ - private static $logLevelStack = array(); + private static $logLevelStack = []; /** * The current mask of log levels disabled. @@ -305,7 +305,7 @@ class Logger assert(is_int($mask)); $currentEnabled = error_reporting(); - self::$logLevelStack[] = array($currentEnabled, self::$logMask); + self::$logLevelStack[] = [$currentEnabled, self::$logMask]; $currentEnabled &= ~$mask; error_reporting($currentEnabled); @@ -336,11 +336,11 @@ class Logger private static function defer($level, $message, $stats) { // save the message for later - self::$earlyLog[] = array('level' => $level, 'string' => $message, 'statsLog' => $stats); + self::$earlyLog[] = ['level' => $level, 'string' => $message, 'statsLog' => $stats]; // register a shutdown handler if needed if (!self::$shutdownRegistered) { - register_shutdown_function(array('SimpleSAML\Logger', 'flush')); + register_shutdown_function(['SimpleSAML\Logger', 'flush']); self::$shutdownRegistered = true; } } @@ -352,11 +352,11 @@ class Logger self::$loggingHandler = false; // a set of known logging handlers - $known_handlers = array( + $known_handlers = [ 'syslog' => 'SimpleSAML\Logger\SyslogLoggingHandler', 'file' => 'SimpleSAML\Logger\FileLoggingHandler', 'errorlog' => 'SimpleSAML\Logger\ErrorLogLoggingHandler', - ); + ]; // get the configuration $config = Configuration::getInstance(); @@ -429,8 +429,8 @@ class Logger $string = implode(",", $string); } - $formats = array('%trackid', '%msg', '%srcip', '%stat'); - $replacements = array(self::$trackid, $string, $_SERVER['REMOTE_ADDR']); + $formats = ['%trackid', '%msg', '%srcip', '%stat']; + $replacements = [self::$trackid, $string, $_SERVER['REMOTE_ADDR']]; $stat = ''; if ($statsLog) { diff --git a/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php b/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php index 9af1f63bc7caf1f8ef8cc36e56af63e83e2b71aa..355fe24d1d262b0cefbf1c36b35a692701b107bc 100644 --- a/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php +++ b/lib/SimpleSAML/Logger/ErrorLogLoggingHandler.php @@ -17,7 +17,7 @@ class ErrorLogLoggingHandler implements LoggingHandlerInterface /** * This array contains the mappings from syslog log level to names. */ - private static $levelNames = array( + private static $levelNames = [ Logger::EMERG => 'EMERG', Logger::ALERT => 'ALERT', Logger::CRIT => 'CRIT', @@ -26,7 +26,7 @@ class ErrorLogLoggingHandler implements LoggingHandlerInterface Logger::NOTICE => 'NOTICE', Logger::INFO => 'INFO', Logger::DEBUG => 'DEBUG', - ); + ]; /** * The name of this process. @@ -72,8 +72,8 @@ class ErrorLogLoggingHandler implements LoggingHandlerInterface $levelName = sprintf('UNKNOWN%d', $level); } - $formats = array('%process', '%level'); - $replacements = array($this->processname, $levelName); + $formats = ['%process', '%level']; + $replacements = [$this->processname, $levelName]; $string = str_replace($formats, $replacements, $string); $string = preg_replace('/%\w+(\{[^\}]+\})?/', '', $string); $string = trim($string); diff --git a/lib/SimpleSAML/Logger/FileLoggingHandler.php b/lib/SimpleSAML/Logger/FileLoggingHandler.php index beb9e27bbac46b69ced81cfa42f5426eb03b7986..8e9202f55d6b289c52c1129dcbb9c9fda008a97d 100644 --- a/lib/SimpleSAML/Logger/FileLoggingHandler.php +++ b/lib/SimpleSAML/Logger/FileLoggingHandler.php @@ -25,7 +25,7 @@ class FileLoggingHandler implements LoggingHandlerInterface * This array contains the mappings from syslog log levels to names. Copied more or less directly from * SimpleSAML\Logger\ErrorLogLoggingHandler. */ - private static $levelNames = array( + private static $levelNames = [ Logger::EMERG => 'EMERGENCY', Logger::ALERT => 'ALERT', Logger::CRIT => 'CRITICAL', @@ -34,7 +34,7 @@ class FileLoggingHandler implements LoggingHandlerInterface Logger::NOTICE => 'NOTICE', Logger::INFO => 'INFO', Logger::DEBUG => 'DEBUG', - ); + ]; protected $processname = null; protected $format; @@ -92,10 +92,10 @@ class FileLoggingHandler implements LoggingHandlerInterface $levelName = self::$levelNames[$level]; } - $formats = array('%process', '%level'); - $replacements = array($this->processname, $levelName); + $formats = ['%process', '%level']; + $replacements = [$this->processname, $levelName]; - $matches = array(); + $matches = []; if (preg_match('/%date(?:\{([^\}]+)\})?/', $this->format, $matches)) { $format = "%b %d %H:%M:%S"; if (isset($matches[1])) { diff --git a/lib/SimpleSAML/Logger/SyslogLoggingHandler.php b/lib/SimpleSAML/Logger/SyslogLoggingHandler.php index 0330c3d134b53c8a7fd32ae846eaf2195814d9bd..8d6e21a396fa899d3bd095adba6bece993fef95d 100644 --- a/lib/SimpleSAML/Logger/SyslogLoggingHandler.php +++ b/lib/SimpleSAML/Logger/SyslogLoggingHandler.php @@ -64,8 +64,8 @@ class SyslogLoggingHandler implements LoggingHandlerInterface } } - $formats = array('%process', '%level'); - $replacements = array('', $level); + $formats = ['%process', '%level']; + $replacements = ['', $level]; $string = str_replace($formats, $replacements, $string); $string = preg_replace('/%\w+(\{[^\}]+\})?/', '', $string); $string = trim($string); diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php index d0288d9f32c5e32d9921600ab968ecccf514563e..227022c201de7e5c42803353c83d12eb5e7f71e8 100644 --- a/lib/SimpleSAML/Memcache.php +++ b/lib/SimpleSAML/Memcache.php @@ -60,7 +60,7 @@ class Memcache if ($serializedInfo === false) { // either the server is down, or we don't have the value stored on that server $mustUpdate = true; - $up = $server->getstats(); + $up = $server->getStats(); if ($up !== false) { $allDown = false; } @@ -150,10 +150,10 @@ class Memcache public static function set($key, $value, $expire = null) { Logger::debug("saving key $key to memcache"); - $savedInfo = array( + $savedInfo = [ 'timestamp' => microtime(true), 'data' => $value - ); + ]; if ($expire === null) { $expire = self::getExpireTime(); @@ -306,8 +306,9 @@ class Memcache { $class = class_exists('\Memcache') ? '\Memcache' : (class_exists('\Memcached') ? '\Memcached' : false); if (!$class) { - throw new \Exception('Missing Memcached implementation.'. - ' You must install either the Memcache or Memcached extension.'); + throw new \Exception( + 'Missing Memcached implementation. You must install either the Memcache or Memcached extension.' + ); } self::$extension = strtolower($class); @@ -357,7 +358,7 @@ class Memcache } // initialize the servers-array - self::$serverGroups = array(); + self::$serverGroups = []; // load the configuration $config = Configuration::getInstance(); @@ -447,7 +448,7 @@ class Memcache */ public static function getStats() { - $ret = array(); + $ret = []; foreach (self::getMemcacheServers() as $sg) { $stats = method_exists($sg, 'getExtendedStats') ? $sg->getExtendedStats() : $sg->getStats(); @@ -474,7 +475,7 @@ class Memcache */ public static function getRawStats() { - $ret = array(); + $ret = []; foreach (self::getMemcacheServers() as $sg) { $stats = method_exists($sg, 'getExtendedStats') ? $sg->getExtendedStats() : $sg->getStats(); diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php index 426d3cc630f9c8c4af0c60e6853c13cca2f5841f..e171ab90bfd6f205a3a9994db1ef04fac2eeda28 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php @@ -60,7 +60,7 @@ class MetaDataStorageHandler // for backwards compatibility, and to provide a default configuration if ($sourcesConfig === null) { $type = $config->getString('metadata.handler', 'flatfile'); - $sourcesConfig = array(array('type' => $type)); + $sourcesConfig = [['type' => $type]]; } try { @@ -140,7 +140,7 @@ class MetaDataStorageHandler { assert(is_string($set)); - $result = array(); + $result = []; foreach ($this->sources as $source) { $srcList = $source->getMetadataSet($set); @@ -335,7 +335,7 @@ class MetaDataStorageHandler assert(is_string($sha1)); assert(is_string($set)); - $result = array(); + $result = []; foreach ($this->sources as $source) { $srcList = $source->getMetadataSet($set); diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php index 6901c15a39dbd8f10f8b7d3e8ec64a54021a4258..2d7883b8c96cfaefc228266581498b5115ca23d3 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerFlatFile.php @@ -27,7 +27,7 @@ class MetaDataStorageHandlerFlatFile extends MetaDataStorageSource * * @var array */ - private $cachedMetadata = array(); + private $cachedMetadata = []; /** @@ -78,7 +78,7 @@ class MetaDataStorageHandlerFlatFile extends MetaDataStorageSource return null; } - $metadata = array(); + $metadata = []; include($metadatasetfile); @@ -107,7 +107,7 @@ class MetaDataStorageHandlerFlatFile extends MetaDataStorageSource $metadataSet = $this->load($set); if ($metadataSet === null) { - $metadataSet = array(); + $metadataSet = []; } // add the entity id of an entry to each entry in the metadata diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php index e5d18276496e9619f77927681d4e4a70937bbf8d..0645a0bec5485e5fb918a6cbba22c5f327b7e3e6 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php @@ -27,12 +27,12 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource /** * This is an associative array which stores the different metadata sets we have loaded. */ - private $cachedMetadata = array(); + private $cachedMetadata = []; /** * All the metadata sets supported by this MetaDataStorageHandler */ - public $supportedSets = array( + public $supportedSets = [ 'adfs-idp-hosted', 'adfs-sp-remote', 'saml20-idp-hosted', @@ -44,7 +44,7 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource 'shib13-sp-remote', 'wsfed-idp-remote', 'wsfed-sp-hosted' - ); + ]; /** @@ -90,7 +90,7 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource $stmt = $this->db->read("SELECT entity_id, entity_data FROM $tableName"); if ($stmt->execute()) { - $metadata = array(); + $metadata = []; while ($d = $stmt->fetch()) { $data = json_decode($d['entity_data'], true); @@ -127,7 +127,7 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource $metadataSet = $this->load($set); if ($metadataSet === null) { - $metadataSet = array(); + $metadataSet = []; } foreach ($metadataSet as $entityId => &$entry) { @@ -164,7 +164,7 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource $stmt = $this->db->read( "SELECT entity_id, entity_data FROM $tableName WHERE entity_id=:entityId", - array('entityId' => $entityId) + ['entityId' => $entityId] ); if ($stmt->execute()) { $rowCount = 0; @@ -237,17 +237,17 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource $metadata = $this->db->read( "SELECT entity_id, entity_data FROM $tableName WHERE entity_id = :entity_id", - array( + [ 'entity_id' => $index, - ) + ] ); $retrivedEntityIDs = $metadata->fetch(); - $params = array( + $params = [ 'entity_id' => $index, 'entity_data' => json_encode($entityData), - ); + ]; if ($retrivedEntityIDs !== false && count($retrivedEntityIDs) > 0) { $rows = $this->db->write( diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php index c1c7e6853ea022802f14acdd5ee9002eba15b2c1..8c050775678d401067097278739cb1e4915680ec 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php @@ -74,7 +74,7 @@ class MetaDataStorageHandlerSerialize extends MetaDataStorageSource */ public function getMetadataSets() { - $ret = array(); + $ret = []; $dh = @opendir($this->directory); if ($dh === false) { @@ -120,7 +120,7 @@ class MetaDataStorageHandlerSerialize extends MetaDataStorageSource { assert(is_string($set)); - $ret = array(); + $ret = []; $dir = $this->directory.'/'.rawurlencode($set); if (!is_dir($dir)) { @@ -130,8 +130,9 @@ class MetaDataStorageHandlerSerialize extends MetaDataStorageSource $dh = @opendir($dir); if ($dh === false) { - \SimpleSAML\Logger::warning('Serialize metadata handler: Unable to open directory: '. - var_export($dir, true)); + \SimpleSAML\Logger::warning( + 'Serialize metadata handler: Unable to open directory: '.var_export($dir, true) + ); return $ret; } diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php index 56ea35515b5b690f6261bf4dfea889f4511eeb97..9430781b6c1d02d2d6edbb451ec990183e8915f6 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php @@ -48,11 +48,11 @@ class MetaDataStorageHandlerXML extends MetaDataStorageSource } - $SP1x = array(); - $IdP1x = array(); - $SP20 = array(); - $IdP20 = array(); - $AAD = array(); + $SP1x = []; + $IdP1x = []; + $SP20 = []; + $IdP20 = []; + $AAD = []; if (isset($src)) { $entities = SAMLParser::parseDescriptorsFile($src); @@ -88,13 +88,13 @@ class MetaDataStorageHandlerXML extends MetaDataStorageSource } } - $this->metadata = array( + $this->metadata = [ 'shib13-sp-remote' => $SP1x, 'shib13-idp-remote' => $IdP1x, 'saml20-sp-remote' => $SP20, 'saml20-idp-remote' => $IdP20, 'attributeauthority-remote' => $AAD, - ); + ]; } @@ -113,6 +113,6 @@ class MetaDataStorageHandlerXML extends MetaDataStorageSource } // we don't have this metadata set - return array(); + return []; } } diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php index c692b4a709cf4c172d122a6efee798a6bc8293ca..76aeabb635076f76ca54c640aea061331c20d866 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php @@ -32,7 +32,7 @@ abstract class MetaDataStorageSource { assert(is_array($sourcesConfig)); - $sources = array(); + $sources = []; foreach ($sourcesConfig as $sourceConfig) { if (!is_array($sourceConfig)) { @@ -111,7 +111,7 @@ abstract class MetaDataStorageSource */ public function getMetadataSet($set) { - return array(); + return []; } @@ -176,7 +176,7 @@ abstract class MetaDataStorageSource $metadataSet = $this->getMetadataSet($set); foreach ($metadataSet as $index => $entry) { - $cidrHints = array(); + $cidrHints = []; // support hint.cidr for idp discovery if (array_key_exists('hint.cidr', $entry) && is_array($entry['hint.cidr'])) { diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 48e1f9454fb006b9428ea2e4bf84ef514a3c44a0..2e56c1bfde365f323287d41531753a6456ba74d7 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -328,7 +328,7 @@ class SAMLBuilder { assert(is_bool($indexed)); - $ret = array(); + $ret = []; foreach ($endpoints as &$ep) { if ($indexed) { @@ -387,7 +387,7 @@ class SAMLBuilder \SAML2\XML\md\SPSSODescriptor $spDesc, \SimpleSAML\Configuration $metadata ) { - $attributes = $metadata->getArray('attributes', array()); + $attributes = $metadata->getArray('attributes', []); $name = $metadata->getLocalizedString('name', null); if ($name === null || count($attributes) == 0) { @@ -395,7 +395,7 @@ class SAMLBuilder return; } - $attributesrequired = $metadata->getArray('attributes.required', array()); + $attributesrequired = $metadata->getArray('attributes.required', []); /* * Add an AttributeConsumingService element with information as name and description and list @@ -410,7 +410,7 @@ class SAMLBuilder } $attributeconsumer->ServiceName = $name; - $attributeconsumer->ServiceDescription = $metadata->getLocalizedString('description', array()); + $attributeconsumer->ServiceDescription = $metadata->getLocalizedString('description', []); $nameFormat = $metadata->getString('attributes.NameFormat', \SAML2\Constants::NAMEFORMAT_UNSPECIFIED); foreach ($attributes as $friendlyName => $attribute) { @@ -473,7 +473,7 @@ class SAMLBuilder * @param array $metadata The metadata. * @param array $protocols The protocols supported. Defaults to \SAML2\Constants::NS_SAMLP. */ - public function addMetadataSP20($metadata, $protocols = array(\SAML2\Constants::NS_SAMLP)) + public function addMetadataSP20($metadata, $protocols = [\SAML2\Constants::NS_SAMLP]) { assert(is_array($metadata)); assert(is_array($protocols)); @@ -501,14 +501,14 @@ class SAMLBuilder $e->SingleLogoutService = self::createEndpoints($metadata->getEndpoints('SingleLogoutService'), false); - $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', array()); + $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', []); $endpoints = $metadata->getEndpoints('AssertionConsumerService'); - foreach ($metadata->getArrayizeString('AssertionConsumerService.artifact', array()) as $acs) { - $endpoints[] = array( + foreach ($metadata->getArrayizeString('AssertionConsumerService.artifact', []) as $acs) { + $endpoints[] = [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', 'Location' => $acs, - ); + ]; } $e->AssertionConsumerService = self::createEndpoints($endpoints, true); @@ -516,7 +516,7 @@ class SAMLBuilder $this->entityDescriptor->RoleDescriptor[] = $e; - foreach ($metadata->getArray('contacts', array()) as $contact) { + foreach ($metadata->getArray('contacts', []) as $contact) { if (array_key_exists('contactType', $contact) && array_key_exists('emailAddress', $contact)) { $this->addContact($contact['contactType'], \SimpleSAML\Utils\Config\Metadata::getContact($contact)); } @@ -559,13 +559,13 @@ class SAMLBuilder $e->SingleLogoutService = self::createEndpoints($metadata->getEndpoints('SingleLogoutService'), false); - $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', array()); + $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', []); $e->SingleSignOnService = self::createEndpoints($metadata->getEndpoints('SingleSignOnService'), false); $this->entityDescriptor->RoleDescriptor[] = $e; - foreach ($metadata->getArray('contacts', array()) as $contact) { + foreach ($metadata->getArray('contacts', []) as $contact) { if (array_key_exists('contactType', $contact) && array_key_exists('emailAddress', $contact)) { $this->addContact($contact['contactType'], \SimpleSAML\Utils\Config\Metadata::getContact($contact)); } @@ -591,14 +591,14 @@ class SAMLBuilder $this->addCertificate($e, $metadata); - $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', array()); + $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', []); $endpoints = $metadata->getEndpoints('AssertionConsumerService'); - foreach ($metadata->getArrayizeString('AssertionConsumerService.artifact', array()) as $acs) { - $endpoints[] = array( + foreach ($metadata->getArrayizeString('AssertionConsumerService.artifact', []) as $acs) { + $endpoints[] = [ 'Binding' => 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01', 'Location' => $acs, - ); + ]; } $e->AssertionConsumerService = self::createEndpoints($endpoints, true); @@ -627,7 +627,7 @@ class SAMLBuilder $this->addCertificate($e, $metadata); - $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', array()); + $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', []); $e->SingleSignOnService = self::createEndpoints($metadata->getEndpoints('SingleSignOnService'), false); @@ -650,7 +650,7 @@ class SAMLBuilder $metadata = \SimpleSAML\Configuration::loadFromArray($metadata, $metadata['entityid']); $e = new \SAML2\XML\md\AttributeAuthorityDescriptor(); - $e->protocolSupportEnumeration = $metadata->getArray('protocols', array(\SAML2\Constants::NS_SAMLP)); + $e->protocolSupportEnumeration = $metadata->getArray('protocols', [\SAML2\Constants::NS_SAMLP]); $this->addExtensions($metadata, $e); $this->addCertificate($e, $metadata); @@ -661,7 +661,7 @@ class SAMLBuilder false ); - $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', array()); + $e->NameIDFormat = $metadata->getArrayizeString('NameIDFormat', []); $this->entityDescriptor->RoleDescriptor[] = $e; } @@ -684,7 +684,7 @@ class SAMLBuilder { assert(is_string($type)); assert(is_array($details)); - assert(in_array($type, array('technical', 'support', 'administrative', 'billing', 'other'), true)); + assert(in_array($type, ['technical', 'support', 'administrative', 'billing', 'other'], true)); // TODO: remove this check as soon as getContact() is called always before calling this function $details = \SimpleSAML\Utils\Config\Metadata::getContact($details); @@ -709,7 +709,7 @@ class SAMLBuilder if (isset($details['emailAddress'])) { $eas = $details['emailAddress']; if (!is_array($eas)) { - $eas = array($eas); + $eas = [$eas]; } foreach ($eas as $ea) { $e->EmailAddress[] = $ea; @@ -719,7 +719,7 @@ class SAMLBuilder if (isset($details['telephoneNumber'])) { $tlfNrs = $details['telephoneNumber']; if (!is_array($tlfNrs)) { - $tlfNrs = array($tlfNrs); + $tlfNrs = [$tlfNrs]; } foreach ($tlfNrs as $tlfNr) { $e->TelephoneNumber[] = $tlfNr; @@ -739,7 +739,7 @@ class SAMLBuilder */ private function addX509KeyDescriptor(\SAML2\XML\md\RoleDescriptor $rd, $use, $x509data) { - assert(in_array($use, array('encryption', 'signing'), true)); + assert(in_array($use, ['encryption', 'signing'], true)); assert(is_string($x509data)); $keyDescriptor = \SAML2\Utils::createKeyDescriptor($x509data); diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index e1acd3cfce01eef9adf47ebd1f3e9a5cbf46841e..bd8725198b1d6388ef626c915bee42aca96212a0 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -23,19 +23,19 @@ class SAMLParser * * @var string[] */ - private static $SAML1xProtocols = array( + private static $SAML1xProtocols = [ 'urn:oasis:names:tc:SAML:1.0:protocol', 'urn:oasis:names:tc:SAML:1.1:protocol', - ); + ]; /** * This is the list with the SAML 2.0 protocol. * * @var string[] */ - private static $SAML20Protocols = array( + private static $SAML20Protocols = [ 'urn:oasis:names:tc:SAML:2.0:protocol', - ); + ]; /** * This is the entity id we find in the metadata. @@ -71,7 +71,7 @@ class SAMLParser * * @var array */ - private $attributeAuthorityDescriptors = array(); + private $attributeAuthorityDescriptors = []; /** * This is an associative array with the organization name for this entity. The key of @@ -80,7 +80,7 @@ class SAMLParser * * @var string[] */ - private $organizationName = array(); + private $organizationName = []; /** * This is an associative array with the organization display name for this entity. The key of @@ -89,7 +89,7 @@ class SAMLParser * * @var string[] */ - private $organizationDisplayName = array(); + private $organizationDisplayName = []; /** * This is an associative array with the organization URI for this entity. The key of @@ -97,14 +97,14 @@ class SAMLParser * * @var string[] */ - private $organizationURL = array(); + private $organizationURL = []; /** * This is an array of the Contact Persons of this entity. * * @var array[] */ - private $contacts = array(); + private $contacts = []; /** * @var array @@ -132,7 +132,7 @@ class SAMLParser * * @var \SAML2\SignedElementHelper[] */ - private $validators = array(); + private $validators = []; /** * The original EntityDescriptor element for this entity, as a base64 encoded string. @@ -153,13 +153,13 @@ class SAMLParser private function __construct( \SAML2\XML\md\EntityDescriptor $entityElement, $maxExpireTime, - array $validators = array(), - array $parentExtensions = array() + array $validators = [], + array $parentExtensions = [] ) { assert($maxExpireTime === null || is_int($maxExpireTime)); - $this->spDescriptors = array(); - $this->idpDescriptors = array(); + $this->spDescriptors = []; + $this->idpDescriptors = []; $e = $entityElement->toXML(); $e = $e->ownerDocument->saveXML($e); @@ -271,7 +271,7 @@ class SAMLParser public static function parseElement($entityElement) { assert($entityElement instanceof \SAML2\XML\md\EntityDescriptor); - return new SAMLParser($entityElement, null, array()); + return new SAMLParser($entityElement, null, []); } @@ -373,14 +373,14 @@ class SAMLParser private static function processDescriptorsElement( $element, $maxExpireTime = null, - array $validators = array(), - array $parentExtensions = array() + array $validators = [], + array $parentExtensions = [] ) { assert($maxExpireTime === null || is_int($maxExpireTime)); if ($element instanceof \SAML2\XML\md\EntityDescriptor) { $ret = new SAMLParser($element, $maxExpireTime, $validators, $parentExtensions); - $ret = array($ret->getEntityId() => $ret); + $ret = [$ret->getEntityId() => $ret]; /** @var SAMLParser[] $ret */ return $ret; } @@ -392,7 +392,7 @@ class SAMLParser $validators[] = $element; - $ret = array(); + $ret = []; foreach ($element->children as $child) { $ret += self::processDescriptorsElement($child, $expTime, $validators, $extensions); } @@ -439,7 +439,7 @@ class SAMLParser private function getMetadataCommon() { - $ret = array(); + $ret = []; $ret['entityid'] = $this->entityId; $ret['entityDescriptor'] = $this->entityDescriptor; @@ -836,7 +836,7 @@ class SAMLParser { assert($expireTime === null || is_int($expireTime)); - $ret = array(); + $ret = []; $expireTime = self::getExpireTime($element, $expireTime); @@ -848,7 +848,7 @@ class SAMLParser $ret['protocols'] = $element->protocolSupportEnumeration; // process KeyDescriptor elements - $ret['keys'] = array(); + $ret['keys'] = []; foreach ($element->KeyDescriptor as $kd) { $key = self::parseKeyDescriptor($kd); if ($key !== null) { @@ -999,16 +999,16 @@ class SAMLParser * * @return array An associative array with the extensions parsed. */ - private static function processExtensions($element, $parentExtensions = array()) + private static function processExtensions($element, $parentExtensions = []) { - $ret = array( - 'scope' => array(), - 'tags' => array(), - 'EntityAttributes' => array(), - 'RegistrationInfo' => array(), - 'UIInfo' => array(), - 'DiscoHints' => array(), - ); + $ret = [ + 'scope' => [], + 'tags' => [], + 'EntityAttributes' => [], + 'RegistrationInfo' => [], + 'UIInfo' => [], + 'DiscoHints' => [], + ]; // Some extensions may get inherited from a parent element if (($element instanceof \SAML2\XML\md\EntityDescriptor || $element instanceof \SAML2\XML\md\EntitiesDescriptor) @@ -1052,7 +1052,7 @@ class SAMLParser $name = '{'.$attr->NameFormat.'}'.$attr->Name; } - $values = array(); + $values = []; foreach ($attr->AttributeValue as $attrvalue) { $values[] = $attrvalue->getString(); } @@ -1088,11 +1088,11 @@ class SAMLParser ) { continue; } - $logo = array( + $logo = [ 'url' => $uiItem->url, 'height' => $uiItem->height, 'width' => $uiItem->width, - ); + ]; if (!empty($uiItem->lang)) { $logo['lang'] = $uiItem->lang; } @@ -1119,7 +1119,7 @@ class SAMLParser $name = $attribute->getAttribute('Name'); $values = array_map( - array('\SimpleSAML\Utils\XML', 'getDOMText'), + ['\SimpleSAML\Utils\XML', 'getDOMText'], \SimpleSAML\Utils\XML::getDOMChildren($attribute, 'AttributeValue', '@saml2') ); @@ -1157,7 +1157,7 @@ class SAMLParser private function processContactPerson(\SAML2\XML\md\ContactPerson $element) { - $contactPerson = array(); + $contactPerson = []; if (!empty($element->contactType)) { $contactPerson['contactType'] = $element->contactType; } @@ -1196,8 +1196,8 @@ class SAMLParser $sp['description'] = $element->ServiceDescription; $format = null; - $sp['attributes'] = array(); - $sp['attributes.required'] = array(); + $sp['attributes'] = []; + $sp['attributes.required'] = []; foreach ($element->RequestedAttribute as $child) { $attrname = $child->Name; $sp['attributes'][] = $attrname; @@ -1249,7 +1249,7 @@ class SAMLParser */ private static function parseGenericEndpoint(\SAML2\XML\md\EndpointType $element) { - $ep = array(); + $ep = []; $ep['Binding'] = $element->Binding; $ep['Location'] = $element->Location; @@ -1279,7 +1279,7 @@ class SAMLParser */ private static function extractEndpoints(array $endpoints) { - $ret = array(); + $ret = []; foreach ($endpoints as $ep) { $ret[] = self::parseGenericEndpoint($ep); } @@ -1304,7 +1304,7 @@ class SAMLParser */ private static function parseKeyDescriptor(\SAML2\XML\md\KeyDescriptor $kd) { - $r = array(); + $r = []; if ($kd->use === 'encryption') { $r['encryption'] = true; @@ -1340,13 +1340,13 @@ class SAMLParser * * @param $protocols Array with the protocols we accept. * - * @return Array with SP descriptors which supports one of the given protocols. + * @return array with SP descriptors which supports one of the given protocols. */ private function getSPDescriptors($protocols) { assert(is_array($protocols)); - $ret = array(); + $ret = []; foreach ($this->spDescriptors as $spd) { $sharedProtocols = array_intersect($protocols, $spd['protocols']); @@ -1364,13 +1364,13 @@ class SAMLParser * * @param $protocols Array with the protocols we accept. * - * @return Array with IdP descriptors which supports one of the given protocols. + * @return array with IdP descriptors which supports one of the given protocols. */ private function getIdPDescriptors($protocols) { assert(is_array($protocols)); - $ret = array(); + $ret = []; foreach ($this->idpDescriptors as $idpd) { $sharedProtocols = array_intersect($protocols, $idpd['protocols']); @@ -1435,7 +1435,7 @@ class SAMLParser $certData = file_get_contents($certFile); foreach ($this->validators as $validator) { - $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, array('type' => 'public')); + $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, ['type' => 'public']); $key->loadKey($certData); try { if ($validator->validate($key)) { @@ -1466,7 +1466,7 @@ class SAMLParser $fingerprint = strtolower(str_replace(":", "", $fingerprint)); - $candidates = array(); + $candidates = []; foreach ($this->validators as $validator) { foreach ($validator->getValidatingCertificates() as $cert) { $fp = strtolower(sha1(base64_decode($cert))); diff --git a/lib/SimpleSAML/Metadata/Signer.php b/lib/SimpleSAML/Metadata/Signer.php index 195cb02c53b59ab1367159885d0b8987240f86fb..98806d56211f41baa0de73066681e07c8623549b 100644 --- a/lib/SimpleSAML/Metadata/Signer.php +++ b/lib/SimpleSAML/Metadata/Signer.php @@ -43,10 +43,10 @@ class Signer ); } - $ret = array( + $ret = [ 'privatekey' => $entityMetadata['metadata.sign.privatekey'], 'certificate' => $entityMetadata['metadata.sign.certificate'] - ); + ]; if (array_key_exists('metadata.sign.privatekey_pass', $entityMetadata)) { $ret['privatekey_pass'] = $entityMetadata['metadata.sign.privatekey_pass']; @@ -67,7 +67,7 @@ class Signer ' must also be specified.' ); } - $ret = array('privatekey' => $privatekey, 'certificate' => $certificate); + $ret = ['privatekey' => $privatekey, 'certificate' => $certificate]; $privatekey_pass = $config->getString('metadata.sign.privatekey_pass', null); if ($privatekey_pass !== null) { @@ -92,10 +92,10 @@ class Signer ); } - $ret = array( + $ret = [ 'privatekey' => $entityMetadata['privatekey'], 'certificate' => $entityMetadata['certificate'] - ); + ]; if (array_key_exists('privatekey_pass', $entityMetadata)) { $ret['privatekey_pass'] = $entityMetadata['privatekey_pass']; @@ -173,12 +173,12 @@ class Signer $alg = $config->getString('metadata.sign.algorithm', XMLSecurityKey::RSA_SHA256); } - $supported_algs = array( + $supported_algs = [ XMLSecurityKey::RSA_SHA1, XMLSecurityKey::RSA_SHA256, XMLSecurityKey::RSA_SHA384, XMLSecurityKey::RSA_SHA512, - ); + ]; if (!in_array($alg, $supported_algs, true)) { throw new \SimpleSAML\Error\CriticalConfigurationError("Unknown signature algorithm '$alg'"); @@ -198,10 +198,10 @@ class Signer $digest = XMLSecurityDSig::SHA1; } - return array( + return [ 'algorithm' => $alg, 'digest' => $digest, - ); + ]; } @@ -229,8 +229,9 @@ class Signer $keyFile = \SimpleSAML\Utils\Config::getCertPath($keyCertFiles['privatekey']); if (!file_exists($keyFile)) { - throw new \Exception('Could not find private key file ['. - $keyFile.'], which is needed to sign the metadata'); + throw new \Exception( + 'Could not find private key file ['.$keyFile.'], which is needed to sign the metadata' + ); } $keyData = file_get_contents($keyFile); @@ -253,7 +254,7 @@ class Signer $signature_cf = self::getMetadataSigningAlgorithm($config, $entityMetadata, $type); // load the private key - $objKey = new XMLSecurityKey($signature_cf['algorithm'], array('type' => 'private')); + $objKey = new XMLSecurityKey($signature_cf['algorithm'], ['type' => 'private']); if (array_key_exists('privatekey_pass', $keyCertFiles)) { $objKey->passphrase = $keyCertFiles['privatekey_pass']; } @@ -268,10 +269,10 @@ class Signer $objXMLSecDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); $objXMLSecDSig->addReferenceList( - array($rootNode), + [$rootNode], $signature_cf['digest'], - array('http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N), - array('id_name' => 'ID') + ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N], + ['id_name' => 'ID'] ); $objXMLSecDSig->sign($objKey); diff --git a/lib/SimpleSAML/Metadata/Sources/MDQ.php b/lib/SimpleSAML/Metadata/Sources/MDQ.php index bb0b053f8462eaa7418426ead3a50fdd080699ca..413846427709d87e28bfeebec1b4148ba0b85fb9 100644 --- a/lib/SimpleSAML/Metadata/Sources/MDQ.php +++ b/lib/SimpleSAML/Metadata/Sources/MDQ.php @@ -104,7 +104,7 @@ class MDQ extends \SimpleSAML\Metadata\MetaDataStorageSource public function getMetadataSet($set) { // we don't have this metadata set - return array(); + return []; } diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index e3e018c7bf01b8f46569339b7b95a689e2f8b352..9668a367306afef04e8a10f8cd7561d925456fdc 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -17,14 +17,14 @@ class Module * * @var array */ - public static $modules = array(); + public static $modules = []; /** * A cache containing specific information for modules, like whether they are enabled or not, or their hooks. * * @var array */ - public static $module_info = array(); + public static $module_info = []; /** @@ -59,7 +59,7 @@ class Module public static function isModuleEnabled($module) { $config = Configuration::getOptionalConfig(); - return self::isModuleEnabledWithConf($module, $config->getArray('module.enable', array())); + return self::isModuleEnabledWithConf($module, $config->getArray('module.enable', [])); } @@ -219,7 +219,7 @@ class Module * * @return string The absolute URL to the given resource. */ - public static function getModuleURL($resource, array $parameters = array()) + public static function getModuleURL($resource, array $parameters = []) { assert(is_string($resource)); assert($resource[0] !== '/'); @@ -249,10 +249,10 @@ class Module $hook_dir = self::getModuleDir($module).'/hooks'; if (!is_dir($hook_dir)) { - return array(); + return []; } - $hooks = array(); + $hooks = []; $files = scandir($hook_dir); foreach ($files as $file) { if ($file[0] === '.') { @@ -264,7 +264,7 @@ class Module } $hook_name = $matches[1]; $hook_func = $module.'_hook_'.$hook_name; - $hooks[$hook_name] = array('file' => $hook_dir.'/'.$file, 'func' => $hook_func); + $hooks[$hook_name] = ['file' => $hook_dir.'/'.$file, 'func' => $hook_func]; } return $hooks; } @@ -285,7 +285,7 @@ class Module assert(is_string($hook)); $modules = self::getModules(); - $config = Configuration::getOptionalConfig()->getArray('module.enable', array()); + $config = Configuration::getOptionalConfig()->getArray('module.enable', []); sort($modules); foreach ($modules as $module) { if (!self::isModuleEnabledWithConf($module, $config)) { diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 2abb45c96ef52b08cb247ebcb67756ae44032e49..481a1d6893a964cfa15af16eb683ded7bb445fb0 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -38,7 +38,7 @@ class Session implements \Serializable * * @var array */ - private static $sessions = array(); + private static $sessions = []; /** @@ -48,7 +48,6 @@ class Session implements \Serializable */ private static $instance = null; - /** * The session ID of this session. * @@ -56,7 +55,6 @@ class Session implements \Serializable */ private $sessionId; - /** * Transient session flag. * @@ -64,7 +62,6 @@ class Session implements \Serializable */ private $transient = false; - /** * The track id is a new random unique identifier that is generated for each session. * This is used in the debug logs and error messages to easily track more information @@ -74,10 +71,11 @@ class Session implements \Serializable */ private $trackid = null; - + /** + * @var integer|null + */ private $rememberMeExpire = null; - /** * Marks a session as modified, and therefore needs to be saved before destroying * this object. @@ -86,7 +84,6 @@ class Session implements \Serializable */ private $dirty = false; - /** * Tells the session object that the save callback has been registered and there's no need to register it again. * @@ -94,7 +91,6 @@ class Session implements \Serializable */ private $callback_registered = false; - /** * This is an array of objects which will expire automatically after a set time. It is used * where one needs to store some information - for example a logout request, but doesn't @@ -105,8 +101,7 @@ class Session implements \Serializable * * @var array */ - private $dataStore = array(); - + private $dataStore = []; /** * The list of IdP-SP associations. @@ -116,8 +111,7 @@ class Session implements \Serializable * * @var array */ - private $associations = array(); - + private $associations = []; /** * The authentication token. @@ -128,7 +122,6 @@ class Session implements \Serializable */ private $authToken; - /** * Authentication data. * @@ -136,8 +129,7 @@ class Session implements \Serializable * * @var array Associative array of associative arrays. */ - private $authData = array(); - + private $authData = []; /** * Private constructor that restricts instantiation to either getSessionFromRequest() for the current session or @@ -191,7 +183,6 @@ class Session implements \Serializable } } - /** * Serialize this session object. * @@ -205,7 +196,6 @@ class Session implements \Serializable return $serialized; } - /** * Unserialize a session object and load it.. * @@ -239,7 +229,6 @@ class Session implements \Serializable } } - /** * Retrieves the current session. Creates a new session if there's not one. * @@ -381,7 +370,6 @@ class Session implements \Serializable return $session; } - /** * Load a given session as the current one. * @@ -457,7 +445,6 @@ class Session implements \Serializable } } - /** * Save the current session and clean any left overs that could interfere with the normal application behaviour. * @@ -473,7 +460,6 @@ class Session implements \Serializable } } - /** * Mark this session as dirty. * @@ -491,10 +477,9 @@ class Session implements \Serializable // we already have a shutdown callback registered for this object, no need to add another one return; } - $this->callback_registered = header_register_callback(array($this, 'save')); + $this->callback_registered = header_register_callback([$this, 'save']); } - /** * Destroy the session. * @@ -562,7 +547,7 @@ class Session implements \Serializable } $this->rememberMeExpire = $expire; - $cookieParams = array('expire' => $this->rememberMeExpire); + $cookieParams = ['expire' => $this->rememberMeExpire]; $this->updateSessionCookies($cookieParams); } @@ -591,7 +576,7 @@ class Session implements \Serializable } if ($data === null) { - $data = array(); + $data = []; } $data['Authority'] = $authority; @@ -767,7 +752,7 @@ class Session implements \Serializable $sessionHandler->setCookie($sessionHandler->getSessionCookieName(), $this->sessionId, $params); } - $params = array_merge($sessionHandler->getCookieParams(), is_array($params) ? $params : array()); + $params = array_merge($sessionHandler->getCookieParams(), is_array($params) ? $params : []); if ($this->authToken !== null) { $globalConfig = Configuration::getInstance(); @@ -813,7 +798,7 @@ class Session implements \Serializable { assert(isset($this->authData[$authority])); - $logout_handler = array($classname, $functionname); + $logout_handler = [$classname, $functionname]; if (!is_callable($logout_handler)) { throw new \Exception( @@ -856,7 +841,7 @@ class Session implements \Serializable * @param string $type The type of the data. This is checked when retrieving data from the store. * @param string $id The identifier of the data. * @param mixed $data The data. - * @param int|null $timeout The number of seconds this data should be stored after its last access. + * @param int|string|null $timeout The number of seconds this data should be stored after its last access. * This parameter is optional. The default value is set in 'session.datastore.timeout', * and the default is 4 hours. * @@ -893,14 +878,14 @@ class Session implements \Serializable $expires = time() + $timeout; } - $dataInfo = array( + $dataInfo = [ 'expires' => $expires, 'timeout' => $timeout, 'data' => $data - ); + ]; if (!array_key_exists($type, $this->dataStore)) { - $this->dataStore[$type] = array(); + $this->dataStore[$type] = []; } $this->dataStore[$type][$id] = $dataInfo; @@ -984,10 +969,10 @@ class Session implements \Serializable assert(is_string($type)); if (!array_key_exists($type, $this->dataStore)) { - return array(); + return []; } - $ret = array(); + $ret = []; foreach ($this->dataStore[$type] as $id => $info) { $ret[$id] = $info['data']; } @@ -1013,7 +998,6 @@ class Session implements \Serializable return $this->authData[$authority]; } - /** * Check whether the session cookie is set. * @@ -1027,7 +1011,6 @@ class Session implements \Serializable return $sh->hasSessionCookie(); } - /** * Add an SP association for an IdP. * @@ -1043,11 +1026,11 @@ class Session implements \Serializable assert(isset($association['Handler'])); if (!isset($this->associations)) { - $this->associations = array(); + $this->associations = []; } if (!isset($this->associations[$idp])) { - $this->associations[$idp] = array(); + $this->associations[$idp] = []; } $this->associations[$idp][$association['id']] = $association; @@ -1055,7 +1038,6 @@ class Session implements \Serializable $this->markDirty(); } - /** * Retrieve the associations for an IdP. * @@ -1070,11 +1052,11 @@ class Session implements \Serializable assert(is_string($idp)); if (!isset($this->associations)) { - $this->associations = array(); + $this->associations = []; } if (!isset($this->associations[$idp])) { - return array(); + return []; } foreach ($this->associations[$idp] as $id => $assoc) { @@ -1091,7 +1073,6 @@ class Session implements \Serializable return $this->associations[$idp]; } - /** * Remove an SP association for an IdP. * @@ -1118,7 +1099,6 @@ class Session implements \Serializable $this->markDirty(); } - /** * Retrieve authentication data. * @@ -1138,7 +1118,6 @@ class Session implements \Serializable return $this->authData[$authority][$name]; } - /** * Retrieve a list of authorities (authentication sources) that are currently valid within * this session. @@ -1147,7 +1126,7 @@ class Session implements \Serializable */ public function getAuthorities() { - $authorities = array(); + $authorities = []; foreach (array_keys($this->authData) as $authority) { if ($this->isValid($authority)) { $authorities[] = $authority; diff --git a/lib/SimpleSAML/SessionHandler.php b/lib/SimpleSAML/SessionHandler.php index 25f4ab580a4b67f53b49f3f5ef4b43c4e2ca62ed..f8e0236f5b887a13970fccb338aab6a716e21b7b 100644 --- a/lib/SimpleSAML/SessionHandler.php +++ b/lib/SimpleSAML/SessionHandler.php @@ -149,12 +149,12 @@ abstract class SessionHandler { $config = Configuration::getInstance(); - return array( + return [ 'lifetime' => $config->getInteger('session.cookie.lifetime', 0), 'path' => $config->getString('session.cookie.path', '/'), 'domain' => $config->getString('session.cookie.domain', null), 'secure' => $config->getBoolean('session.cookie.secure', false), 'httponly' => true, - ); + ]; } } diff --git a/lib/SimpleSAML/SessionHandlerPHP.php b/lib/SimpleSAML/SessionHandlerPHP.php index b83b6bffadca59fdc94a4d3ac5e5734e52197ca0..554605b98737957d27e7790e6a21ec29dc084401 100644 --- a/lib/SimpleSAML/SessionHandlerPHP.php +++ b/lib/SimpleSAML/SessionHandlerPHP.php @@ -34,7 +34,7 @@ class SessionHandlerPHP extends SessionHandler * * @var array */ - private $previous_session = array(); + private $previous_session = []; /** @@ -147,7 +147,7 @@ class SessionHandlerPHP extends SessionHandler $this->previous_session['cookie_params']['httponly'] ); session_id($this->previous_session['id']); - $this->previous_session = array(); + $this->previous_session = []; $this->sessionStart(); /* diff --git a/lib/SimpleSAML/Stats.php b/lib/SimpleSAML/Stats.php index 5a1dbf47fea703bbf92b4481365595fac05b595b..8c2987c828d08ffb09d18075fcc5cc41ad3b2e14 100644 --- a/lib/SimpleSAML/Stats.php +++ b/lib/SimpleSAML/Stats.php @@ -52,9 +52,9 @@ class Stats { $config = \SimpleSAML\Configuration::getInstance(); - $outputCfgs = $config->getConfigList('statistics.out', array()); + $outputCfgs = $config->getConfigList('statistics.out', []); - self::$outputs = array(); + self::$outputs = []; foreach ($outputCfgs as $cfg) { self::$outputs[] = self::createOutput($cfg); } @@ -69,7 +69,7 @@ class Stats * * @return void|boolean False if output is not enabled, void otherwise. */ - public static function log($event, array $data = array()) + public static function log($event, array $data = []) { assert(is_string($event)); assert(!isset($data['op'])); diff --git a/lib/SimpleSAML/Store/Redis.php b/lib/SimpleSAML/Store/Redis.php index 1841670ba8b1f7dfdebad3352a834816bbce320f..9091ddd631ebb9fffa80c48706fa73919f2d9af8 100644 --- a/lib/SimpleSAML/Store/Redis.php +++ b/lib/SimpleSAML/Store/Redis.php @@ -33,14 +33,14 @@ class Redis extends Store $prefix = $config->getString('store.redis.prefix', 'SimpleSAMLphp'); $redis = new \Predis\Client( - array( + [ 'scheme' => 'tcp', 'host' => $host, 'port' => $port, - ), - array( + ], + [ 'prefix' => $prefix, - ) + ] ); } diff --git a/lib/SimpleSAML/Store/SQL.php b/lib/SimpleSAML/Store/SQL.php index 50d23f5d475a8ae9993288f8972d06e760e8f5b5..72bb84248cefd72baf526943579cbafedca2e982 100644 --- a/lib/SimpleSAML/Store/SQL.php +++ b/lib/SimpleSAML/Store/SQL.php @@ -80,7 +80,7 @@ class SQL extends Store */ private function initTableVersionTable() { - $this->tableVersions = array(); + $this->tableVersions = []; try { $fetchTableVersion = $this->pdo->query('SELECT _name, _version FROM '.$this->prefix.'_tableVersion'); @@ -115,13 +115,13 @@ class SQL extends Store * Queries for updates, grouped by version. * New updates can be added as a new array in this array */ - $table_updates = array( - array( + $table_updates = [ + [ 'CREATE TABLE '.$this->prefix. '_kvstore (_type VARCHAR(30) NOT NULL, _key VARCHAR(50) NOT NULL, _value '.$text_t. ' NOT NULL, _expire TIMESTAMP, PRIMARY KEY (_key, _type))', 'CREATE INDEX '.$this->prefix.'_kvstore_expire ON '.$this->prefix.'_kvstore (_expire)' - ), + ], /** * This upgrade removes the default NOT NULL constraint on the _expire field in MySQL. * Because SQLite does not support field alterations, the approach is to: @@ -131,7 +131,7 @@ class SQL extends Store * Rename the new table correctly * Readd the index */ - array( + [ 'CREATE TABLE '.$this->prefix. '_kvstore_new (_type VARCHAR(30) NOT NULL, _key VARCHAR(50) NOT NULL, _value '.$text_t. ' NOT NULL, _expire TIMESTAMP NULL, PRIMARY KEY (_key, _type))', @@ -139,8 +139,8 @@ class SQL extends Store 'DROP TABLE '.$this->prefix.'_kvstore', 'ALTER TABLE '.$this->prefix.'_kvstore_new RENAME TO '.$this->prefix.'_kvstore', 'CREATE INDEX '.$this->prefix.'_kvstore_expire ON '.$this->prefix.'_kvstore (_expire)' - ) - ); + ] + ]; $latest_version = count($table_updates); @@ -193,8 +193,8 @@ class SQL extends Store $this->insertOrUpdate( $this->prefix.'_tableVersion', - array('_name'), - array('_name' => $name, '_version' => $version) + ['_name'], + ['_name' => $name, '_version' => $version] ); $this->tableVersions[$name] = $version; } @@ -246,8 +246,8 @@ class SQL extends Store } } - $updateCols = array(); - $condCols = array(); + $updateCols = []; + $condCols = []; foreach ($data as $col => $value) { $tmp = $col.' = :'.$col; @@ -272,7 +272,7 @@ class SQL extends Store Logger::debug('store.sql: Cleaning key-value store.'); $query = 'DELETE FROM '.$this->prefix.'_kvstore WHERE _expire < :now'; - $params = array('now' => gmdate('Y-m-d H:i:s')); + $params = ['now' => gmdate('Y-m-d H:i:s')]; $query = $this->pdo->prepare($query); $query->execute($params); @@ -298,7 +298,7 @@ class SQL extends Store $query = 'SELECT _value FROM '.$this->prefix. '_kvstore WHERE _type = :type AND _key = :key AND (_expire IS NULL OR _expire > :now)'; - $params = array('type' => $type, 'key' => $key, 'now' => gmdate('Y-m-d H:i:s')); + $params = ['type' => $type, 'key' => $key, 'now' => gmdate('Y-m-d H:i:s')]; $query = $this->pdo->prepare($query); $query->execute($params); @@ -351,14 +351,14 @@ class SQL extends Store $value = serialize($value); $value = rawurlencode($value); - $data = array( + $data = [ '_type' => $type, '_key' => $key, '_value' => $value, '_expire' => $expire, - ); + ]; - $this->insertOrUpdate($this->prefix.'_kvstore', array('_type', '_key'), $data); + $this->insertOrUpdate($this->prefix.'_kvstore', ['_type', '_key'], $data); } @@ -377,10 +377,10 @@ class SQL extends Store $key = sha1($key); } - $data = array( + $data = [ '_type' => $type, '_key' => $key, - ); + ]; $query = 'DELETE FROM '.$this->prefix.'_kvstore WHERE _type=:_type AND _key=:_key'; $query = $this->pdo->prepare($query); diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php index 0a830bb44b0fcc583a19d698a2736c794da3e846..c6e04223e9baf472b6a5909d01bce4043ca676ce 100644 --- a/lib/SimpleSAML/Utilities.php +++ b/lib/SimpleSAML/Utilities.php @@ -191,7 +191,7 @@ class Utilities } - private static function doRedirect($url, $parameters = array()) + private static function doRedirect($url, $parameters = []) { assert(is_string($url)); assert(!empty($url)); @@ -253,7 +253,7 @@ class Utilities * @deprecated 1.12.0 This method will be removed from the API. Instead, use the redirectTrustedURL() or * redirectUntrustedURL() functions accordingly. */ - public static function redirect($url, $parameters = array(), $allowed_redirect_hosts = null) + public static function redirect($url, $parameters = [], $allowed_redirect_hosts = null) { assert(is_string($url)); assert(strlen($url) > 0); @@ -272,7 +272,7 @@ class Utilities * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::redirectTrustedURL() * instead. */ - public static function redirectTrustedURL($url, $parameters = array()) + public static function redirectTrustedURL($url, $parameters = []) { \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, $parameters); } @@ -282,7 +282,7 @@ class Utilities * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::redirectUntrustedURL() * instead. */ - public static function redirectUntrustedURL($url, $parameters = array()) + public static function redirectUntrustedURL($url, $parameters = []) { \SimpleSAML\Utils\HTTP::redirectUntrustedURL($url, $parameters); } @@ -562,17 +562,17 @@ class Utilities assert(is_array($post)); $postId = \SimpleSAML\Utils\Random::generateID(); - $postData = array( + $postData = [ 'post' => $post, 'url' => $destination, - ); + ]; $session = \SimpleSAML\Session::getSessionFromRequest(); $session->setData('core_postdatalink', $postId, $postData); $redirInfo = base64_encode(\SimpleSAML\Utils\Crypto::aesEncrypt($session->getSessionId().':'.$postId)); - $url = \SimpleSAML\Module::getModuleURL('core/postredirect.php', array('RedirInfo' => $redirInfo)); + $url = \SimpleSAML\Module::getModuleURL('core/postredirect.php', ['RedirInfo' => $redirInfo]); $url = preg_replace("#^https:#", "http:", $url); return $url; @@ -665,7 +665,7 @@ class Utilities /** * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::fetch() instead. */ - public static function fetch($path, $context = array(), $getHeaders = false) + public static function fetch($path, $context = [], $getHeaders = false) { return \SimpleSAML\Utils\HTTP::fetch($path, $context, $getHeaders); } diff --git a/lib/SimpleSAML/Utils/Arrays.php b/lib/SimpleSAML/Utils/Arrays.php index 0a5129230b98a50eac339225f2fb72ad0b441ed4..c27b198eb0284d72b69d013325ad924bdfa05498 100644 --- a/lib/SimpleSAML/Utils/Arrays.php +++ b/lib/SimpleSAML/Utils/Arrays.php @@ -23,7 +23,7 @@ class Arrays */ public static function arrayize($data, $index = 0) { - return (is_array($data)) ? $data : array($index => $data); + return (is_array($data)) ? $data : [$index => $data]; } @@ -42,7 +42,7 @@ class Arrays return false; } - $ret = array(); + $ret = []; foreach ($array as $k1 => $a2) { if (!is_array($a2)) { return false; @@ -50,7 +50,7 @@ class Arrays foreach ($a2 as $k2 => $v) { if (!array_key_exists($k2, $ret)) { - $ret[$k2] = array(); + $ret[$k2] = []; } $ret[$k2][$k1] = $v; } diff --git a/lib/SimpleSAML/Utils/Attributes.php b/lib/SimpleSAML/Utils/Attributes.php index f06efbfd628e92ebf2d1e1c49c4b9fad227fa2bd..88c87f1aa26a271f0f473062ace38c1c22029c07 100644 --- a/lib/SimpleSAML/Utils/Attributes.php +++ b/lib/SimpleSAML/Utils/Attributes.php @@ -85,7 +85,7 @@ class Attributes ); } - $newAttrs = array(); + $newAttrs = []; foreach ($attributes as $name => $values) { if (!is_string($name)) { throw new \InvalidArgumentException('Invalid attribute name: "'.print_r($name, true).'".'); @@ -127,6 +127,6 @@ class Attributes $defaultns = substr($name, 0, $slash); $name = substr($name, $slash + 1); } - return array(htmlspecialchars($defaultns), htmlspecialchars($name)); + return [htmlspecialchars($defaultns), htmlspecialchars($name)]; } } diff --git a/lib/SimpleSAML/Utils/Auth.php b/lib/SimpleSAML/Utils/Auth.php index ad6c4df4b06a05fc40fbefbcffd95dd036c760fd..7cff78b27c038d68e6aa07774197015dcf74bf82 100644 --- a/lib/SimpleSAML/Utils/Auth.php +++ b/lib/SimpleSAML/Utils/Auth.php @@ -28,9 +28,29 @@ class Auth $returnTo = HTTP::getSelfURL(); } - return Module::getModuleURL('core/login-admin.php', array('ReturnTo' => $returnTo)); + return Module::getModuleURL('core/login-admin.php', ['ReturnTo' => $returnTo]); } + + /** + * Retrieve a admin logout URL. + * + * @param string|NULL $returnTo The URL the user should arrive on after admin authentication. Defaults to null. + * + * @return string A URL which can be used for logging out. + * @throws \InvalidArgumentException If $returnTo is neither a string nor null. + */ + public static function getAdminLogoutURL($returnTo = null) + { + if (!(is_string($returnTo) || is_null($returnTo))) { + throw new \InvalidArgumentException('Invalid input parameters.'); + } + + $as = new \SimpleSAML\Auth\Simple('admin'); + return $as->getLogoutURL($returnTo = null); + } + + /** * Check whether the current user is admin. * diff --git a/lib/SimpleSAML/Utils/Config/Metadata.php b/lib/SimpleSAML/Utils/Config/Metadata.php index 5cecde3001ddb7a7eae9cb81a636111eb726c50f..b306d200c1e8b332b622bbfab2bd66782a1ce571 100644 --- a/lib/SimpleSAML/Utils/Config/Metadata.php +++ b/lib/SimpleSAML/Utils/Config/Metadata.php @@ -35,7 +35,7 @@ class Metadata * @var array The valid configuration options for a contact configuration array. * @see "Metadata for the OASIS Security Assertion Markup Language (SAML) V2.0", section 2.3.2.2. */ - public static $VALID_CONTACT_OPTIONS = array( + public static $VALID_CONTACT_OPTIONS = [ 'contactType', 'emailAddress', 'givenName', @@ -43,20 +43,20 @@ class Metadata 'telephoneNumber', 'company', 'attributes', - ); + ]; /** * @var array The valid types of contact for a contact configuration array. * @see "Metadata for the OASIS Security Assertion Markup Language (SAML) V2.0", section 2.3.2.2. */ - public static $VALID_CONTACT_TYPES = array( + public static $VALID_CONTACT_TYPES = [ 'technical', 'support', 'administrative', 'billing', 'other', - ); + ]; /** diff --git a/lib/SimpleSAML/Utils/Crypto.php b/lib/SimpleSAML/Utils/Crypto.php index 7a6ea922eaa3560a0b651eca118c90de5df03808..dece1961c5b20f664509b951a7aba740b3908dda 100644 --- a/lib/SimpleSAML/Utils/Crypto.php +++ b/lib/SimpleSAML/Utils/Crypto.php @@ -220,9 +220,9 @@ class Crypto throw new Error\Exception('Unable to load private key from file "'.$file.'"'); } - $ret = array( + $ret = [ 'PEM' => $data, - ); + ]; if ($metadata->hasValue($prefix.'privatekey_pass')) { $ret['password'] = $metadata->getString($prefix.'privatekey_pass'); @@ -286,11 +286,11 @@ class Crypto "-----END CERTIFICATE-----\n"; $certFingerprint = strtolower(sha1(base64_decode($certData))); - return array( + return [ 'certData' => $certData, 'PEM' => $pem, - 'certFingerprint' => array($certFingerprint), - ); + 'certFingerprint' => [$certFingerprint], + ]; } // no valid key found } elseif ($metadata->hasValue($prefix.'certFingerprint')) { @@ -307,7 +307,7 @@ class Crypto * We can't build a full certificate from a fingerprint, and may as well return an array with only the * fingerprint(s) immediately. */ - return array('certFingerprint' => $fps); + return ['certFingerprint' => $fps]; } // no public key/certificate available diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php index dc7a192898965673443ac8bb6899ae96febc6190..81203e9f48e112372a0b8d784323fd68a2b73574 100644 --- a/lib/SimpleSAML/Utils/HTTP.php +++ b/lib/SimpleSAML/Utils/HTTP.php @@ -40,7 +40,7 @@ class HTTP // encrypt the session ID and the random ID $info = base64_encode(Crypto::aesEncrypt($session_id.':'.$id)); - $url = Module::getModuleURL('core/postredirect.php', array('RedirInfo' => $info)); + $url = Module::getModuleURL('core/postredirect.php', ['RedirInfo' => $info]); return preg_replace('#^https:#', 'http:', $url); } @@ -146,7 +146,7 @@ class HTTP * @author Mads Freek Petersen * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no> */ - private static function redirect($url, $parameters = array()) + private static function redirect($url, $parameters = []) { if (!is_string($url) || empty($url) || !is_array($parameters)) { throw new \InvalidArgumentException('Invalid input parameters.'); @@ -220,10 +220,10 @@ class HTTP { // generate a random ID to avoid replay attacks $id = Random::generateID(); - $postData = array( + $postData = [ 'post' => $data, 'url' => $destination, - ); + ]; // save the post data to the session, tied to the random ID $session->setData('core_postdatalink', $id, $postData); @@ -253,13 +253,13 @@ class HTTP $queryStart = strpos($url, '?'); if ($queryStart === false) { - $oldQuery = array(); + $oldQuery = []; $url .= '?'; } else { /** @var string|false $oldQuery */ $oldQuery = substr($url, $queryStart + 1); if ($oldQuery === false) { - $oldQuery = array(); + $oldQuery = []; } else { $oldQuery = self::parseQueryString($oldQuery); } @@ -300,7 +300,7 @@ class HTTP $url = Module::getModuleURL('core/no_cookie.php'); if ($retryURL !== null) { - $url = self::addURLParameters($url, array('retryURL' => $retryURL)); + $url = self::addURLParameters($url, ['retryURL' => $retryURL]); } self::redirectTrustedURL($url); } @@ -333,7 +333,7 @@ class HTTP // get the white list of domains if ($trustedSites === null) { - $trustedSites = Configuration::getInstance()->getValue('trusted.url.domains', array()); + $trustedSites = Configuration::getInstance()->getValue('trusted.url.domains', []); } // validates the URL's host is among those allowed @@ -407,7 +407,7 @@ class HTTP * @author Olav Morken, UNINETT AS <olav.morken@uninett.no> * @author Marco Ferrante, University of Genova <marco@csita.unige.it> */ - public static function fetch($url, $context = array(), $getHeaders = false) + public static function fetch($url, $context = [], $getHeaders = false) { if (!is_string($url)) { throw new \InvalidArgumentException('Invalid input parameters.'); @@ -442,10 +442,10 @@ class HTTP // extract the hostname $hostname = parse_url($url, PHP_URL_HOST); if (!empty($hostname)) { - $context['ssl'] = array( + $context['ssl'] = [ 'SNI_server_name' => $hostname, 'SNI_enabled' => true, - ); + ]; } else { Logger::warning('Invalid URL format or local URL used through a proxy'); } @@ -463,10 +463,10 @@ class HTTP // data and headers if ($getHeaders) { if (isset($http_response_header)) { - $headers = array(); + $headers = []; foreach ($http_response_header as $h) { if (preg_match('@^HTTP/1\.[01]\s+\d{3}\s+@', $h)) { - $headers = array(); // reset + $headers = []; // reset $headers[0] = $h; continue; } @@ -479,7 +479,7 @@ class HTTP // no HTTP headers, probably a different protocol, e.g. file $headers = null; } - return array($data, $headers); + return [$data, $headers]; } return $data; @@ -501,12 +501,12 @@ class HTTP { if (!array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) { // no Accept-Language header, return an empty set - return array(); + return []; } $languages = explode(',', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])); - $ret = array(); + $ret = []; foreach ($languages as $l) { $opts = explode(';', $l); @@ -681,7 +681,7 @@ class HTTP // post the data directly $session = Session::getSessionFromRequest(); $id = self::savePOSTData($session, $destination, $data); - $url = Module::getModuleURL('core/postredirect.php', array('RedirId' => $id)); + $url = Module::getModuleURL('core/postredirect.php', ['RedirId' => $id]); } return $url; @@ -919,7 +919,7 @@ class HTTP throw new \InvalidArgumentException('Invalid input parameters.'); } - $res = array(); + $res = []; if (empty($query_string)) { return $res; } @@ -960,7 +960,7 @@ class HTTP * * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no> */ - public static function redirectTrustedURL($url, $parameters = array()) + public static function redirectTrustedURL($url, $parameters = []) { if (!is_string($url) || !is_array($parameters)) { throw new \InvalidArgumentException('Invalid input parameters.'); @@ -992,7 +992,7 @@ class HTTP * * @author Jaime Perez, UNINETT AS <jaime.perez@uninett.no> */ - public static function redirectUntrustedURL($url, $parameters = array()) + public static function redirectUntrustedURL($url, $parameters = []) { if (!is_string($url) || !is_array($parameters)) { throw new \InvalidArgumentException('Invalid input parameters.'); @@ -1115,7 +1115,7 @@ class HTTP throw new \InvalidArgumentException('Invalid input parameters.'); } - $default_params = array( + $default_params = [ 'lifetime' => 0, 'expire' => null, 'path' => '/', @@ -1123,7 +1123,7 @@ class HTTP 'secure' => false, 'httponly' => true, 'raw' => false, - ); + ]; if ($params !== null) { $params = array_merge($default_params, $params); diff --git a/lib/SimpleSAML/Utils/HttpAdapter.php b/lib/SimpleSAML/Utils/HttpAdapter.php index 71c611508ba17ea4351eb840a2bf7c95fa22ea4e..b82392076342830ed41121630c09ef287210a96e 100644 --- a/lib/SimpleSAML/Utils/HttpAdapter.php +++ b/lib/SimpleSAML/Utils/HttpAdapter.php @@ -52,7 +52,7 @@ class HttpAdapter /** * @see HTTP::fetch() */ - public function fetch($url, $context = array(), $getHeaders = false) + public function fetch($url, $context = [], $getHeaders = false) { return HTTP::fetch($url, $context, $getHeaders); } @@ -172,7 +172,7 @@ class HttpAdapter /** * @see HTTP::redirectTrustedURL() */ - public function redirectTrustedURL($url, $parameters = array()) + public function redirectTrustedURL($url, $parameters = []) { HTTP::redirectTrustedURL($url, $parameters); } @@ -180,7 +180,7 @@ class HttpAdapter /** * @see HTTP::redirectUntrustedURL() */ - public function redirectUntrustedURL($url, $parameters = array()) + public function redirectUntrustedURL($url, $parameters = []) { HTTP::redirectUntrustedURL($url, $parameters); } diff --git a/lib/SimpleSAML/Utils/Net.php b/lib/SimpleSAML/Utils/Net.php index 96526ad68349438dd947424d32624eb0e633dfd6..02619d2215f88f34ca19579bc744dd7bc982912f 100644 --- a/lib/SimpleSAML/Utils/Net.php +++ b/lib/SimpleSAML/Utils/Net.php @@ -35,8 +35,8 @@ class Net list ($net, $mask) = explode('/', $cidr); $mask = intval($mask); - $ip_ip = array(); - $ip_net = array(); + $ip_ip = []; + $ip_net = []; if (strstr($ip, ':') || strstr($net, ':')) { // Validate IPv6 with inet_pton, convert to hex with bin2hex // then store as a long with hexdec diff --git a/lib/SimpleSAML/Utils/XML.php b/lib/SimpleSAML/Utils/XML.php index 96be4c3de0b52ffe7cc4945be3afa44862913fc6..9b1f37766c0f24c75f8e654164f45b5bf151dfc7 100644 --- a/lib/SimpleSAML/Utils/XML.php +++ b/lib/SimpleSAML/Utils/XML.php @@ -34,7 +34,7 @@ class XML */ public static function checkSAMLMessage($message, $type) { - $allowed_types = array('saml20', 'saml11', 'saml-meta'); + $allowed_types = ['saml20', 'saml11', 'saml-meta']; if (!(is_string($message) && in_array($type, $allowed_types, true))) { throw new \InvalidArgumentException('Invalid input parameters.'); } @@ -45,7 +45,7 @@ class XML } // see if debugging is enabled for XML validation - $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', array('validatexml' => false)); + $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', ['validatexml' => false]); $enabled = \SimpleSAML\Configuration::getInstance()->getBoolean('debug.validatexml', false); if (!(in_array('validatexml', $debug, true) // implicitly enabled @@ -99,7 +99,7 @@ class XML } // see if debugging is enabled for SAML messages - $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', array('saml' => false)); + $debug = \SimpleSAML\Configuration::getInstance()->getArrayize('debug', ['saml' => false]); if (!(in_array('saml', $debug, true) // implicitly enabled || (array_key_exists('saml', $debug) && $debug['saml'] === true) @@ -163,8 +163,8 @@ class XML // check what this element contains $fullText = ''; // all text in this element - $textNodes = array(); // text nodes which should be deleted - $childNodes = array(); // other child nodes + $textNodes = []; // text nodes which should be deleted + $childNodes = []; // other child nodes for ($i = 0; $i < $root->childNodes->length; $i++) { /** @var \DOMElement $child */ $child = $root->childNodes->item($i); @@ -285,7 +285,7 @@ class XML throw new \InvalidArgumentException('Invalid input parameters.'); } - $ret = array(); + $ret = []; for ($i = 0; $i < $element->childNodes->length; $i++) { /** @var \DOMElement $child */ @@ -366,7 +366,7 @@ class XML // check if the namespace is a shortcut, and expand it if it is if ($nsURI[0] === '@') { // the defined shortcuts - $shortcuts = array( + $shortcuts = [ '@ds' => 'http://www.w3.org/2000/09/xmldsig#', '@md' => 'urn:oasis:names:tc:SAML:2.0:metadata', '@saml1' => 'urn:oasis:names:tc:SAML:1.0:assertion', @@ -375,7 +375,7 @@ class XML '@saml2' => 'urn:oasis:names:tc:SAML:2.0:assertion', '@saml2p' => 'urn:oasis:names:tc:SAML:2.0:protocol', '@shibmd' => 'urn:mace:shibboleth:metadata:1.0', - ); + ]; // check if it is a valid shortcut if (!array_key_exists($nsURI, $shortcuts)) { diff --git a/lib/SimpleSAML/XHTML/EMail.php b/lib/SimpleSAML/XHTML/EMail.php index 3e880f1a857e322af093d09874dcc162f057947d..a9e239029b44de780c892dbb55e7ef35bda688e2 100644 --- a/lib/SimpleSAML/XHTML/EMail.php +++ b/lib/SimpleSAML/XHTML/EMail.php @@ -17,7 +17,7 @@ class EMail private $from = null; private $replyto = null; private $subject = null; - private $headers = array(); + private $headers = []; /** diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php index 33faec23514e2b7a4115dc98e6496a4a9ef2f716..794e825430fef1ce3514e85cf1f4b0def117e642 100644 --- a/lib/SimpleSAML/XHTML/IdPDisco.php +++ b/lib/SimpleSAML/XHTML/IdPDisco.php @@ -94,7 +94,7 @@ class IdPDisco * * @var array */ - protected $scopedIDPList = array(); + protected $scopedIDPList = []; /** * The URL the user should be redirected to after choosing an IdP. @@ -214,13 +214,13 @@ class IdPDisco { $prefixedName = 'idpdisco_'.$this->instance.'_'.$name; - $params = array( + $params = [ // we save the cookies for 90 days 'lifetime' => (60 * 60 * 24 * 90), // the base path for cookies. This should be the installation directory for SimpleSAMLphp 'path' => $this->config->getBasePath(), 'httponly' => false, - ); + ]; \SimpleSAML\Utils\HTTP::setCookie($prefixedName, $value, $params, false); } @@ -290,7 +290,7 @@ class IdPDisco * back. Therefore we do some quick and dirty parsing of the query string. */ $qstr = $_SERVER['QUERY_STRING']; - $matches = array(); + $matches = []; if (preg_match('/(?:^|&)idp_([^=]+)=/', $qstr, $matches)) { return $this->validateIdP(urldecode($matches[1])); } @@ -459,7 +459,7 @@ class IdPDisco */ protected function getIdPList() { - $idpList = array(); + $idpList = []; foreach ($this->metadataSets as $metadataSet) { $newList = $this->metadata->getList($metadataSet); /* @@ -512,23 +512,23 @@ class IdPDisco */ protected function start() { - $idp = $this->getTargetIdp(); + $idp = $this->getTargetIdP(); if ($idp !== null) { $extDiscoveryStorage = $this->config->getString('idpdisco.extDiscoveryStorage', null); if ($extDiscoveryStorage !== null) { $this->log('Choice made ['.$idp.'] (Forwarding to external discovery storage)'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($extDiscoveryStorage, array( + \SimpleSAML\Utils\HTTP::redirectTrustedURL($extDiscoveryStorage, [ 'entityID' => $this->spEntityId, 'IdPentityID' => $idp, 'returnIDParam' => $this->returnIdParam, 'isPassive' => 'true', 'return' => $this->returnURL - )); + ]); } else { $this->log( 'Choice made ['.$idp.'] (Redirecting the user back. returnIDParam='.$this->returnIdParam.')' ); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($this->returnURL, array($this->returnIdParam => $idp)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($this->returnURL, [$this->returnIdParam => $idp]); } } @@ -567,7 +567,7 @@ class IdPDisco ); \SimpleSAML\Utils\HTTP::redirectTrustedURL( $this->returnURL, - array($this->returnIdParam => $idpintersection[0]) + [$this->returnIdParam => $idpintersection[0]] ); } @@ -587,7 +587,41 @@ class IdPDisco } $t = new Template($this->config, $templateFile, 'disco'); - $t->data['idplist'] = $idpList; + + $fallbackLanguage = 'en'; + $defaultLanguage = $this->config->getString('language.default', $fallbackLanguage); + $translator = $t->getTranslator(); + $language = $translator->getLanguage()->getLanguage(); + $tryLanguages = [0 => $language, 1 => $defaultLanguage, 2 => $fallbackLanguage]; + + $newlist = []; + foreach($idpList as $entityid => $data) { + $newlist[$entityid]['entityid'] = $entityid; + foreach ( $tryLanguages as $lang ) { + if ( $name = $this->getEntityDisplayName($data, $lang) ) { + $newlist[$entityid]['name'] = $name; + continue; + } + } + if ( empty($newlist[$entityid]['name']) ) { + $newlist[$entityid]['name'] = $entityid; + } + foreach ( $tryLanguages as $lang ) { + if ( !empty($data['description'][$lang]) ) { + $newlist[$entityid]['description'] = $data['description'][$lang]; + continue; + } + } + if ( !empty($data['icon']) ) { + $newlist[$entityid]['icon'] = $data['icon']; + $newlist[$entityid]['iconurl'] = \SimpleSAML\Utils\HTTP::resolveURL($data['icon']); + } + } + usort($newlist, function($idpentry1, $idpentry2) { + return strcasecmp($idpentry1['name'],$idpentry2['name']); + }); + + $t->data['idplist'] = $newlist; $t->data['preferredidp'] = $preferredIdP; $t->data['return'] = $this->returnURL; $t->data['returnIDParam'] = $this->returnIdParam; @@ -596,4 +630,16 @@ class IdPDisco $t->data['rememberenabled'] = $this->config->getBoolean('idpdisco.enableremember', false); $t->show(); } + + private function getEntityDisplayName(array $idpData, $language) + { + if(isset($idpData['UIInfo']['DisplayName'][$language]) ) { + return $idpData['UIInfo']['DisplayName'][$language]; + } elseif ( isset($idpData['name'][$language]) ) { + return $idpData['name'][$language]; + } elseif ( isset($idpData['OrganizationDisplayName'][$language]) ) { + return $idpData['OrganizationDisplayName'][$language]; + } + return null; + } } diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index b20cac5715a44c5472fedcc7468ff66cf19d22ac..3ae190b88a82062c04bbeaa839c5e7ee9ae25078 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -19,7 +19,7 @@ class Template * * @var array */ - public $data = array(); + public $data = []; /** * A translator instance configured to work with this template. @@ -155,7 +155,7 @@ class Template /** * Set up the places where twig can look for templates. * - * @return \Twig_Loader_Filesystem The twig template loader or false if the template does not exist. + * @return TemplateLoader The twig template loader or false if the template does not exist. * @throws \Twig_Error_Loader In case a failure occurs. */ private function setupTwigTemplatepaths() @@ -168,22 +168,22 @@ class Template $loader = new TemplateLoader(); $templateDirs = $this->findThemeTemplateDirs(); if ($this->module) { - $templateDirs[] = array($this->module => TemplateLoader::getModuleTemplateDir($this->module)); + $templateDirs[] = [$this->module => TemplateLoader::getModuleTemplateDir($this->module)]; } if ($this->theme['module']) { try { - $templateDirs[] = array( + $templateDirs[] = [ $this->theme['module'] => TemplateLoader::getModuleTemplateDir($this->theme['module']) - ); + ]; } catch (\InvalidArgumentException $e) { // either the module is not enabled or it has no "templates" directory, ignore } } // default, themeless templates are checked last - $templateDirs[] = array( + $templateDirs[] = [ \Twig_Loader_Filesystem::MAIN_NAMESPACE => $this->configuration->resolvePath('templates') - ); + ]; foreach ($templateDirs as $entry) { $loader->addPath($entry[key($entry)], key($entry)); } @@ -213,20 +213,20 @@ class Template $this->localization->addModuleDomain($this->theme['module']); } - $options = array( + $options = [ 'cache' => $cache, 'auto_reload' => $auto_reload, - 'translation_function' => array('\SimpleSAML\Locale\Translate', 'translateSingularNativeGettext'), - 'translation_function_plural' => array('\SimpleSAML\Locale\Translate', 'translatePluralNativeGettext'), - ); + 'translation_function' => ['\SimpleSAML\Locale\Translate', 'translateSingularNativeGettext'], + 'translation_function_plural' => ['\SimpleSAML\Locale\Translate', 'translatePluralNativeGettext'], + ]; // set up translation if ($this->localization->i18nBackend === \SimpleSAML\Locale\Localization::GETTEXT_I18N_BACKEND) { - $options['translation_function'] = array('\SimpleSAML\Locale\Translate', 'translateSingularGettext'); - $options['translation_function_plural'] = array( + $options['translation_function'] = ['\SimpleSAML\Locale\Translate', 'translateSingularGettext']; + $options['translation_function_plural'] = [ '\SimpleSAML\Locale\Translate', 'translatePluralGettext' - ); + ]; } // TODO: add a branch for the old SimpleSAMLphp backend $twig = new Twig_Environment($loader, $options); @@ -253,8 +253,8 @@ class Template $twig->addFilter( new \Twig_SimpleFilter( 'translateFromArray', - array('\SimpleSAML\Locale\Translate', 'translateFromArray'), - array('needs_context' => true) + ['\SimpleSAML\Locale\Translate', 'translateFromArray'], + ['needs_context' => true] ) ); @@ -274,7 +274,7 @@ class Template { if ($this->theme['module'] === null) { // no module involved - return array(); + return []; } // setup directories & namespaces @@ -284,10 +284,10 @@ class Template // no subdirectories in the theme directory, nothing to do here // this is probably wrong, log a message \SimpleSAML\Logger::warning('Empty theme directory for theme "'.$this->theme['name'].'".'); - return array(); + return []; } - $themeTemplateDirs = array(); + $themeTemplateDirs = []; foreach ($subdirs as $entry) { // discard anything that's not a directory. Expression is negated to profit from lazy evaluation if (!($entry !== '.' && $entry !== '..' && is_dir($themeDir.'/'.$entry))) { @@ -296,7 +296,7 @@ class Template // set correct name for the default namespace $ns = ($entry === 'default') ? \Twig_Loader_Filesystem::MAIN_NAMESPACE : $entry; - $themeTemplateDirs[] = array($ns => $themeDir.'/'.$entry); + $themeTemplateDirs[] = [$ns => $themeDir.'/'.$entry]; } return $themeTemplateDirs; } @@ -355,7 +355,7 @@ class Template $langmap = null; if (count($languages) > 1) { $parameterName = $this->getTranslator()->getLanguage()->getLanguageParameterName(); - $langmap = array(); + $langmap = []; foreach ($languages as $lang => $current) { $lang = strtolower($lang); $langname = $this->translator->getLanguage()->getLanguageLocalizedName($lang); @@ -363,13 +363,13 @@ class Template if (!$current) { $url = htmlspecialchars(\SimpleSAML\Utils\HTTP::addURLParameters( '', - array($parameterName => $lang) + [$parameterName => $lang] )); } - $langmap[$lang] = array( + $langmap[$lang] = [ 'name' => $langname, 'url' => $url, - ); + ]; } } return $langmap; @@ -434,7 +434,7 @@ class Template private function findModuleAndTemplateName($template) { $tmp = explode(':', $template, 2); - return (count($tmp) === 2) ? array($tmp[0], $tmp[1]) : array(null, $tmp[0]); + return (count($tmp) === 2) ? [$tmp[0], $tmp[1]] : [null, $tmp[0]]; } @@ -721,9 +721,9 @@ class Template */ public function t( $tag, - $replacements = array(), + $replacements = [], $fallbackdefault = true, - $oldreplacements = array(), + $oldreplacements = [], $striptags = false ) { return $this->translator->t($tag, $replacements, $fallbackdefault, $oldreplacements, $striptags); diff --git a/lib/SimpleSAML/XHTML/TemplateLoader.php b/lib/SimpleSAML/XHTML/TemplateLoader.php index 7c0ff97e902c4e6e971320c209db5627dbf4d1dc..c5090d5544612a05e68270e28eda74e57310b352 100644 --- a/lib/SimpleSAML/XHTML/TemplateLoader.php +++ b/lib/SimpleSAML/XHTML/TemplateLoader.php @@ -16,28 +16,36 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader * * @inheritdoc */ - protected function findTemplate($name) + protected function findTemplate($name, $throw = true) { - list($namespace, $shortname) = $this->parseName($name); + list($namespace, $shortname) = $this->parseModuleName($name); if (!in_array($namespace, $this->paths, true) && $namespace !== self::MAIN_NAMESPACE) { $this->addPath(self::getModuleTemplateDir($namespace), $namespace); } - return parent::findTemplate($name); + return parent::findTemplate($name, $throw); } - protected function parseName($name, $default = self::MAIN_NAMESPACE) + /** + * Parse the name of a template in a module. + * + * @param string $name The full name of the template, including namespace and template name / path. + * + * @return array An array with the corresponding namespace and name of the template. The namespace defaults to + * \Twig\Loader\FilesystemLoader::MAIN_NAMESPACE, if none was specified in $name. + */ + protected function parseModuleName($name, $default = self::MAIN_NAMESPACE) { if (strpos($name, ':')) { // we have our old SSP format list($namespace, $shortname) = explode(':', $name, 2); - $shortname = strtr($shortname, array( + $shortname = strtr($shortname, [ '.tpl.php' => '.twig', '.php' => '.twig', - )); - return array($namespace, $shortname); + ]); + return [$namespace, $shortname]; } - return parent::parseName($name, $default); + return [$default, $name]; } @@ -62,4 +70,3 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader return $templatedir; } } - diff --git a/lib/SimpleSAML/XML/Errors.php b/lib/SimpleSAML/XML/Errors.php index 351ca009ff1130158e48088cd31a6042a7202d4e..6f6d228ef34432187b2bcf481e66b1df82a3854f 100644 --- a/lib/SimpleSAML/XML/Errors.php +++ b/lib/SimpleSAML/XML/Errors.php @@ -19,7 +19,7 @@ class Errors /** * @var array This is an stack of error logs. The topmost element is the one we are currently working on. */ - private static $errorStack = array(); + private static $errorStack = []; /** * @var bool This is the xml error state we had before we began logging. @@ -66,7 +66,7 @@ class Errors } // Add a new level to the error stack - self::$errorStack[] = array(); + self::$errorStack[] = []; } @@ -81,7 +81,7 @@ class Errors // Check whether the error access functions are present if (!function_exists('libxml_use_internal_errors')) { // Pretend that no errors occurred - return array(); + return []; } // Add any errors which may have occurred diff --git a/lib/SimpleSAML/XML/Parser.php b/lib/SimpleSAML/XML/Parser.php index eaf530b643e9e46ebb2ced23471a0d148d1287a5..39287b2cb967edb1f4a0b7839a7860afb52f7cbb 100644 --- a/lib/SimpleSAML/XML/Parser.php +++ b/lib/SimpleSAML/XML/Parser.php @@ -52,8 +52,9 @@ class Parser $result = $this->simplexml->xpath($xpath); if (!is_array($result) || empty($result)) { if ($required) { - throw new \Exception('Could not get value from XML document'. - ' using the following XPath expression: '.$xpath); + throw new \Exception( + 'Could not get value from XML document using the following XPath expression: '.$xpath + ); } else { return null; } @@ -70,8 +71,9 @@ class Parser } } if ($required) { - throw new \Exception('Could not get value from XML document'. - ' using multiple alternative XPath expressions.'); + throw new \Exception( + 'Could not get value from XML document using multiple alternative XPath expressions.' + ); } else { return null; } diff --git a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php index 6c4fe7c7b8a710c7460a72fef0bfe74064fe7fdb..221951d9b777e5b71f8513890582afec4acc852d 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php @@ -41,7 +41,7 @@ class AuthnRequest $desturl = $idpmetadata->getDefaultEndpoint( 'SingleSignOnService', - array('urn:mace:shibboleth:1.0:profiles:AuthnRequest') + ['urn:mace:shibboleth:1.0:profiles:AuthnRequest'] ); $desturl = $desturl['Location']; diff --git a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php index 6c8b7e62ffa3d106ceea865a8b1e0828097d172d..8b6c1fb6e3686a77638c6ddc625f649000a27bab 100644 --- a/lib/SimpleSAML/XML/Shib13/AuthnResponse.php +++ b/lib/SimpleSAML/XML/Shib13/AuthnResponse.php @@ -91,7 +91,7 @@ class AuthnResponse } // Validate the signature - $this->validator = new Validator($this->dom, array('ResponseID', 'AssertionID')); + $this->validator = new Validator($this->dom, ['ResponseID', 'AssertionID']); // Get the issuer of the response $issuer = $this->getIssuer(); @@ -102,7 +102,7 @@ class AuthnResponse $publicKeys = $md->getPublicKeys('signing'); if (!empty($publicKeys)) { - $certFingerprints = array(); + $certFingerprints = []; foreach ($publicKeys as $key) { if ($key['type'] !== 'X509Certificate') { continue; @@ -119,8 +119,9 @@ class AuthnResponse // Validate against CA $this->validator->validateCA(Config::getCertPath($md->getString('caFile'))); } else { - throw new \SimpleSAML\Error\Exception('Missing certificate in Shibboleth 1.3'. - ' IdP Remote metadata for identity provider ['.$issuer.'].'); + throw new \SimpleSAML\Error\Exception( + 'Missing certificate in Shibboleth 1.3 IdP Remote metadata for identity provider ['.$issuer.'].' + ); } return true; @@ -203,14 +204,14 @@ class AuthnResponse public function getAttributes() { $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); - $md = $metadata->getMetadata($this->getIssuer(), 'shib13-idp-remote'); + $md = $metadata->getMetaData($this->getIssuer(), 'shib13-idp-remote'); $base64 = isset($md['base64attributes']) ? $md['base64attributes'] : false; if (!($this->dom instanceof \DOMDocument)) { - return array(); + return []; } - $attributes = array(); + $attributes = []; $assertions = $this->doXPathQuery('/shibp:Response/shib:Assertion'); @@ -254,7 +255,7 @@ class AuthnResponse } if (!array_key_exists($name, $attributes)) { - $attributes[$name] = array(); + $attributes[$name] = []; } if ($base64) { @@ -286,7 +287,7 @@ class AuthnResponse public function getNameID() { - $nameID = array(); + $nameID = []; $query = '/shibp:Response/shib:Assertion/shib:AuthenticationStatement/shib:Subject/shib:NameIdentifier'; $nodelist = $this->doXPathQuery($query); @@ -319,7 +320,7 @@ class AuthnResponse } elseif ($idp->hasValue('scopedattributes')) { $scopedAttributes = $idp->getArray('scopedattributes'); } else { - $scopedAttributes = array(); + $scopedAttributes = []; } $id = Random::generateID(); @@ -362,7 +363,7 @@ class AuthnResponse $encodedattributes .= $subjectNode; foreach ($attributes as $name => $value) { - $encodedattributes .= $this->enc_attribute($name, $value, $base64, $scopedAttributes); + $encodedattributes .= $this->encAttribute($name, $value, $base64, $scopedAttributes); } $encodedattributes .= '</AttributeStatement>'; @@ -409,7 +410,7 @@ class AuthnResponse * @param array $scopedAttributes Array of attributes names which are scoped. * @return string The attribute encoded as an XML-string. */ - private function enc_attribute($name, $values, $base64, $scopedAttributes) + private function encAttribute($name, $values, $base64, $scopedAttributes) { assert(is_string($name)); assert(is_array($values)); diff --git a/lib/SimpleSAML/XML/Signer.php b/lib/SimpleSAML/XML/Signer.php index ae79c8a1d7d7aec99c79abc731d5a1ce37a81de9..26f46ab62f3163f6a47896a6edafdf7b3c8e1e0b 100644 --- a/lib/SimpleSAML/XML/Signer.php +++ b/lib/SimpleSAML/XML/Signer.php @@ -39,7 +39,7 @@ class Signer /** * @var array Extra certificates which should be included in the response. */ - private $extraCertificates = array(); + private $extraCertificates = []; /** @@ -58,7 +58,7 @@ class Signer * * @param array $options Associative array with options for the constructor. Defaults to an empty array. */ - public function __construct($options = array()) + public function __construct($options = []) { assert(is_array($options)); @@ -84,7 +84,7 @@ class Signer } if (array_key_exists('id', $options)) { - $this->setIdAttribute($options['id']); + $this->setIDAttribute($options['id']); } } @@ -102,7 +102,7 @@ class Signer assert(is_array($privatekey)); assert(array_key_exists('PEM', $privatekey)); - $this->privateKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, array('type' => 'private')); + $this->privateKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, ['type' => 'private']); if (array_key_exists('password', $privatekey)) { $this->privateKey->passphrase = $privatekey['password']; } @@ -143,7 +143,7 @@ class Signer throw new \Exception('Unable to read private key file "'.$keyFile.'".'); } - $privatekey = array('PEM' => $keyData); + $privatekey = ['PEM' => $keyData]; if ($pass !== null) { $privatekey['password'] = $pass; } @@ -284,15 +284,15 @@ class Signer $objXMLSecDSig = new XMLSecurityDSig(); $objXMLSecDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); - $options = array(); + $options = []; if (!empty($this->idAttrName)) { $options['id_name'] = $this->idAttrName; } $objXMLSecDSig->addReferenceList( - array($node), + [$node], XMLSecurityDSig::SHA256, - array('http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N), + ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N], $options ); diff --git a/lib/SimpleSAML/XML/Validator.php b/lib/SimpleSAML/XML/Validator.php index bbf6acdf3622627aae696634796ddbede6505737..8dd46f8971c6c1bfd63fd17ed9f8e1db15428875 100644 --- a/lib/SimpleSAML/XML/Validator.php +++ b/lib/SimpleSAML/XML/Validator.php @@ -52,9 +52,9 @@ class Validator if ($publickey === null) { $publickey = false; } elseif (is_string($publickey)) { - $publickey = array( + $publickey = [ 'PEM' => $publickey, - ); + ]; } else { assert($publickey === false || is_array($publickey)); } @@ -249,7 +249,7 @@ class Validator } if (!is_array($fingerprints)) { - $fingerprints = array($fingerprints); + $fingerprints = [$fingerprints]; } // Normalize the fingerprints @@ -327,7 +327,7 @@ class Validator while (openssl_error_string() !== false) { } - $res = openssl_x509_checkpurpose($certificate, X509_PURPOSE_ANY, array($caFile)); + $res = openssl_x509_checkpurpose($certificate, X509_PURPOSE_ANY, [$caFile]); $errors = ''; // Log errors @@ -361,11 +361,11 @@ class Validator assert(is_string($certificate)); assert(is_string($caFile)); - $command = array( + $command = [ 'openssl', 'verify', '-CAfile', $caFile, '-purpose', 'any', - ); + ]; $cmdline = ''; foreach ($command as $c) { @@ -373,10 +373,10 @@ class Validator } $cmdline .= '2>&1'; - $descSpec = array( - 0 => array('pipe', 'r'), - 1 => array('pipe', 'w'), - ); + $descSpec = [ + 0 => ['pipe', 'r'], + 1 => ['pipe', 'w'], + ]; $process = proc_open($cmdline, $descSpec, $pipes); if (!is_resource($process)) { throw new \Exception('Failed to execute verification command: '.$cmdline); diff --git a/lib/_autoload_modules.php b/lib/_autoload_modules.php index 1df2e4acc80392574874f0e73d74d8337f90dc7c..41ca267a9eb9604a18c4e8817456e2383aaa11df 100644 --- a/lib/_autoload_modules.php +++ b/lib/_autoload_modules.php @@ -33,7 +33,7 @@ function temporaryLoader($class) $original = $class; // list of classes that have been renamed or moved - $renamed = array( + $renamed = [ 'SimpleSAML_Metadata_MetaDataStorageHandlerMDX' => 'SimpleSAML_Metadata_Sources_MDQ', 'SimpleSAML_Logger_LoggingHandlerSyslog' => 'SimpleSAML_Logger_SyslogLoggingHandler', 'SimpleSAML_Logger_LoggingHandlerErrorLog' => 'SimpleSAML_Logger_ErrorLogLoggingHandler', @@ -42,7 +42,7 @@ function temporaryLoader($class) 'SimpleSAML_IdP_LogoutHandler' => 'SimpleSAML_IdP_LogoutHandlerInterface', 'SimpleSAML_IdP_LogoutIFrame' => 'SimpleSAML_IdP_IFrameLogoutHandler', 'SimpleSAML_IdP_LogoutTraditional' => 'SimpleSAML_IdP_TraditionalLogoutHandler', - ); + ]; if (array_key_exists($class, $renamed)) { // the class has been renamed, try to load it and create an alias $class = $renamed[$class]; diff --git a/metadata-templates/adfs-idp-hosted.php b/metadata-templates/adfs-idp-hosted.php index 895dd23c43956dfd4cfb35f224939803a5388fc7..dd81340695659141227cedfe84a77bbf0dbb82d1 100644 --- a/metadata-templates/adfs-idp-hosted.php +++ b/metadata-templates/adfs-idp-hosted.php @@ -1,12 +1,12 @@ <?php -$metadata['__DYNAMIC:1__'] = array( +$metadata['__DYNAMIC:1__'] = [ 'host' => '__DEFAULT__', 'privatekey' => 'server.pem', 'certificate' => 'server.crt', 'auth' => 'example-userpass', - 'authproc' => array( + 'authproc' => [ // Convert LDAP names to WS-Fed Claims. - 100 => array('class' => 'core:AttributeMap', 'name2claim'), - ), -); + 100 => ['class' => 'core:AttributeMap', 'name2claim'], + ], +]; diff --git a/metadata-templates/adfs-sp-remote.php b/metadata-templates/adfs-sp-remote.php index c72f51442808cd2845543d0b1aa29056957900d2..ec2d79c9167c4fc39ba90a5d7f26d10a9cc30d38 100644 --- a/metadata-templates/adfs-sp-remote.php +++ b/metadata-templates/adfs-sp-remote.php @@ -1,12 +1,12 @@ <?php -$metadata['urn:federation:localhost'] = array( +$metadata['urn:federation:localhost'] = [ 'prp' => 'https://localhost/adfs/ls/', 'simplesaml.nameidattribute' => 'uid', - 'authproc' => array( - 50 => array( + 'authproc' => [ + 50 => [ 'class' => 'core:AttributeLimit', 'cn', 'mail', 'uid', 'eduPersonAffiliation', - ), - ), -); + ], + ], +]; diff --git a/metadata-templates/saml20-idp-hosted.php b/metadata-templates/saml20-idp-hosted.php index 431e6e9094d79fed769f2a47faf0f2c841cef464..582af8ee93dd43babb6155f9a990af4160166d77 100644 --- a/metadata-templates/saml20-idp-hosted.php +++ b/metadata-templates/saml20-idp-hosted.php @@ -5,7 +5,7 @@ * See: https://simplesamlphp.org/docs/stable/simplesamlphp-reference-idp-hosted */ -$metadata['__DYNAMIC:1__'] = array( +$metadata['__DYNAMIC:1__'] = [ /* * The hostname of the server (VHOST) that will use this SAML entity. * @@ -48,4 +48,4 @@ $metadata['__DYNAMIC:1__'] = array( ), ), */ -); +]; diff --git a/metadata-templates/saml20-sp-remote.php b/metadata-templates/saml20-sp-remote.php index c0f8b02bb5c233b7271482da50d180c187d245b2..92ff45da1ddb604dfca7f1f31951eb65cfdfefb8 100644 --- a/metadata-templates/saml20-sp-remote.php +++ b/metadata-templates/saml20-sp-remote.php @@ -8,10 +8,10 @@ /* * Example SimpleSAMLphp SAML 2.0 SP */ -$metadata['https://saml2sp.example.org'] = array( +$metadata['https://saml2sp.example.org'] = [ 'AssertionConsumerService' => 'https://saml2sp.example.org/simplesaml/module.php/saml/sp/saml2-acs.php/default-sp', 'SingleLogoutService' => 'https://saml2sp.example.org/simplesaml/module.php/saml/sp/saml2-logout.php/default-sp', -); +]; /* * This example shows an example config that works with G Suite (Google Apps) for education. @@ -19,14 +19,14 @@ $metadata['https://saml2sp.example.org'] = array( * at G Suite. In example, if your Google account is foo.com, and you have a user that has an email john@foo.com, then you * must set the simplesaml.nameidattribute to be the name of an attribute that for this user has the value of 'john'. */ -$metadata['google.com'] = array( +$metadata['google.com'] = [ 'AssertionConsumerService' => 'https://www.google.com/a/g.feide.no/acs', 'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress', 'simplesaml.nameidattribute' => 'uid', 'simplesaml.attributes' => false, -); +]; -$metadata['https://legacy.example.edu'] = array( +$metadata['https://legacy.example.edu'] = [ 'AssertionConsumerService' => 'https://legacy.example.edu/saml/acs', /* * Currently, SimpleSAMLphp defaults to the SHA-256 hashing algorithm. @@ -38,4 +38,4 @@ $metadata['https://legacy.example.edu'] = array( * http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf */ //'signature.algorithm' => 'http://www.w3.org/2000/09/xmldsig#rsa-sha1', -); +]; diff --git a/metadata-templates/shib13-idp-hosted.php b/metadata-templates/shib13-idp-hosted.php index 56b04828422233f8cf400254f915d0d88c1094a1..28ccc42b33fd334964f13c7289a54a6c9f26dcc0 100644 --- a/metadata-templates/shib13-idp-hosted.php +++ b/metadata-templates/shib13-idp-hosted.php @@ -5,7 +5,7 @@ * See: https://simplesamlphp.org/docs/stable/simplesamlphp-reference-idp-hosted */ -$metadata['__DYNAMIC:1__'] = array( +$metadata['__DYNAMIC:1__'] = [ /* * The hostname of the server (VHOST) that will use this SAML entity. * @@ -22,4 +22,4 @@ $metadata['__DYNAMIC:1__'] = array( * 'config/authsources.php'. */ 'auth' => 'example-userpass', -); +]; diff --git a/metadata-templates/shib13-sp-hosted.php b/metadata-templates/shib13-sp-hosted.php index 38536ceb0432bf30ee91a9bab7cb93635cf80852..e3581c9b864459d0927a6f2d5d7369ff53dadcd3 100644 --- a/metadata-templates/shib13-sp-hosted.php +++ b/metadata-templates/shib13-sp-hosted.php @@ -8,6 +8,6 @@ /* * Example of hosted Shibboleth 1.3 SP. */ -$metadata['__DYNAMIC:1__'] = array( +$metadata['__DYNAMIC:1__'] = [ 'host' => '__DEFAULT__', -); +]; diff --git a/metadata-templates/shib13-sp-remote.php b/metadata-templates/shib13-sp-remote.php index 73df2dae9ef191587bb45c968a44f4266b87441c..8d6a3247992f1810997f24b3efc6f89f86d7fe6e 100644 --- a/metadata-templates/shib13-sp-remote.php +++ b/metadata-templates/shib13-sp-remote.php @@ -8,9 +8,9 @@ /* * This is just an example: */ -$metadata['https://sp.shiblab.feide.no'] = array( +$metadata['https://sp.shiblab.feide.no'] = [ 'AssertionConsumerService' => 'http://sp.shiblab.feide.no/Shibboleth.sso/SAML/POST', 'audience' => 'urn:mace:feide:shiblab', 'base64attributes' => false, -); +]; diff --git a/metadata-templates/wsfed-idp-remote.php b/metadata-templates/wsfed-idp-remote.php index a6d20ef4adf4b4d2259f8c578e425dc53b8f8dbf..214679ce372f8325c64acc281c047c28055adb59 100644 --- a/metadata-templates/wsfed-idp-remote.php +++ b/metadata-templates/wsfed-idp-remote.php @@ -3,7 +3,7 @@ * WS-Federation remote IdP metadata for SimpleSAMLphp. */ -$metadata['urn:federation:pingfederate:localhost'] = array( +$metadata['urn:federation:pingfederate:localhost'] = [ 'prp' => 'https://localhost:9031/idp/prp.wsf', 'certificate' => 'pingfed-localhost.pem', -); +]; diff --git a/metadata-templates/wsfed-sp-hosted.php b/metadata-templates/wsfed-sp-hosted.php index 17e3e12527e30a2b1ddbc254c409927b4c6fe801..5ebdf21c197003673ea2fcf394cd43e9db10f8ad 100644 --- a/metadata-templates/wsfed-sp-hosted.php +++ b/metadata-templates/wsfed-sp-hosted.php @@ -6,6 +6,6 @@ * - host */ -$metadata['__DYNAMIC:1__'] = array( +$metadata['__DYNAMIC:1__'] = [ 'host' => '__DEFAULT__', -); +]; diff --git a/modules/adfs/lib/IdP/ADFS.php b/modules/adfs/lib/IdP/ADFS.php index 8187aff89c12ad28206e9d0a22f1cba0e49e66c5..691480b7bf5e20a8cc8568688b1be3b4218c315d 100644 --- a/modules/adfs/lib/IdP/ADFS.php +++ b/modules/adfs/lib/IdP/ADFS.php @@ -23,20 +23,20 @@ class ADFS throw new \SimpleSAML\Error\Error('PROCESSAUTHNREQUEST', $exception); } - $state = array( - 'Responder' => array('\SimpleSAML\Module\adfs\IdP\ADFS', 'sendResponse'), + $state = [ + 'Responder' => ['\SimpleSAML\Module\adfs\IdP\ADFS', 'sendResponse'], 'SPMetadata' => $spMetadata->toArray(), 'ForceAuthn' => false, 'isPassive' => false, 'adfs:wctx' => $requestid, 'adfs:wreply' => false - ); + ]; if (isset($query['wreply']) && !empty($query['wreply'])) { $state['adfs:wreply'] = \SimpleSAML\Utils\HTTP::checkURLAllowed($query['wreply']); } - $idp->handleAuthenticationRequest($state); + $idp->handleAuthenticationRequest($state); } private static function generateResponse($issuer, $target, $nameid, $attributes, $assertionLifetime) @@ -73,7 +73,10 @@ MSG; continue; } - list($namespace, $name) = \SimpleSAML\Utils\Attributes::getAttributeNamespace($name, 'http://schemas.xmlsoap.org/claims'); + list($namespace, $name) = \SimpleSAML\Utils\Attributes::getAttributeNamespace( + $name, + 'http://schemas.xmlsoap.org/claims' + ); foreach ($values as $value) { if ((!isset($value)) || ($value === '')) { continue; @@ -85,7 +88,6 @@ MSG; <saml:AttributeValue>$value</saml:AttributeValue> </saml:Attribute> MSG; - } } @@ -107,17 +109,18 @@ MSG; private static function signResponse($response, $key, $cert, $algo) { $objXMLSecDSig = new XMLSecurityDSig(); - $objXMLSecDSig->idKeys = array('AssertionID'); - $objXMLSecDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); + $objXMLSecDSig->idKeys = ['AssertionID']; + $objXMLSecDSig->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); $responsedom = \SAML2\DOMDocumentFactory::fromString(str_replace("\r", "", $response)); $firstassertionroot = $responsedom->getElementsByTagName('Assertion')->item(0); $objXMLSecDSig->addReferenceList( - array($firstassertionroot), XMLSecurityDSig::SHA256, - array('http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N), - array('id_name' => 'AssertionID') + [$firstassertionroot], + XMLSecurityDSig::SHA256, + ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', XMLSecurityDSig::EXC_C14N], + ['id_name' => 'AssertionID'] ); - $objKey = new XMLSecurityKey($algo, array('type' => 'private')); + $objKey = new XMLSecurityKey($algo, ['type' => 'private']); $objKey->loadKey($key, true); $objXMLSecDSig->sign($objKey); if ($cert) { @@ -125,37 +128,29 @@ MSG; $objXMLSecDSig->add509Cert($public_cert, true); } $newSig = $responsedom->importNode($objXMLSecDSig->sigNode, true); - $firstassertionroot->appendChild($newSig); + $firstassertionroot->appendChild($newSig); return $responsedom->saveXML(); } private static function postResponse($url, $wresult, $wctx) { - $wresult = htmlspecialchars($wresult); - $wctx = htmlspecialchars($wctx); - - $post = <<<MSG - <body onload="document.forms[0].submit()"> - <form method="post" action="$url"> - <input type="hidden" name="wa" value="wsignin1.0"> - <input type="hidden" name="wresult" value="$wresult"> - <input type="hidden" name="wctx" value="$wctx"> - <noscript> - <input type="submit" value="Continue"> - </noscript> - </form> - </body> -MSG; - - echo $post; - exit; + $config = \SimpleSAML\Configuration::getInstance(); + $t = new \SimpleSAML\XHTML\Template($config, 'adfs:postResponse.twig'); + $t->data['baseurlpath'] = \SimpleSAML\Module::getModuleURL('adfs'); + $t->data['url'] = $url; + $t->data['wresult'] = $wresult; + $t->data['wctx'] = $wctx; + $t->show(); } public static function sendResponse(array $state) { $spMetadata = $state["SPMetadata"]; $spEntityId = $spMetadata['entityid']; - $spMetadata = \SimpleSAML\Configuration::loadFromArray($spMetadata, '$metadata['.var_export($spEntityId, true).']'); + $spMetadata = \SimpleSAML\Configuration::loadFromArray( + $spMetadata, + '$metadata['.var_export($spEntityId, true).']' + ); $attributes = $state['Attributes']; @@ -169,15 +164,15 @@ MSG; $nameid = \SimpleSAML\Utils\Random::generateID(); } - $idp = \SimpleSAML\IdP::getByState($state); + $idp = \SimpleSAML\IdP::getByState($state); $idpMetadata = $idp->getConfig(); $idpEntityId = $idpMetadata->getString('entityid'); - $idp->addAssociation(array( + $idp->addAssociation([ 'id' => 'adfs:'.$spEntityId, 'Handler' => '\SimpleSAML\Module\adfs\IdP\ADFS', 'adfs:entityID' => $spEntityId, - )); + ]); $assertionLifetime = $spMetadata->getInteger('assertion.lifetime', null); if ($assertionLifetime === null) { @@ -204,7 +199,9 @@ MSG; { // NB:: we don't know from which SP the logout request came from $idpMetadata = $idp->getConfig(); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($idpMetadata->getValue('redirect-after-logout', \SimpleSAML\Utils\HTTP::getBaseURL())); + \SimpleSAML\Utils\HTTP::redirectTrustedURL( + $idpMetadata->getValue('redirect-after-logout', \SimpleSAML\Utils\HTTP::getBaseURL()) + ); } public static function receiveLogoutMessage(\SimpleSAML\IdP $idp) @@ -216,11 +213,11 @@ MSG; assert(false); } - $state = array( - 'Responder' => array('\SimpleSAML\Module\adfs\IdP\ADFS', 'sendLogoutResponse'), - ); + $state = [ + 'Responder' => ['\SimpleSAML\Module\adfs\IdP\ADFS', 'sendLogoutResponse'], + ]; $assocId = null; - // TODO: verify that this is really no problem for: + // TODO: verify that this is really no problem for: // a) SSP, because there's no caller SP. // b) ADFS SP because caller will be called back.. $idp->handleLogoutRequest($state, $assocId); @@ -231,7 +228,9 @@ MSG; { $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); $spMetadata = $metadata->getMetaDataConfig($association['adfs:entityID'], 'adfs-sp-remote'); - $returnTo = \SimpleSAML\Module::getModuleURL('adfs/idp/prp.php?assocId='.urlencode($association["id"]).'&relayState='.urlencode($relayState)); + $returnTo = \SimpleSAML\Module::getModuleURL( + 'adfs/idp/prp.php?assocId='.urlencode($association["id"]).'&relayState='.urlencode($relayState) + ); return $spMetadata->getValue('prp').'?wa=wsignoutcleanup1.0&wreply='.urlencode($returnTo); } } diff --git a/modules/adfs/lib/SAML2/XML/fed/SecurityTokenServiceType.php b/modules/adfs/lib/SAML2/XML/fed/SecurityTokenServiceType.php index 30f2f62d420b56d4bc3c96be92a6cfde699cf9a9..55a802d507f38bb9137129f8bd64ee9b5fa7b351 100644 --- a/modules/adfs/lib/SAML2/XML/fed/SecurityTokenServiceType.php +++ b/modules/adfs/lib/SAML2/XML/fed/SecurityTokenServiceType.php @@ -15,7 +15,7 @@ class SecurityTokenServiceType extends \SAML2\XML\md\RoleDescriptor * * @var array */ - public $protocolSupportEnumeration = array(FedConst::NS_FED); + public $protocolSupportEnumeration = [FedConst::NS_FED]; /** * The Location of Services. diff --git a/modules/adfs/templates/postResponse.twig b/modules/adfs/templates/postResponse.twig new file mode 100644 index 0000000000000000000000000000000000000000..857aa8d7ab6fcd28e21630ea84031a22452840a4 --- /dev/null +++ b/modules/adfs/templates/postResponse.twig @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> + <head> + <script src="{{ baseurlpath }}/assets/js/postResponse.js"></script> + </head> + <body> + <form method="post" action="{{ url }}"> + <input type="hidden" name="wa" value="wsignin1.0"> + <input type="hidden" name="wresult" value="{{ wresult|escape('html') }}"> + <input type="hidden" name="wctx" value="{{ wctx|escape('html') }}"> + <noscript> + <input type="submit" value="Continue"> + </noscript> + </form> + </body> +</html> diff --git a/modules/adfs/www/assets/js/postReponse.js b/modules/adfs/www/assets/js/postReponse.js new file mode 100644 index 0000000000000000000000000000000000000000..a813b92cbec83b7ac265163431ac1f0d7d5f00e3 --- /dev/null +++ b/modules/adfs/www/assets/js/postReponse.js @@ -0,0 +1,3 @@ +document.addEventListener('DOMContentLoaded', function () { + document.forms[0].submit(); +}); diff --git a/modules/adfs/www/idp/metadata.php b/modules/adfs/www/idp/metadata.php index 652da7e2f8eb6efaa36ba3c405203e6f7c52b0d5..473af96dc6e9bf81e910b3e0fd4370998798f6fb 100644 --- a/modules/adfs/www/idp/metadata.php +++ b/modules/adfs/www/idp/metadata.php @@ -18,18 +18,18 @@ try { $_GET['idpentityid'] : $metadata->getMetaDataCurrentEntityID('adfs-idp-hosted'); $idpmeta = $metadata->getMetaDataConfig($idpentityid, 'adfs-idp-hosted'); - $availableCerts = array(); + $availableCerts = []; - $keys = array(); + $keys = []; $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, false, 'new_'); if ($certInfo !== null) { $availableCerts['new_idp.crt'] = $certInfo; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => true, 'X509Certificate' => $certInfo['certData'], - ); + ]; $hasNewCert = true; } else { $hasNewCert = false; @@ -37,42 +37,42 @@ try { $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, true); $availableCerts['idp.crt'] = $certInfo; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => ($hasNewCert ? false : true), 'X509Certificate' => $certInfo['certData'], - ); + ]; if ($idpmeta->hasValue('https.certificate')) { $httpsCert = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, true, 'https.'); assert(isset($httpsCert['certData'])); $availableCerts['https.crt'] = $httpsCert; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => false, 'X509Certificate' => $httpsCert['certData'], - ); + ]; } $adfs_service_location = \SimpleSAML\Module::getModuleURL('adfs').'/idp/prp.php'; - $metaArray = array( + $metaArray = [ 'metadata-set' => 'adfs-idp-remote', 'entityid' => $idpentityid, - 'SingleSignOnService' => array( - 0 => array( + 'SingleSignOnService' => [ + 0 => [ 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, 'Location' => $adfs_service_location - ) - ), - 'SingleLogoutService' => array( - 0 => array( + ] + ], + 'SingleLogoutService' => [ + 0 => [ 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, 'Location' => $adfs_service_location - ) - ), - ); + ] + ], + ]; if (count($keys) === 1) { $metaArray['certData'] = $keys[0]['X509Certificate']; @@ -125,11 +125,11 @@ try { $metaBuilder->addOrganizationInfo($metaArray); $technicalContactEmail = $config->getString('technicalcontact_email', null); if ($technicalContactEmail && $technicalContactEmail !== 'na@example.org') { - $metaBuilder->addContact('technical', \SimpleSAML\Utils\Config\Metadata::getContact(array( + $metaBuilder->addContact('technical', \SimpleSAML\Utils\Config\Metadata::getContact([ 'emailAddress' => $technicalContactEmail, 'name' => $config->getString('technicalcontact_name', null), 'contactType' => 'technical', - ))); + ])); } $output_xhtml = array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml'; $metaxml = $metaBuilder->getEntityDescriptorText($output_xhtml); @@ -147,11 +147,17 @@ try { $t->data['clipboard.js'] = true; $t->data['available_certs'] = $availableCerts; - $certdata = array(); + $certdata = []; foreach (array_keys($availableCerts) as $availableCert) { $certdata[$availableCert]['name'] = $availableCert; - $certdata[$availableCert]['url'] = \SimpleSAML\Module::getModuleURL('saml/idp/certs.php').'/'.$availableCert; - $certdata[$availableCert]['comment'] = ($availableCerts[$availableCert]['certFingerprint'][0] === 'afe71c28ef740bc87425be13a2263d37971da1f9' ? 'This is the default certificate. Generate a new certificate if this is a production system.' : ''); + $certdata[$availableCert]['url'] = \SimpleSAML\Module::getModuleURL('saml/idp/certs.php'). + '/'.$availableCert; + + $certdata[$availableCert]['comment'] = ''; + if ($availableCerts[$availableCert]['certFingerprint'][0] === 'afe71c28ef740bc87425be13a2263d37971da1f9') { + $certdata[$availableCert]['comment'] = 'This is the default certificate.'. + ' Generate a new certificate if this is a production system.'; + } } $t->data['certdata'] = $certdata; $t->data['header'] = 'adfs-idp'; // TODO: Replace with headerString in 2.0 diff --git a/modules/adfs/www/idp/prp.php b/modules/adfs/www/idp/prp.php index da86ec88fcb96ef79effa02e3df81cca93d0ed97..03a973b11656b4d2a020e79d0a4834c9ab8a265d 100644 --- a/modules/adfs/www/idp/prp.php +++ b/modules/adfs/www/idp/prp.php @@ -16,7 +16,7 @@ $idp = \SimpleSAML\IdP::getById('adfs:'.$idpEntityId); if (isset($_GET['wa'])) { if ($_GET['wa'] === 'wsignout1.0') { \SimpleSAML\Module\adfs\IdP\ADFS::receiveLogoutMessage($idp); - } else if ($_GET['wa'] === 'wsignin1.0') { + } elseif ($_GET['wa'] === 'wsignin1.0') { \SimpleSAML\Module\adfs\IdP\ADFS::receiveAuthnRequest($idp); } assert(false); diff --git a/modules/authX509/lib/Auth/Process/ExpiryWarning.php b/modules/authX509/lib/Auth/Process/ExpiryWarning.php index a5286c7bfd0e60663e9d1e1c4e8661e85b89cea5..1b9c1ca8753b5dc95ae1bb3a6830245a400e45f7 100644 --- a/modules/authX509/lib/Auth/Process/ExpiryWarning.php +++ b/modules/authX509/lib/Auth/Process/ExpiryWarning.php @@ -93,7 +93,6 @@ class ExpiryWarning extends \SimpleSAML\Auth\ProcessingFilter // Save state and redirect $id = \SimpleSAML\Auth\State::saveState($state, 'warning:expire'); $url = \SimpleSAML\Module::getModuleURL('authX509/expirywarning.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } - } diff --git a/modules/authX509/lib/Auth/Source/X509userCert.php b/modules/authX509/lib/Auth/Source/X509userCert.php index 2771979b8f628a009c512616ce13b4888380f009..4605c0ee97e4b19e95909e81c2ab255ee7922254 100644 --- a/modules/authX509/lib/Auth/Source/X509userCert.php +++ b/modules/authX509/lib/Auth/Source/X509userCert.php @@ -14,13 +14,13 @@ class X509userCert extends \SimpleSAML\Auth\Source /** * x509 attributes to use from the certificate for searching the user in the LDAP directory. */ - private $x509attributes = array('UID' => 'uid'); + private $x509attributes = ['UID' => 'uid']; /** * LDAP attribute containing the user certificate. */ - private $ldapusercert = array('userCertificate;binary'); + private $ldapusercert = ['userCertificate;binary']; /** @@ -159,7 +159,7 @@ class X509userCert extends \SimpleSAML\Auth\Source } - $merged_ldapcerts = array(); + $merged_ldapcerts = []; foreach ($this->ldapusercert as $attr) { $merged_ldapcerts = array_merge($merged_ldapcerts, $ldap_certs[$attr]); } diff --git a/modules/authX509/templates/X509error.php b/modules/authX509/templates/X509error.php index 3eb08fd13ff8d353ad6a41c4a9ada97f9ddb7c47..b7f8d42802a9a48e5923fd52e0d577909e409dd2 100644 --- a/modules/authX509/templates/X509error.php +++ b/modules/authX509/templates/X509error.php @@ -3,27 +3,24 @@ $this->data['header'] = $this->t('{authX509:X509error:certificate_header}'); $this->includeAtTemplateBase('includes/header.php'); -?> - -<?php if ($this->data['errorcode'] !== null) { ?> - <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px" alt="" /> - <h2><?php echo $this->t('{login:error_header}'); ?></h2> - <p><b><?php echo $this->t($this->data['errorcodes']['title'][$this->data['errorcode']]); ?></b></p> - <p><?php echo $this->t($this->data['errorcodes']['descr'][$this->data['errorcode']]); ?></p> - </div> + <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px" alt="" /> + <h2><?php echo $this->t('{login:error_header}'); ?></h2> + <p><b><?php echo $this->t($this->data['errorcodes']['title'][$this->data['errorcode']]); ?></b></p> + <p><?php echo $this->t($this->data['errorcodes']['descr'][$this->data['errorcode']]); ?></p> + </div> <?php } ?> - <h2 style="break: both"><?php echo $this->t('{authX509:X509error:certificate_header}'); ?></h2> + <h2 style="break: both"><?php echo $this->t('{authX509:X509error:certificate_header}'); ?></h2> - <p><?php echo $this->t('{authX509:X509error:certificate_text}'); ?></p> + <p><?php echo $this->t('{authX509:X509error:certificate_text}'); ?></p> - <a href="<?php echo htmlspecialchars(\SimpleSAML\Utils\HTTP::getSelfURL()); ?>"> - <?php echo $this->t('{login:login_button}'); ?> - </a> + <a href="<?php echo htmlspecialchars(\SimpleSAML\Utils\HTTP::getSelfURL()); ?>"> + <?php echo $this->t('{login:login_button}'); ?> + </a> <?php if (!empty($this->data['links'])) { diff --git a/modules/authX509/templates/X509error.twig b/modules/authX509/templates/X509error.twig index c350ea53f1692b86911f6b9fa5a9ea3da0f5257a..becaebdb722c7d0067293661a350520a77df917a 100644 --- a/modules/authX509/templates/X509error.twig +++ b/modules/authX509/templates/X509error.twig @@ -4,8 +4,8 @@ {% if errorcode -%} <h2>{% trans 'Error' %}</h2> - <h3>{% trans errortitle %}</h3> - <p>{% trans errordescr %}</p> +<h3>{% trans errortitle %}</h3> +<p>{% trans errordescr %}</p> {% endif -%} <h2>{% trans 'X509 certificate authentication' %}</h2> diff --git a/modules/authX509/templates/X509warning.php b/modules/authX509/templates/X509warning.php index dfe69cbbec7e3aa9af856eb03dccfa950eb3e0c1..a25385ec9a97772712c0d962d28ba87f82089ee6 100644 --- a/modules/authX509/templates/X509warning.php +++ b/modules/authX509/templates/X509warning.php @@ -10,14 +10,14 @@ * @package SimpleSAMLphp */ -$warning = $this->t('{authX509:X509warning:warning}', array( +$warning = $this->t('{authX509:X509warning:warning}', [ '%daysleft%' => htmlspecialchars($this->data['daysleft']), -)); +]); if ($this->data['renewurl']) { - $warning .= " ".$this->t('{authX509:X509warning:renew_url}', array( + $warning .= " ".$this->t('{authX509:X509warning:renew_url}', [ '%renewurl%' => $this->data['renewurl'], - )); + ]); } else { $warning .= " ".$this->t('{authX509:X509warning:renew}'); } @@ -32,10 +32,10 @@ $this->includeAtTemplateBase('includes/header.php'); <form style="display: inline; margin: 0px; padding: 0px" action="<?php echo htmlspecialchars($this->data['target']); ?>"> <?php - // Embed hidden fields... - foreach ($this->data['data'] as $name => $value) { - echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; - } + // Embed hidden fields... + foreach ($this->data['data'] as $name => $value) { + echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; + } ?> <p><?php echo $warning; ?></p> diff --git a/modules/authX509/templates/X509warning.twig b/modules/authX509/templates/X509warning.twig index 59a65f64f0f30f533aaaa64864fcc6d4047cfcaa..b75f7c370fd773ef4c52aa0a26114e7f5cb8893d 100644 --- a/modules/authX509/templates/X509warning.twig +++ b/modules/authX509/templates/X509warning.twig @@ -1,5 +1,3 @@ -{% set autofocus = 'proceedbutton' %} - {% extends "base.twig" %} {% block content %} @@ -8,7 +6,7 @@ <form action="{{ target | escape }}"> {% for name, value in data -%} - <input type="hidden" name="{{ name }}" value="{{ value }}" /> + <input type="hidden" name="{{ name }}" value="{{ value }}"> {%- endfor %} <p>{% trans %}Your certificate will expire in {{ daysleft }} days.{% endtrans %}</p> @@ -19,7 +17,7 @@ <p>{% trans 'Please renew your certificate in time.' %}</p> {% endif -%} - <p><input type="submit" name="proceed" id="proceedbutton" value="{% trans 'Proceed' %}" /></p> + <p><input type="submit" name="proceed" id="proceedbutton" value="{% trans 'Proceed' %}" autofocus></p> </form> diff --git a/modules/authX509/www/expirywarning.php b/modules/authX509/www/expirywarning.php index b5b445ca186e634a5654dfdd6bed6d39afabce7e..7bd36030d44a399fb59d510220078311d564d0a3 100644 --- a/modules/authX509/www/expirywarning.php +++ b/modules/authX509/www/expirywarning.php @@ -24,7 +24,7 @@ $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'authX509:X509warning.php'); $t->data['target'] = \SimpleSAML\Module::getModuleURL('authX509/expirywarning.php'); -$t->data['data'] = array('StateId' => $id); +$t->data['data'] = ['StateId' => $id]; $t->data['daysleft'] = $state['daysleft']; $t->data['renewurl'] = $state['renewurl']; $t->data['errorcodes'] = \SimpleSAML\Error\ErrorCodes::getAllErrorCodeMessages(); diff --git a/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php b/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php index 3a1c3175b126ffe392245a4105c16a12d7b0699d..42ef300f39b3c68bdbb23e1a1ae7a89620e707ef 100644 --- a/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php +++ b/modules/authYubiKey/lib/Auth/Process/OTP2YubiPrefix.php @@ -37,7 +37,7 @@ namespace SimpleSAML\Module\authYubiKey\Auth\Process; * * You use it by adding it as an authentication filter in config.php: * - * 'authproc.idp' => array( + * 'authproc.idp' => array( * ... * 90 => 'authYubiKey:OTP2YubiPrefix', * ... @@ -67,9 +67,11 @@ class OTP2YubiPrefix extends \SimpleSAML\Auth\ProcessingFilter $token_size = 32; $identity = substr($otp, 0, strlen($otp) - $token_size); - $attributes['yubiPrefix'] = array($identity); + $attributes['yubiPrefix'] = [$identity]; - \SimpleSAML\Logger::info('OTP2YubiPrefix: otp: '.$otp.' identity: '.$identity.' (otp keys: '.implode(',', array_keys($otps)).')'); + \SimpleSAML\Logger::info( + 'OTP2YubiPrefix: otp: '.$otp.' identity: '.$identity.' (otp keys: '.implode(',', array_keys($otps)).')' + ); unset($attributes['otp']); diff --git a/modules/authYubiKey/lib/Auth/Source/YubiKey.php b/modules/authYubiKey/lib/Auth/Source/YubiKey.php index b4377847369e6f3c06b3c9711f631b935b5f7919..65ddf84906d3de16f15fc0f04efc73100fe2cb0e 100644 --- a/modules/authYubiKey/lib/Auth/Source/YubiKey.php +++ b/modules/authYubiKey/lib/Auth/Source/YubiKey.php @@ -27,14 +27,14 @@ namespace SimpleSAML\Module\authYubiKey\Auth\Source; /** * YubiKey authentication module, see http://www.yubico.com/developers/intro/ - * * + * * Configure it by adding an entry to config/authsources.php such as this: * - * 'yubikey' => array( - * 'authYubiKey:YubiKey', - * 'id' => 997, - * 'key' => 'b64hmackey', - * ), + * 'yubikey' => array( + * 'authYubiKey:YubiKey', + * 'id' => 997, + * 'key' => 'b64hmackey', + * ), * * To generate your own client id/key you will need one YubiKey, and then * go to http://yubico.com/developers/api/ @@ -107,7 +107,7 @@ class YubiKey extends \SimpleSAML\Auth\Source $id = \SimpleSAML\Auth\State::saveState($state, self::STAGEID); $url = \SimpleSAML\Module::getModuleURL('authYubiKey/yubikeylogin.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('AuthState' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['AuthState' => $id]); } @@ -121,7 +121,7 @@ class YubiKey extends \SimpleSAML\Auth\Source * * @param string $authStateId The identifier of the authentication state. * @param string $otp The one time password entered- - * @return string Error code in the case of an error. + * @return string|null Error code in the case of an error. */ public static function handleLogin($authStateId, $otp) { @@ -158,6 +158,8 @@ class YubiKey extends \SimpleSAML\Auth\Source $state['Attributes'] = $attributes; \SimpleSAML\Auth\Source::completeAuth($state); + + return null; } /** @@ -191,13 +193,17 @@ class YubiKey extends \SimpleSAML\Auth\Source $yubi = new \Auth_Yubico($this->yubi_id, $this->yubi_key); $yubi->verify($otp); $uid = self::getYubiKeyPrefix($otp); - $attributes = array('uid' => array($uid)); + $attributes = ['uid' => [$uid]]; } catch (\Exception $e) { - \SimpleSAML\Logger::info('YubiKey:'.$this->authId.': Validation error (otp '.$otp.'), debug output: '.$yubi->getLastResponse()); + \SimpleSAML\Logger::info( + 'YubiKey:'.$this->authId.': Validation error (otp '.$otp.'), debug output: '.$yubi->getLastResponse() + ); throw new \SimpleSAML\Error\Error('WRONGUSERPASS', $e); } - \SimpleSAML\Logger::info('YubiKey:'.$this->authId.': YubiKey otp '.$otp.' validated successfully: '.$yubi->getLastResponse()); + \SimpleSAML\Logger::info( + 'YubiKey:'.$this->authId.': YubiKey otp '.$otp.' validated successfully: '.$yubi->getLastResponse() + ); return $attributes; } } diff --git a/modules/authYubiKey/libextinc/Yubico.php b/modules/authYubiKey/libextinc/Yubico.php index 12d2d8b4de0d167ecc5c584d07ea5029391930c3..d6f4c709aafe84ea19f5ff1a6724a8b322d49c59 100644 --- a/modules/authYubiKey/libextinc/Yubico.php +++ b/modules/authYubiKey/libextinc/Yubico.php @@ -66,19 +66,19 @@ class Auth_Yubico * Yubico client ID * @var string */ - private $_id; + private $id; /** * Yubico client key * @var string */ - private $_key; + private $key; /** * Response from server * @var string */ - private $_response; + private $response; /** * Constructor @@ -90,19 +90,19 @@ class Auth_Yubico */ public function __construct($id, $key = '') { - $this->_id = $id; - $this->_key = base64_decode($key); + $this->id = $id; + $this->key = base64_decode($key); } /** * Return the last data received from the server, if any. * - * @return string Output from server. + * @return string Output from server. * @access public */ public function getLastResponse() { - return $this->_response; + return $this->response; } // TODO? Add functions to get parsed parts of server response? @@ -116,10 +116,10 @@ class Auth_Yubico */ public function verify($token) { - $parameters = "id=".$this->_id."&otp=".$token; + $parameters = "id=".$this->id."&otp=".$token; // Generate signature - if ($this->_key <> "") { - $signature = base64_encode(hash_hmac('sha1', $parameters, $this->_key, true)); + if ($this->key <> "") { + $signature = base64_encode(hash_hmac('sha1', $parameters, $this->key, true)); $parameters .= '&h='.$signature; } // Support https @@ -134,9 +134,9 @@ class Auth_Yubico $status = $out[1]; // Verify signature - if ($this->_key <> "") { + if ($this->key <> "") { $rows = explode("\r\n", $responseMsg); - $response = array(); + $response = []; foreach ($rows as $val) { // = is also used in BASE64 encoding so we only replace the first = by # which is not used in BASE64 $val = preg_replace('/=/', '#', $val, 1); @@ -145,7 +145,7 @@ class Auth_Yubico } $check = 'status='.$response['status'].'&t='.$response['t']; - $checksignature = base64_encode(hash_hmac('sha1', $check, $this->_key, true)); + $checksignature = base64_encode(hash_hmac('sha1', $check, $this->key, true)); if ($response['h'] != $checksignature) { throw new Exception('Checked Signature failed'); diff --git a/modules/authYubiKey/templates/yubikeylogin.php b/modules/authYubiKey/templates/yubikeylogin.php index 104941b7976fab1f01367f935c0546d97b797643..693e4c374c60eda7fa69608daef796e1a0f19927 100644 --- a/modules/authYubiKey/templates/yubikeylogin.php +++ b/modules/authYubiKey/templates/yubikeylogin.php @@ -2,44 +2,34 @@ $this->includeAtTemplateBase('includes/header.php'); -?> - -<?php if ($this->data['errorCode'] !== null) { ?> - <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px" alt="" /> - <h2><?php echo $this->t('{login:error_header}'); ?></h2> - <p><b><?php echo $this->t($this->data['errorcodes']['title'][$this->data['errorcode']]); ?></b></p> - <p><?php echo $this->t($this->data['errorcodes']['descr'][$this->data['errorcode']]); ?></p> - </div> + <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px" alt="" /> + <h2><?php echo $this->t('{login:error_header}'); ?></h2> + <p><b><?php echo $this->t($this->data['errorcodes']['title'][$this->data['errorcode']]); ?></b></p> + <p><?php echo $this->t($this->data['errorcodes']['descr'][$this->data['errorcode']]); ?></p> + </div> <?php } ?> + <img style="float: right" src="<?php echo($this->data['logoUrl']); ?>" alt="" /> + <img style="clear: right; float: right" src="<?php echo($this->data['devicepicUrl']); ?>" alt="YubiKey" /> - <img style="float: right" src="<?php echo($this->data['logoUrl']); ?>" alt="" /> - <img style="clear: right; float: right" src="<?php echo($this->data['devicepicUrl']); ?>" alt="YubiKey" /> - - - <h2 style=""><?php echo $this->data['header']; ?></h2> - - <form action="?" method="post" name="f"> - - <p><?php echo $this->t('{authYubiKey:yubikey:intro}'); ?></p> - - <p><input id="otp" style="border: 1px solid #ccc; background: #eee; padding: .5em; font-size: medium; width: 70%; color: #aaa" type="text" tabindex="2" name="otp" /></p> + <h2 style=""><?php echo $this->data['header']; ?></h2> + <form action="?" method="post" name="f"> + <p><?php echo $this->t('{authYubiKey:yubikey:intro}'); ?></p> + <p><input id="otp" style="border: 1px solid #ccc; background: #eee; padding: .5em; font-size: medium; width: 70%; color: #aaa" type="text" tabindex="2" name="otp" /></p> <?php foreach ($this->data['stateParams'] as $name => $value) { echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; } ?> - - </form> - + </form> <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/authYubiKey/templates/yubikeylogin.twig b/modules/authYubiKey/templates/yubikeylogin.twig index 8c01c4cddc2ccf7dbd140827b25c881ea55713bc..e01432c0103afe8eb9b5ab9e94de38f97e366f51 100644 --- a/modules/authYubiKey/templates/yubikeylogin.twig +++ b/modules/authYubiKey/templates/yubikeylogin.twig @@ -2,7 +2,7 @@ {% extends "base.twig" %} {% block preload %} - <link rel="stylesheet" type="text/css" href="{{ baseurlpath }}assets/css/yubikey.css" /> + <link rel="stylesheet" type="text/css" href="{{ baseurlpath }}assets/css/yubikey.css"> {% endblock %} {% block postload %} @@ -19,15 +19,15 @@ </div> {% endif %} - <img style="float: right" src="{{ logoUrl }}" alt="" /> - <img style="clear: right; float: right" src="{{ devicepicUrl }}" alt="YubiKey" /> + <img style="float: right" src="{{ logoUrl }}" alt=""> + <img style="clear: right; float: right" src="{{ devicepicUrl }}" alt="YubiKey"> <h2>{{ '{authYubiKey:yubikey:header}'|trans }}</h2> <form action="?" method="post" name="f"> <p>{{ '{authYubiKey:yubikey:intro}'|trans }}</p> - <p><input id="otp" type="text" tabindex="2" name="otp" /></p> + <p><input id="otp" type="text" tabindex="2" name="otp" autofocus></p> {% for key, value in stateParams %} - <input type="hidden" name="{{ key|escape('html') }}" value="{{ value|escape('html') }}"/> + <input type="hidden" name="{{ key|escape('html') }}" value="{{ value|escape('html') }}"> {% endfor %} </form> {% endblock %} diff --git a/modules/authYubiKey/www/yubikeylogin.php b/modules/authYubiKey/www/yubikeylogin.php index 3c432ff8adb94302e482aebecfef55b745bdc206..c484282515376306d2f2ea7b28cd52c3fed4d0c1 100644 --- a/modules/authYubiKey/www/yubikeylogin.php +++ b/modules/authYubiKey/www/yubikeylogin.php @@ -30,7 +30,7 @@ if (array_key_exists('otp', $_REQUEST)) { $t->data['header'] = $translator->t('{authYubiKey:yubikey:header}'); $t->data['autofocus'] = 'otp'; $t->data['errorCode'] = $errorCode; -$t->data['stateParams'] = array('AuthState' => $authStateId); +$t->data['stateParams'] = ['AuthState' => $authStateId]; $t->data['logoUrl'] = \SimpleSAML\Module::getModuleURL('authYubiKey/resources/logo.jpg'); $t->data['devicepicUrl'] = \SimpleSAML\Module::getModuleURL('authYubiKey/resources/yubikey.jpg'); $t->show(); diff --git a/modules/authcrypt/lib/Auth/Source/Hash.php b/modules/authcrypt/lib/Auth/Source/Hash.php index bcca962cefb0746f5ea6995efc9c716fc951675e..aa17adcf68849033f114df0bf76b02e24295d6b0 100644 --- a/modules/authcrypt/lib/Auth/Source/Hash.php +++ b/modules/authcrypt/lib/Auth/Source/Hash.php @@ -37,7 +37,7 @@ class Hash extends \SimpleSAML\Module\core\Auth\UserPassBase // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $this->users = array(); + $this->users = []; // Validate and parse our configuration foreach ($config as $userpass => $attributes) { diff --git a/modules/authcrypt/lib/Auth/Source/Htpasswd.php b/modules/authcrypt/lib/Auth/Source/Htpasswd.php index 86fcc0b159d52086317da273b6cce966a6c3fe63..03084b08b1a9628d3cd301e1d57ab219a5cb9933 100644 --- a/modules/authcrypt/lib/Auth/Source/Htpasswd.php +++ b/modules/authcrypt/lib/Auth/Source/Htpasswd.php @@ -25,7 +25,7 @@ class Htpasswd extends \SimpleSAML\Module\core\Auth\UserPassBase * * @var array */ - private $attributes = array(); + private $attributes = []; /** @@ -44,7 +44,7 @@ class Htpasswd extends \SimpleSAML\Module\core\Auth\UserPassBase // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $this->users = array(); + $this->users = []; if (!$htpasswd = file_get_contents($config['htpasswd_file'])) { throw new \Exception('Could not read '.$config['htpasswd_file']); @@ -88,7 +88,7 @@ class Htpasswd extends \SimpleSAML\Module\core\Auth\UserPassBase $crypted = $matches[1]; // This is about the only attribute we can add - $attributes = array_merge(array('uid' => array($username)), $this->attributes); + $attributes = array_merge(['uid' => [$username]], $this->attributes); // Traditional crypt(3) if (\SimpleSAML\Utils\Crypto::secureCompare($crypted, crypt($password, $crypted))) { diff --git a/modules/authfacebook/extlibinc/base_facebook.php b/modules/authfacebook/extlibinc/base_facebook.php index 09e2c2a10b714de4abeb3a60e03dcf16be318861..ea661c7a9a28f64f543335f576c5ea447ed58212 100644 --- a/modules/authfacebook/extlibinc/base_facebook.php +++ b/modules/authfacebook/extlibinc/base_facebook.php @@ -48,10 +48,10 @@ class FacebookApiException extends Exception if (isset($result['error_description'])) { // OAuth 2.0 Draft 10 style $msg = $result['error_description']; - } else if (isset($result['error']) && is_array($result['error'])) { + } elseif (isset($result['error']) && is_array($result['error'])) { // OAuth 2.0 Draft 00 style $msg = $result['error']['message']; - } else if (isset($result['error_msg'])) { + } elseif (isset($result['error_msg'])) { // Rest server style $msg = $result['error_msg']; } else { @@ -84,7 +84,7 @@ class FacebookApiException extends Exception if (is_string($error)) { // OAuth 2.0 Draft 10 style return $error; - } else if (is_array($error)) { + } elseif (is_array($error)) { // OAuth 2.0 Draft 00 style if (isset($error['type'])) { return $error['type']; @@ -134,24 +134,24 @@ abstract class BaseFacebook /** * Default options for curl. */ - public static $CURL_OPTS = array( + public static $CURL_OPTS = [ CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, CURLOPT_USERAGENT => 'facebook-php-3.2', - ); + ]; /** * Maps aliases to Facebook domains. */ - public static $DOMAIN_MAP = array( + public static $DOMAIN_MAP = [ 'api' => 'https://api.facebook.com/', 'api_video' => 'https://api-video.facebook.com/', 'api_read' => 'https://api-read.facebook.com/', 'graph' => 'https://graph.facebook.com/', 'graph_video' => 'https://graph-video.facebook.com/', 'www' => 'https://www.facebook.com/', - ); + ]; /** * The Application ID. @@ -352,6 +352,8 @@ abstract class BaseFacebook * Extend an access token, while removing the short-lived token that might * have been generated via client-side flow. Thanks to http://bit.ly/b0Pt0H * for the workaround. + * + * @return boolean Return true is the access token is set. */ public function setExtendedAccessToken() { @@ -359,13 +361,13 @@ abstract class BaseFacebook // need to circumvent json_decode by calling _oauthRequest // directly, since response isn't JSON format $access_token_response = $this->_oauthRequest( - $this->getUrl('graph', '/oauth/access_token'), - $params = array( + $this->getUrl('graph', '/oauth/access_token'), + $params = [ 'client_id' => $this->getAppId(), 'client_secret' => $this->getAppSecret(), 'grant_type' => 'fb_exchange_token', 'fb_exchange_token' => $this->getAccessToken(), - ) + ] ); } catch (FacebookApiException $e) { // most likely that user very recently revoked authorization @@ -377,7 +379,7 @@ abstract class BaseFacebook return false; } - $response_params = array(); + $response_params = []; parse_str($access_token_response, $response_params); if (!isset($response_params['access_token'])) { @@ -387,8 +389,10 @@ abstract class BaseFacebook $this->destroySession(); $this->setPersistentData( - 'access_token', $response_params['access_token'] + 'access_token', + $response_params['access_token'] ); + return true; } /** @@ -491,17 +495,19 @@ abstract class BaseFacebook * Retrieve the signed request, either from a request parameter or, * if not present, from a cookie. * - * @return string the signed request, if available, or null otherwise. + * @return array the signed request, if available, or null otherwise. */ public function getSignedRequest() { if (!$this->signedRequest) { if (!empty($_REQUEST['signed_request'])) { $this->signedRequest = $this->parseSignedRequest( - $_REQUEST['signed_request']); - } else if (!empty($_COOKIE[$this->getSignedRequestCookieName()])) { + $_REQUEST['signed_request'] + ); + } elseif (!empty($_COOKIE[$this->getSignedRequestCookieName()])) { $this->signedRequest = $this->parseSignedRequest( - $_COOKIE[$this->getSignedRequestCookieName()]); + $_COOKIE[$this->getSignedRequestCookieName()] + ); } } return $this->signedRequest; @@ -586,7 +592,7 @@ abstract class BaseFacebook * @param array $params Provide custom parameters * @return string The URL for the login flow */ - public function getLoginUrl($params = array()) + public function getLoginUrl($params = []) { $this->establishCSRFTokenState(); $currentUrl = $this->getCurrentUrl(); @@ -600,11 +606,15 @@ abstract class BaseFacebook return $this->getUrl( 'www', 'dialog/oauth', - array_merge(array( + array_merge( + [ 'client_id' => $this->getAppId(), 'redirect_uri' => $currentUrl, // possibly overwritten - 'state' => $this->state), - $params)); + 'state' => $this->state + ], + $params + ) + ); } /** @@ -616,15 +626,15 @@ abstract class BaseFacebook * @param array $params Provide custom parameters * @return string The URL for the logout flow */ - public function getLogoutUrl($params = array()) + public function getLogoutUrl($params = []) { return $this->getUrl( 'www', 'logout.php', - array_merge(array( + array_merge([ 'next' => $this->getCurrentUrl(), 'access_token' => $this->getUserAccessToken(), - ), $params) + ], $params) ); } @@ -639,18 +649,18 @@ abstract class BaseFacebook * @param array $params Provide custom parameters * @return string The URL for the logout flow */ - public function getLoginStatusUrl($params = array()) + public function getLoginStatusUrl($params = []) { return $this->getUrl( 'www', 'extern/login_status.php', - array_merge(array( + array_merge([ 'api_key' => $this->getAppId(), 'no_session' => $this->getCurrentUrl(), 'no_user' => $this->getCurrentUrl(), 'ok_session' => $this->getCurrentUrl(), 'session_version' => 3, - ), $params) + ], $params) ); } @@ -665,7 +675,7 @@ abstract class BaseFacebook if (is_array($args[0])) { return $this->_restserver($args[0]); } else { - return call_user_func_array(array($this, '_graph'), $args); + return call_user_func_array([$this, '_graph'], $args); } } @@ -708,8 +718,8 @@ abstract class BaseFacebook if (isset($_REQUEST['code'])) { if ($this->state !== null && isset($_REQUEST['state']) && - $this->state === $_REQUEST['state']) { - + $this->state === $_REQUEST['state'] + ) { // CSRF state has done its job, so clear it $this->state = null; $this->clearPersistentData('state'); @@ -797,10 +807,13 @@ abstract class BaseFacebook $access_token_response = $this->_oauthRequest( $this->getUrl('graph', '/oauth/access_token'), - $params = array('client_id' => $this->getAppId(), - 'client_secret' => $this->getAppSecret(), - 'redirect_uri' => $redirect_uri, - 'code' => $code)); + $params = [ + 'client_id' => $this->getAppId(), + 'client_secret' => $this->getAppSecret(), + 'redirect_uri' => $redirect_uri, + 'code' => $code + ] + ); } catch (FacebookApiException $e) { self::errorLog($e->getMessage()); // most likely that user very recently revoked authorization. @@ -809,13 +822,13 @@ abstract class BaseFacebook } if (empty($access_token_response)) { - self::errorlog('No access token response'); + self::errorLog('No access token response'); return false; } $response_params = json_decode($access_token_response, true); if (!isset($response_params['access_token'])) { - self::errorlog('No access token in response. ' . $access_token_response); + self::errorLog('No access token in response. ' . $access_token_response); return false; } @@ -883,7 +896,7 @@ abstract class BaseFacebook * @return mixed The decoded response object * @throws FacebookApiException */ - protected function _graph($path, $method = 'GET', $params = array()) + protected function _graph($path, $method = 'GET', $params = []) { if (is_array($method) && empty($params)) { $params = $method; @@ -969,7 +982,7 @@ abstract class BaseFacebook $existing_headers[] = 'Expect:'; $opts[CURLOPT_HTTPHEADER] = $existing_headers; } else { - $opts[CURLOPT_HTTPHEADER] = array('Expect:'); + $opts[CURLOPT_HTTPHEADER] = ['Expect:']; } curl_setopt_array($ch, $opts); @@ -988,7 +1001,7 @@ abstract class BaseFacebook // fall back to IPv6 and the error EHOSTUNREACH is returned by the // operating system if ($result === false && empty($opts[CURLOPT_IPRESOLVE])) { - $matches = array(); + $matches = []; $regex = '/Failed to connect to ([^:].*): Network is unreachable/'; if (preg_match($regex, curl_error($ch), $matches)) { if (strlen(@inet_pton($matches[1])) === 16) { @@ -1002,13 +1015,13 @@ abstract class BaseFacebook } if ($result === false) { - $e = new FacebookApiException(array( + $e = new FacebookApiException([ 'error_code' => curl_errno($ch), - 'error' => array( + 'error' => [ 'message' => curl_error($ch), 'type' => 'CurlException', - ), - )); + ], + ]); curl_close($ch); throw $e; } @@ -1036,8 +1049,7 @@ abstract class BaseFacebook } // check sig - $expected_sig = hash_hmac('sha256', $payload, - $this->getAppSecret(), $raw = true); + $expected_sig = hash_hmac('sha256', $payload, $this->getAppSecret(), $raw = true); if ($sig !== $expected_sig) { self::errorLog('Bad Signed JSON signature!'); return null; @@ -1056,7 +1068,8 @@ abstract class BaseFacebook { if (!is_array($data)) { throw new InvalidArgumentException( - 'makeSignedRequest expects an array. Got: '.print_r($data, true)); + 'makeSignedRequest expects an array. Got: '.print_r($data, true) + ); } $data['algorithm'] = self::SIGNED_REQUEST_ALGORITHM; $data['issued_at'] = time(); @@ -1076,7 +1089,7 @@ abstract class BaseFacebook protected function getApiUrl($method) { static $READ_ONLY_CALLS = - array( + [ 'admin.getallocation' => 1, 'admin.getappproperties' => 1, 'admin.getbannedusers' => 1, @@ -1137,11 +1150,11 @@ abstract class BaseFacebook 'users.isappuser' => 1, 'users.isverified' => 1, 'video.getuploadlimits' => 1 - ); + ]; $name = 'api'; if (isset($READ_ONLY_CALLS[strtolower($method)])) { $name = 'api_read'; - } else if (strtolower($method) == 'video.upload') { + } elseif (strtolower($method) == 'video.upload') { $name = 'api_video'; } return $this->getUrl($name, 'restserver.php'); @@ -1156,7 +1169,7 @@ abstract class BaseFacebook * * @return string The URL for the given parameters */ - protected function getUrl($name, $path = '', $params = array()) + protected function getUrl($name, $path = '', $params = []) { $url = self::$DOMAIN_MAP[$name]; if ($path) { @@ -1354,18 +1367,18 @@ abstract class BaseFacebook { $cookie_name = $this->getMetadataCookieName(); if (!array_key_exists($cookie_name, $_COOKIE)) { - return array(); + return []; } // The cookie value can be wrapped in "-characters so remove them $cookie_value = trim($_COOKIE[$cookie_name], '"'); if (empty($cookie_value)) { - return array(); + return []; } $parts = explode('&', $cookie_value); - $metadata = array(); + $metadata = []; foreach ($parts as $part) { $pair = explode('=', $part, 2); if (!empty($pair[0])) { diff --git a/modules/authfacebook/lib/Auth/Source/Facebook.php b/modules/authfacebook/lib/Auth/Source/Facebook.php index 40d5438561501e9f3004ef64c2f95b107dd683d2..a2bee6a7a368d460d2998aef16d72810a834ab97 100644 --- a/modules/authfacebook/lib/Auth/Source/Facebook.php +++ b/modules/authfacebook/lib/Auth/Source/Facebook.php @@ -72,8 +72,11 @@ class Facebook extends \SimpleSAML\Auth\Source // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $cfgParse = \SimpleSAML\Configuration::loadFromArray($config, 'authsources['.var_export($this->authId, true).']'); - + $cfgParse = \SimpleSAML\Configuration::loadFromArray( + $config, + 'authsources['.var_export($this->authId, true).']' + ); + $this->api_key = $cfgParse->getString('api_key'); $this->secret = $cfgParse->getString('secret'); $this->req_perms = $cfgParse->getString('req_perms', null); @@ -93,23 +96,29 @@ class Facebook extends \SimpleSAML\Auth\Source // We are going to need the authId in order to retrieve this authentication source later $state[self::AUTHID] = $this->authId; \SimpleSAML\Auth\State::saveState($state, self::STAGE_INIT); - - $facebook = new Module\authfacebook\Facebook(array('appId' => $this->api_key, 'secret' => $this->secret), $state); + + $facebook = new Module\authfacebook\Facebook( + ['appId' => $this->api_key, 'secret' => $this->secret], + $state + ); $facebook->destroySession(); $linkback = Module::getModuleURL('authfacebook/linkback.php'); - $url = $facebook->getLoginUrl(array('redirect_uri' => $linkback, 'scope' => $this->req_perms)); + $url = $facebook->getLoginUrl(['redirect_uri' => $linkback, 'scope' => $this->req_perms]); \SimpleSAML\Auth\State::saveState($state, self::STAGE_INIT); \SimpleSAML\Utils\HTTP::redirectTrustedURL($url); } - + public function finalStep(&$state) { assert(is_array($state)); - $facebook = new Module\authfacebook\Facebook(array('appId' => $this->api_key, 'secret' => $this->secret), $state); + $facebook = new Module\authfacebook\Facebook( + ['appId' => $this->api_key, 'secret' => $this->secret], + $state + ); $uid = $facebook->getUser(); if (isset($uid) && $uid) { @@ -123,27 +132,27 @@ class Facebook extends \SimpleSAML\Auth\Source if (!isset($info)) { throw new \SimpleSAML\Error\AuthSource($this->authId, 'Error getting user profile.'); } - - $attributes = array(); + + $attributes = []; foreach ($info as $key => $value) { if (is_string($value) && !empty($value)) { - $attributes['facebook.'.$key] = array((string) $value); + $attributes['facebook.'.$key] = [(string) $value]; } } if (array_key_exists('third_party_id', $info)) { - $attributes['facebook_user'] = array($info['third_party_id'].'@facebook.com'); + $attributes['facebook_user'] = [$info['third_party_id'].'@facebook.com']; } else { - $attributes['facebook_user'] = array($uid.'@facebook.com'); + $attributes['facebook_user'] = [$uid.'@facebook.com']; } - $attributes['facebook_targetedID'] = array('http://facebook.com!'.$uid); - $attributes['facebook_cn'] = array($info['name']); + $attributes['facebook_targetedID'] = ['http://facebook.com!'.$uid]; + $attributes['facebook_cn'] = [$info['name']]; \SimpleSAML\Logger::debug('Facebook Returned Attributes: '.implode(", ", array_keys($attributes))); $state['Attributes'] = $attributes; - + $facebook->destroySession(); } } diff --git a/modules/authfacebook/lib/Facebook.php b/modules/authfacebook/lib/Facebook.php index f5d123077db220012ddf6c549c3015e53dec939a..cf68d348a52d3530b98879a284977efc120cbf61 100644 --- a/modules/authfacebook/lib/Facebook.php +++ b/modules/authfacebook/lib/Facebook.php @@ -48,7 +48,7 @@ class Facebook extends \BaseFacebook } } - protected static $kSupportedKeys = array('state', 'code', 'access_token', 'user_id'); + protected static $kSupportedKeys = ['state', 'code', 'access_token', 'user_id']; protected function initSharedSession() { @@ -67,10 +67,10 @@ class Facebook extends \BaseFacebook $base_domain = $this->getBaseDomain(); $this->sharedSessionID = md5(uniqid(mt_rand(), true)); $cookie_value = $this->makeSignedRequest( - array( + [ 'domain' => $base_domain, 'id' => $this->sharedSessionID, - ) + ] ); $_COOKIE[$cookie_name] = $cookie_value; if (!headers_sent()) { @@ -153,7 +153,7 @@ class Facebook extends \BaseFacebook protected function constructSessionVariableName($key) { - $parts = array('authfacebook:authdata:fb', $this->getAppId(), $key); + $parts = ['authfacebook:authdata:fb', $this->getAppId(), $key]; if ($this->sharedSessionID) { array_unshift($parts, $this->sharedSessionID); } diff --git a/modules/authfacebook/www/linkback.php b/modules/authfacebook/www/linkback.php index 904b33ba26f1e7a56dd64524e4841105f03cc46f..6a24590194e4ec6a3e390386b5f937853fec4e86 100644 --- a/modules/authfacebook/www/linkback.php +++ b/modules/authfacebook/www/linkback.php @@ -6,22 +6,32 @@ // For backwards compatability look for AuthState first if (array_key_exists('AuthState', $_REQUEST) && !empty($_REQUEST['AuthState'])) { - $state = \SimpleSAML\Auth\State::loadState($_REQUEST['AuthState'], \SimpleSAML\Module\authfacebook\Auth\Source\Facebook::STAGE_INIT); + $state = \SimpleSAML\Auth\State::loadState( + $_REQUEST['AuthState'], + \SimpleSAML\Module\authfacebook\Auth\Source\Facebook::STAGE_INIT + ); } elseif (array_key_exists('state', $_REQUEST) && !empty($_REQUEST['state'])) { - $state = \SimpleSAML\Auth\State::loadState($_REQUEST['state'], \SimpleSAML\Module\authfacebook\Auth\Source\Facebook::STAGE_INIT); + $state = \SimpleSAML\Auth\State::loadState( + $_REQUEST['state'], + \SimpleSAML\Module\authfacebook\Auth\Source\Facebook::STAGE_INIT + ); } else { throw new \SimpleSAML\Error\BadRequest('Missing state parameter on facebook linkback endpoint.'); } // Find authentication source if (!array_key_exists(\SimpleSAML\Module\authfacebook\Auth\Source\Facebook::AUTHID, $state)) { - throw new \SimpleSAML\Error\BadRequest('No data in state for '.\SimpleSAML\Module\authfacebook\Auth\Source\Facebook::AUTHID); + throw new \SimpleSAML\Error\BadRequest( + 'No data in state for '.\SimpleSAML\Module\authfacebook\Auth\Source\Facebook::AUTHID + ); } $sourceId = $state[\SimpleSAML\Module\authfacebook\Auth\Source\Facebook::AUTHID]; $source = \SimpleSAML\Auth\Source::getById($sourceId); if ($source === null) { - throw new \SimpleSAML\Error\BadRequest('Could not find authentication source with id '.var_export($sourceId, true)); + throw new \SimpleSAML\Error\BadRequest( + 'Could not find authentication source with id '.var_export($sourceId, true) + ); } try { @@ -33,7 +43,10 @@ try { } catch (\SimpleSAML\Error\Exception $e) { \SimpleSAML\Auth\State::throwException($state, $e); } catch (\Exception $e) { - \SimpleSAML\Auth\State::throwException($state, new \SimpleSAML\Error\AuthSource($sourceId, 'Error on facebook linkback endpoint.', $e)); + \SimpleSAML\Auth\State::throwException( + $state, + new \SimpleSAML\Error\AuthSource($sourceId, 'Error on facebook linkback endpoint.', $e) + ); } \SimpleSAML\Auth\Source::completeAuth($state); diff --git a/modules/authlinkedin/lib/Auth/Source/LinkedIn.php b/modules/authlinkedin/lib/Auth/Source/LinkedIn.php index 91b0003de744fdbe37a2d81683ae4ac836494afe..0716d8663f296366c247fb46ae22801ccab9b6cf 100644 --- a/modules/authlinkedin/lib/Auth/Source/LinkedIn.php +++ b/modules/authlinkedin/lib/Auth/Source/LinkedIn.php @@ -84,7 +84,9 @@ class LinkedIn extends \SimpleSAML\Auth\Source // Get the request token $requestToken = $consumer->getRequestToken( 'https://api.linkedin.com/uas/oauth/requestToken', - array('oauth_callback' => \SimpleSAML\Module::getModuleUrl('authlinkedin').'/linkback.php?stateid='.$stateID) + [ + 'oauth_callback' => \SimpleSAML\Module::getModuleUrl('authlinkedin').'/linkback.php?stateid='.$stateID + ] ); \SimpleSAML\Logger::debug( @@ -115,8 +117,9 @@ class LinkedIn extends \SimpleSAML\Auth\Source // Replace the request token with an access token (via GET method) $accessToken = $consumer->getAccessToken( - 'https://api.linkedin.com/uas/oauth/accessToken', $requestToken, - array('oauth_verifier' => $state['authlinkedin:oauth_verifier']) + 'https://api.linkedin.com/uas/oauth/accessToken', + $requestToken, + ['oauth_verifier' => $state['authlinkedin:oauth_verifier']] ); \SimpleSAML\Logger::debug( @@ -126,8 +129,8 @@ class LinkedIn extends \SimpleSAML\Auth\Source $userdata = $consumer->getUserInfo( 'https://api.linkedin.com/v1/people/~:('.$this->attributes.')', - $accessToken, - array('http' => array('header' => 'x-li-format: json')) + $accessToken, + ['http' => ['header' => 'x-li-format: json']] ); $attributes = $this->flatten($userdata, 'linkedin.'); @@ -135,8 +138,8 @@ class LinkedIn extends \SimpleSAML\Auth\Source // TODO: pass accessToken: key, secret + expiry as attributes? if (array_key_exists('id', $userdata)) { - $attributes['linkedin_targetedID'] = array('http://linkedin.com!'.$userdata['id']); - $attributes['linkedin_user'] = array($userdata['id'].'@linkedin.com'); + $attributes['linkedin_targetedID'] = ['http://linkedin.com!'.$userdata['id']]; + $attributes['linkedin_user'] = [$userdata['id'].'@linkedin.com']; } \SimpleSAML\Logger::debug('LinkedIn Returned Attributes: '.implode(", ", array_keys($attributes))); @@ -173,12 +176,12 @@ class LinkedIn extends \SimpleSAML\Auth\Source */ protected function flatten($array, $prefix = '') { - $result = array(); + $result = []; foreach ($array as $key => $value) { if (is_array($value)) { $result = $result + $this->flatten($value, $prefix.$key.'.'); } else { - $result[$prefix.$key] = array($value); + $result[$prefix.$key] = [$value]; } } return $result; diff --git a/modules/authlinkedin/www/linkback.php b/modules/authlinkedin/www/linkback.php index bc2abdca47e5872c428442b91a679948035497f4..157525ab29b505ada5462f70bd368fb4b74495c8 100644 --- a/modules/authlinkedin/www/linkback.php +++ b/modules/authlinkedin/www/linkback.php @@ -7,7 +7,10 @@ if (!array_key_exists('stateid', $_REQUEST)) { throw new \Exception('Lost OAuth Client State'); } -$state = \SimpleSAML\Auth\State::loadState($_REQUEST['stateid'], \SimpleSAML\Module\authlinkedin\Auth\Source\LinkedIn::STAGE_INIT); +$state = \SimpleSAML\Auth\State::loadState( + $_REQUEST['stateid'], + \SimpleSAML\Module\authlinkedin\Auth\Source\LinkedIn::STAGE_INIT +); // http://developer.linkedin.com/docs/DOC-1008#2_Redirect_the_User_to_our_Authorization_Server if (array_key_exists('oauth_verifier', $_REQUEST)) { @@ -28,4 +31,3 @@ if ($source === null) { $source->finalStep($state); \SimpleSAML\Auth\Source::completeAuth($state); - diff --git a/modules/authorize/lib/Auth/Process/Authorize.php b/modules/authorize/lib/Auth/Process/Authorize.php index 63b5770125273c3c4c6ca6dc1ae8f8cc6efb018c..151bee965279e0e1156d02daac90c9252a995e1a 100644 --- a/modules/authorize/lib/Auth/Process/Authorize.php +++ b/modules/authorize/lib/Auth/Process/Authorize.php @@ -31,7 +31,7 @@ class Authorize extends \SimpleSAML\Auth\ProcessingFilter * user \ to escape special chars, like '.' etc. * */ - protected $valid_attribute_values = array(); + protected $valid_attribute_values = []; /** * Initialize this filter. @@ -62,14 +62,19 @@ class Authorize extends \SimpleSAML\Auth\ProcessingFilter foreach ($config as $attribute => $values) { if (is_string($values)) { - $values = array($values); + $values = [$values]; } if (!is_array($values)) { - throw new \Exception('Filter Authorize: Attribute values is neither string nor array: '.var_export($attribute, true)); + throw new \Exception( + 'Filter Authorize: Attribute values is neither string nor array: '.var_export($attribute, true) + ); } foreach ($values as $value) { if (!is_string($value)) { - throw new \Exception('Filter Authorize: Each value should be a string for attribute: '.var_export($attribute, true).' value: '.var_export($value, true).' Config is: '.var_export($config, true)); + throw new \Exception( + 'Filter Authorize: Each value should be a string for attribute: '.var_export($attribute, true). + ' value: '.var_export($value, true).' Config is: '.var_export($config, true) + ); } } $this->valid_attribute_values[$attribute] = $values; @@ -94,7 +99,7 @@ class Authorize extends \SimpleSAML\Auth\ProcessingFilter foreach ($patterns as $pattern) { $values = $attributes[$name]; if (!is_array($values)) { - $values = array($values); + $values = [$values]; } foreach ($values as $value) { if ($this->regex) { @@ -130,10 +135,8 @@ class Authorize extends \SimpleSAML\Auth\ProcessingFilter protected function unauthorized(&$request) { // Save state and redirect to 403 page - $id = \SimpleSAML\Auth\State::saveState($request, - 'authorize:Authorize'); - $url = \SimpleSAML\Module::getModuleURL( - 'authorize/authorize_403.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + $id = \SimpleSAML\Auth\State::saveState($request, 'authorize:Authorize'); + $url = \SimpleSAML\Module::getModuleURL('authorize/authorize_403.php'); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } } diff --git a/modules/authorize/templates/authorize_403.php b/modules/authorize/templates/authorize_403.php index ee16d96a78b2bffb5ef237aa4e95ada165042659..43ab320336655dd097035b51c6e6c092ab40efb6 100644 --- a/modules/authorize/templates/authorize_403.php +++ b/modules/authorize/templates/authorize_403.php @@ -14,15 +14,11 @@ $this->data['403_header'] = $this->t('{authorize:Authorize:403_header}'); $this->data['403_text'] = $this->t('{authorize:Authorize:403_text}'); $this->includeAtTemplateBase('includes/header.php'); -?> -<h1><?php echo $this->data['403_header']; ?></h1> -<p><?php echo $this->data['403_text']; ?></p> -<?php -if (isset($this->data['LogoutURL'])) { -?> -<p><a href="<?php echo htmlspecialchars($this->data['LogoutURL']); ?>"><?php echo $this->t('{status:logout}'); ?></a></p> -<?php + +echo '<h1>'.$this->data['403_header'].'</h1>'; +echo '<p>'.$this->data['403_text'].'</p>'; +if (isset($this->data['logoutURL'])) { + echo '<p><a href="'.htmlspecialchars($this->data['logoutURL']).'">'.$this->t('{status:logout}').'</a></p>'; } -?> -<?php + $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/authorize/templates/authorize_403.twig b/modules/authorize/templates/authorize_403.twig index 1a60813dc7ca1a832c0d4e9bfd00f6e84975baa8..3f6402e923d727e04a639f9a7c92686979574677 100644 --- a/modules/authorize/templates/authorize_403.twig +++ b/modules/authorize/templates/authorize_403.twig @@ -3,9 +3,9 @@ {% block content %} <h1>{{ '{authorize:Authorize:403_header}'|trans }}</h1> <p>{{ '{authorize:Authorize:403_text}'|trans }}</p> - {% if LogoutURL is defined %} + {% if logoutURL is defined %} <p> - <a href="{{ LogoutURL|escape('html') }}">{{ '{status:logout}'|trans }}</a> + <a href="{{ logoutURL|escape('html') }}">{{ '{status:logout}'|trans }}</a> </p> {% endif %} {% endblock%} diff --git a/modules/authorize/www/authorize_403.php b/modules/authorize/www/authorize_403.php index 158fe11a9bffdf51348937aa09427d8a77238e00..4598a66c83673aaaa32f6a2d731d9ae468898a0f 100644 --- a/modules/authorize/www/authorize_403.php +++ b/modules/authorize/www/authorize_403.php @@ -13,7 +13,10 @@ $state = \SimpleSAML\Auth\State::loadState($_REQUEST['StateId'], 'authorize:Auth $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'authorize:authorize_403.php'); if (isset($state['Source']['auth'])) { - $t->data['LogoutURL'] = \SimpleSAML\Module::getModuleURL('core/authenticate.php', array('as' => $state['Source']['auth']))."&logout"; + $t->data['logoutURL'] = \SimpleSAML\Module::getModuleURL( + 'core/authenticate.php', + ['as' => $state['Source']['auth']] + )."&logout"; } header('HTTP/1.0 403 Forbidden'); $t->show(); diff --git a/modules/authtwitter/lib/Auth/Source/Twitter.php b/modules/authtwitter/lib/Auth/Source/Twitter.php index 3079d20ebcafea024a375dd6e44cfa4944aaba94..19ff725800132cef6758cdaf9366a9b1a96f0f35 100644 --- a/modules/authtwitter/lib/Auth/Source/Twitter.php +++ b/modules/authtwitter/lib/Auth/Source/Twitter.php @@ -57,7 +57,10 @@ class Twitter extends \SimpleSAML\Auth\Source // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $configObject = \SimpleSAML\Configuration::loadFromArray($config, 'authsources['.var_export($this->authId, true).']'); + $configObject = \SimpleSAML\Configuration::loadFromArray( + $config, + 'authsources['.var_export($this->authId, true).']' + ); $this->key = $configObject->getString('key'); $this->secret = $configObject->getString('secret'); @@ -81,8 +84,11 @@ class Twitter extends \SimpleSAML\Auth\Source $consumer = new \SimpleSAML\Module\oauth\Consumer($this->key, $this->secret); // Get the request token - $linkback = \SimpleSAML\Module::getModuleURL('authtwitter/linkback.php', array('AuthState' => $stateID)); - $requestToken = $consumer->getRequestToken('https://api.twitter.com/oauth/request_token', array('oauth_callback' => $linkback)); + $linkback = \SimpleSAML\Module::getModuleURL('authtwitter/linkback.php', ['AuthState' => $stateID]); + $requestToken = $consumer->getRequestToken( + 'https://api.twitter.com/oauth/request_token', + ['oauth_callback' => $linkback] + ); \SimpleSAML\Logger::debug("Got a request token from the OAuth service provider [". $requestToken->key."] with the secret [".$requestToken->secret."]"); @@ -92,7 +98,7 @@ class Twitter extends \SimpleSAML\Auth\Source // Authorize the request token $url = 'https://api.twitter.com/oauth/authenticate'; if ($this->force_login) { - $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, array('force_login' => 'true')); + $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, ['force_login' => 'true']); } $consumer->getAuthorizeRequest($url, $requestToken); } @@ -100,7 +106,7 @@ class Twitter extends \SimpleSAML\Auth\Source public function finalStep(&$state) { $requestToken = $state['authtwitter:authdata:requestToken']; - $parameters = array(); + $parameters = []; if (!isset($_REQUEST['oauth_token'])) { throw new \SimpleSAML\Error\BadRequest("Missing oauth_token parameter."); @@ -120,7 +126,11 @@ class Twitter extends \SimpleSAML\Auth\Source $requestToken->key."] with the secret [".$requestToken->secret."]"); // Replace the request token with an access token - $accessToken = $consumer->getAccessToken('https://api.twitter.com/oauth/access_token', $requestToken, $parameters); + $accessToken = $consumer->getAccessToken( + 'https://api.twitter.com/oauth/access_token', + $requestToken, + $parameters + ); \SimpleSAML\Logger::debug("Got an access token from the OAuth service provider [". $accessToken->key."] with the secret [".$accessToken->secret."]"); @@ -131,20 +141,23 @@ class Twitter extends \SimpleSAML\Auth\Source $userdata = $consumer->getUserInfo($verify_credentials_url, $accessToken); if (!isset($userdata['id_str']) || !isset($userdata['screen_name'])) { - throw new \SimpleSAML\Error\AuthSource($this->authId, 'Authentication error: id_str and screen_name not set.'); + throw new \SimpleSAML\Error\AuthSource( + $this->authId, + 'Authentication error: id_str and screen_name not set.' + ); } - $attributes = array(); + $attributes = []; foreach ($userdata as $key => $value) { if (is_string($value)) { - $attributes['twitter.'.$key] = array((string) $value); + $attributes['twitter.'.$key] = [(string) $value]; + } } - } - $attributes['twitter_at_screen_name'] = array('@'.$userdata['screen_name']); - $attributes['twitter_screen_n_realm'] = array($userdata['screen_name'].'@twitter.com'); - $attributes['twitter_targetedID'] = array('http://twitter.com!'.$userdata['id_str']); + $attributes['twitter_at_screen_name'] = ['@'.$userdata['screen_name']]; + $attributes['twitter_screen_n_realm'] = [$userdata['screen_name'].'@twitter.com']; + $attributes['twitter_targetedID'] = ['http://twitter.com!'.$userdata['id_str']]; - $state['Attributes'] = $attributes; + $state['Attributes'] = $attributes; } } diff --git a/modules/authtwitter/www/linkback.php b/modules/authtwitter/www/linkback.php index ebba693a4ac5d60d71a2c95e44802e8afbb60618..cbeed68a7be8028ae0e217cadb15d199948b56af 100644 --- a/modules/authtwitter/www/linkback.php +++ b/modules/authtwitter/www/linkback.php @@ -7,17 +7,24 @@ if (!array_key_exists('AuthState', $_REQUEST) || empty($_REQUEST['AuthState'])) { throw new \SimpleSAML\Error\BadRequest('Missing state parameter on twitter linkback endpoint.'); } -$state = \SimpleSAML\Auth\State::loadState($_REQUEST['AuthState'], \SimpleSAML\Module\authtwitter\Auth\Source\Twitter::STAGE_INIT); +$state = \SimpleSAML\Auth\State::loadState( + $_REQUEST['AuthState'], + \SimpleSAML\Module\authtwitter\Auth\Source\Twitter::STAGE_INIT +); // Find authentication source if (!array_key_exists(\SimpleSAML\Module\authtwitter\Auth\Source\Twitter::AUTHID, $state)) { - throw new \SimpleSAML\Error\BadRequest('No data in state for '.\SimpleSAML\Module\authtwitter\Auth\Source\Twitter::AUTHID); + throw new \SimpleSAML\Error\BadRequest( + 'No data in state for '.\SimpleSAML\Module\authtwitter\Auth\Source\Twitter::AUTHID + ); } $sourceId = $state[\SimpleSAML\Module\authtwitter\Auth\Source\Twitter::AUTHID]; $source = \SimpleSAML\Auth\Source::getById($sourceId); if ($source === null) { - throw new \SimpleSAML\Error\BadRequest('Could not find authentication source with id '.var_export($sourceId, true)); + throw new \SimpleSAML\Error\BadRequest( + 'Could not find authentication source with id '.var_export($sourceId, true) + ); } try { @@ -28,7 +35,10 @@ try { } catch (\SimpleSAML\Error\Exception $e) { \SimpleSAML\Auth\State::throwException($state, $e); } catch (\Exception $e) { - \SimpleSAML\Auth\State::throwException($state, new \SimpleSAML\Error\AuthSource($sourceId, 'Error on authtwitter linkback endpoint.', $e)); + \SimpleSAML\Auth\State::throwException( + $state, + new \SimpleSAML\Error\AuthSource($sourceId, 'Error on authtwitter linkback endpoint.', $e) + ); } \SimpleSAML\Auth\Source::completeAuth($state); diff --git a/modules/authwindowslive/lib/Auth/Source/LiveID.php b/modules/authwindowslive/lib/Auth/Source/LiveID.php index 45488abe294b68836e8095d9239df47c8e7d1c95..3f4dc5446d3cd64b7020d66f2fd4e821736a2d58 100644 --- a/modules/authwindowslive/lib/Auth/Source/LiveID.php +++ b/modules/authwindowslive/lib/Auth/Source/LiveID.php @@ -76,7 +76,7 @@ class LiveID extends \SimpleSAML\Auth\Source '?client_id='.$this->key. '&response_type=code'. '&response_mode=query'. - '&redirect_uri='.urlencode(\SimpleSAML\Module::getModuleUrl('authwindowslive').'/linkback.php'). + '&redirect_uri='.urlencode(\SimpleSAML\Module::getModuleURL('authwindowslive').'/linkback.php'). '&state='.urlencode($stateID). '&scope='.urlencode('openid https://graph.microsoft.com/user.read') ; @@ -102,16 +102,16 @@ class LiveID extends \SimpleSAML\Auth\Source '&client_secret='.urlencode($this->secret). '&scope='.urlencode('https://graph.microsoft.com/user.read'). '&grant_type=authorization_code'. - '&redirect_uri='.urlencode(\SimpleSAML\Module::getModuleUrl('authwindowslive').'/linkback.php'). + '&redirect_uri='.urlencode(\SimpleSAML\Module::getModuleURL('authwindowslive').'/linkback.php'). '&code='.urlencode($state['authwindowslive:verification_code']); - $context = array( - 'http' => array( + $context = [ + 'http' => [ 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postData, - ), - ); + ], + ]; $result = \SimpleSAML\Utils\HTTP::fetch('https://login.microsoftonline.com/common/oauth2/v2.0/token', $context); @@ -130,10 +130,10 @@ class LiveID extends \SimpleSAML\Auth\Source ); // documentation at: http://graph.microsoft.io/en-us/docs/overview/call_api - $opts = array( - 'http' => array('header' => "Accept: application/json\r\nAuthorization: Bearer ". - $response['access_token']."\r\n") - ); + $opts = [ + 'http' => ['header' => "Accept: application/json\r\nAuthorization: Bearer ". + $response['access_token']."\r\n"] + ]; $data = \SimpleSAML\Utils\HTTP::fetch('https://graph.microsoft.com/v1.0/me', $opts); $userdata = json_decode($data, true); @@ -144,13 +144,13 @@ class LiveID extends \SimpleSAML\Auth\Source $userdata['error']['message'] ); } - $attributes = array(); - $attributes['windowslive_targetedID'] = array( + $attributes = []; + $attributes['windowslive_targetedID'] = [ 'https://graph.microsoft.com!'.(!empty($userdata['id']) ? $userdata['id'] : 'unknown') - ); + ]; foreach ($userdata as $key => $value) { if (is_string($value)) { - $attributes['windowslive.'.$key] = array((string) $value); + $attributes['windowslive.'.$key] = [(string) $value]; } } diff --git a/modules/authwindowslive/www/linkback.php b/modules/authwindowslive/www/linkback.php index 31637deb7578f4e357a54ff9d7c3a79c0dd00c6a..758bdd215f6b490ef11b8b554e1cf2914929595b 100644 --- a/modules/authwindowslive/www/linkback.php +++ b/modules/authwindowslive/www/linkback.php @@ -7,7 +7,10 @@ if (!array_key_exists('state', $_REQUEST)) { throw new \Exception('Lost OAuth Client State'); } -$state = \SimpleSAML\Auth\State::loadState($_REQUEST['state'], \SimpleSAML\Module\authwindowslive\Auth\Source\LiveID::STAGE_INIT); +$state = \SimpleSAML\Auth\State::loadState( + $_REQUEST['state'], + \SimpleSAML\Module\authwindowslive\Auth\Source\LiveID::STAGE_INIT +); // http://msdn.microsoft.com/en-us/library/ff749771.aspx if (array_key_exists('code', $_REQUEST)) { diff --git a/modules/cas/lib/Auth/Source/CAS.php b/modules/cas/lib/Auth/Source/CAS.php index 9ae671a76bfd3bf9ab562c92c0c18b5d154314e6..08f153c130f4a0ae2b545ba3e950f369f06f9d64 100644 --- a/modules/cas/lib/Auth/Source/CAS.php +++ b/modules/cas/lib/Auth/Source/CAS.php @@ -26,22 +26,23 @@ class CAS extends \SimpleSAML\Auth\Source /** * @var array with ldap configuration */ - private $_ldapConfig; + private $ldapConfig; /** * @var cas configuration */ - private $_casConfig; + private $casConfig; /** * @var string cas chosen validation method */ - private $_validationMethod; + private $validationMethod; + /** * @var string cas login method */ - private $_loginMethod; + private $loginMethod; /** * Constructor for this authentication source. @@ -65,19 +66,19 @@ class CAS extends \SimpleSAML\Auth\Source throw new \Exception('ldap authentication source is not properly configured: missing [ldap]'); } - $this->_casConfig = $config['cas']; - $this->_ldapConfig = $config['ldap']; + $this->casConfig = $config['cas']; + $this->ldapConfig = $config['ldap']; - if (isset($this->_casConfig['serviceValidate'])) { - $this->_validationMethod = 'serviceValidate'; - } elseif (isset($this->_casConfig['validate'])) { - $this->_validationMethod = 'validate'; + if (isset($this->casConfig['serviceValidate'])) { + $this->validationMethod = 'serviceValidate'; + } elseif (isset($this->casConfig['validate'])) { + $this->validationMethod = 'validate'; } else { throw new \Exception("validate or serviceValidate not specified"); } - if (isset($this->_casConfig['login'])) { - $this->_loginMethod = $this->_casConfig['login']; + if (isset($this->casConfig['login'])) { + $this->loginMethod = $this->casConfig['login']; } else { throw new \Exception("cas login URL not specified"); } @@ -94,15 +95,15 @@ class CAS extends \SimpleSAML\Auth\Source */ private function casValidate($ticket, $service) { - $url = \SimpleSAML\Utils\HTTP::addURLParameters($this->_casConfig['validate'], array( + $url = \SimpleSAML\Utils\HTTP::addURLParameters($this->casConfig['validate'], [ 'ticket' => $ticket, 'service' => $service, - )); + ]); $result = \SimpleSAML\Utils\HTTP::fetch($url); $res = preg_split("/\r?\n/", $result); if (strcmp($res[0], "yes") == 0) { - return array($res[1], array()); + return [$res[1], []]; } else { throw new \Exception("Failed to validate CAS service ticket: $ticket"); } @@ -120,11 +121,11 @@ class CAS extends \SimpleSAML\Auth\Source private function casServiceValidate($ticket, $service) { $url = \SimpleSAML\Utils\HTTP::addURLParameters( - $this->_casConfig['serviceValidate'], - array( + $this->casConfig['serviceValidate'], + [ 'ticket' => $ticket, 'service' => $service, - ) + ] ); $result = \SimpleSAML\Utils\HTTP::fetch($url); @@ -136,8 +137,8 @@ class CAS extends \SimpleSAML\Auth\Source $failure = $xPath->evaluate("/cas:serviceResponse/cas:authenticationFailure"); throw new \Exception("Error when validating CAS service ticket: ".$failure->item(0)->textContent); } else { - $attributes = array(); - if ($casattributes = $this->_casConfig['attributes']) { + $attributes = []; + if ($casattributes = $this->casConfig['attributes']) { // Some has attributes in the xml - attributes is a list of XPath expressions to get them foreach ($casattributes as $name => $query) { $attrs = $xPath->query($query); @@ -148,7 +149,7 @@ class CAS extends \SimpleSAML\Auth\Source } $casusername = $success->item(0)->textContent; - return array($casusername, $attributes); + return [$casusername, $attributes]; } } @@ -163,7 +164,7 @@ class CAS extends \SimpleSAML\Auth\Source */ protected function casValidation($ticket, $service) { - switch ($this->_validationMethod) { + switch ($this->validationMethod) { case 'validate': return $this->casValidate($ticket, $service); case 'serviceValidate': @@ -177,19 +178,20 @@ class CAS extends \SimpleSAML\Auth\Source /** * Called by linkback, to finish validate/ finish logging in. * @param array $state - * @return array username, casattributes/ldap attributes */ public function finalStep(&$state) { $ticket = $state['cas:ticket']; $stateID = \SimpleSAML\Auth\State::saveState($state, self::STAGE_INIT); - $service = \SimpleSAML\Module::getModuleURL('cas/linkback.php', array('stateID' => $stateID)); + $service = \SimpleSAML\Module::getModuleURL('cas/linkback.php', ['stateID' => $stateID]); list($username, $casattributes) = $this->casValidation($ticket, $service); - $ldapattributes = array(); + $ldapattributes = []; - $config = \SimpleSAML\Configuration::loadFromArray($this->_ldapConfig, - 'Authentication source '.var_export($this->authId, true)); - if ($this->_ldapConfig['servers']) { + $config = \SimpleSAML\Configuration::loadFromArray( + $this->ldapConfig, + 'Authentication source '.var_export($this->authId, true) + ); + if ($this->ldapConfig['servers']) { $ldap = new \SimpleSAML\Auth\LDAP( $config->getString('servers'), $config->getBoolean('enable_tls', false), @@ -198,7 +200,7 @@ class CAS extends \SimpleSAML\Auth\Source $config->getInteger('port', 389), $config->getBoolean('referrals', true) ); - $ldapattributes = $ldap->validate($this->_ldapConfig, $username); + $ldapattributes = $ldap->validate($this->ldapConfig, $username); } $attributes = array_merge_recursive($casattributes, $ldapattributes); $state['Attributes'] = $attributes; @@ -221,9 +223,9 @@ class CAS extends \SimpleSAML\Auth\Source $stateID = \SimpleSAML\Auth\State::saveState($state, self::STAGE_INIT); - $serviceUrl = \SimpleSAML\Module::getModuleURL('cas/linkback.php', array('stateID' => $stateID)); + $serviceUrl = \SimpleSAML\Module::getModuleURL('cas/linkback.php', ['stateID' => $stateID]); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($this->_loginMethod, array('service' => $serviceUrl)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($this->loginMethod, ['service' => $serviceUrl]); } @@ -243,7 +245,7 @@ class CAS extends \SimpleSAML\Auth\Source public function logout(&$state) { assert(is_array($state)); - $logoutUrl = $this->_casConfig['logout']; + $logoutUrl = $this->casConfig['logout']; \SimpleSAML\Auth\State::deleteState($state); // we want cas to log us out diff --git a/modules/cas/www/linkback.php b/modules/cas/www/linkback.php index e547a9afeb0ff18cdba5fce89b282f96e891089c..366583c8a7e572099e66cfaad716faaa084f3788 100644 --- a/modules/cas/www/linkback.php +++ b/modules/cas/www/linkback.php @@ -24,5 +24,3 @@ if ($source === null) { } $source->finalStep($state); - - diff --git a/modules/cdc/config-templates/module_cdc.php b/modules/cdc/config-templates/module_cdc.php index 0e5013c87c5d5a489b1ebfec3e3264ac8baa5397..411bbc47110b4581eab72f0174f4edd66da9ff3e 100644 --- a/modules/cdc/config-templates/module_cdc.php +++ b/modules/cdc/config-templates/module_cdc.php @@ -1,7 +1,7 @@ <?php -$config = array( - 'example.org' => array( +$config = [ + 'example.org' => [ /* * The shared key for this CDC server. */ @@ -18,5 +18,5 @@ $config = array( * If this is 0, the cookie will expire when the browser is closed. */ 'cookie.lifetime' => 0, - ), -); + ], +]; diff --git a/modules/cdc/lib/Auth/Process/CDC.php b/modules/cdc/lib/Auth/Process/CDC.php index d16569ef80765634b9cc6650d4c2357ee1db09b0..bf2a669d67ca5b60275cb3c4f26ea71deab7fd29 100644 --- a/modules/cdc/lib/Auth/Process/CDC.php +++ b/modules/cdc/lib/Auth/Process/CDC.php @@ -63,12 +63,12 @@ class CDC extends \SimpleSAML\Auth\ProcessingFilter // Save state and build request $id = \SimpleSAML\Auth\State::saveState($state, 'cdc:resume'); - $returnTo = \SimpleSAML\Module::getModuleURL('cdc/resume.php', array('domain' => $this->domain)); + $returnTo = \SimpleSAML\Module::getModuleURL('cdc/resume.php', ['domain' => $this->domain]); - $params = array( + $params = [ 'id' => $id, 'entityID' => $state['Source']['entityid'], - ); + ]; $this->client->sendRequest($returnTo, 'append', $params); } } diff --git a/modules/cdc/lib/Client.php b/modules/cdc/lib/Client.php index 6af90fa492f49f19d84eb23c2a730305a90e0ec4..609aef63f403f78256597fc3a2e4f6a4d075cfe9 100644 --- a/modules/cdc/lib/Client.php +++ b/modules/cdc/lib/Client.php @@ -58,7 +58,7 @@ class Client * @param string $op The operation we are performing. * @param array $params Additional parameters. */ - public function sendRequest($returnTo, $op, array $params = array()) + public function sendRequest($returnTo, $op, array $params = []) { assert(is_string($returnTo)); assert(is_string($op)); diff --git a/modules/cdc/lib/Server.php b/modules/cdc/lib/Server.php index 4292ce53fee306a0a306f8c18e3a6e661be6144d..affcf668ac241429c7eb933f87bfb48605dac0f1 100644 --- a/modules/cdc/lib/Server.php +++ b/modules/cdc/lib/Server.php @@ -66,7 +66,9 @@ class Server $this->cookieLifetime = $config->getInteger('cookie.lifetime', 0); if ($this->key === 'ExampleSharedKey') { - throw new \SimpleSAML\Error\Exception('Key for CDC domain '.var_export($domain, true).' not changed from default.'); + throw new \SimpleSAML\Error\Exception( + 'Key for CDC domain '.var_export($domain, true).' not changed from default.' + ); } } @@ -160,9 +162,9 @@ class Server } if (is_string($response)) { - $response = array( + $response = [ 'status' => $response, - ); + ]; } $response['op'] = $op; @@ -210,12 +212,12 @@ class Server */ private function handleDelete(array $request) { - $params = array( + $params = [ 'path' => '/', 'domain' => '.'.$this->domain, 'secure' => true, 'httponly' => false, - ); + ]; \SimpleSAML\Utils\HTTP::setCookie('_saml_idp', null, $params, false); return 'ok'; @@ -232,10 +234,10 @@ class Server { $list = $this->getCDC(); - return array( + return [ 'status' => 'ok', 'cdc' => $list, - ); + ]; } @@ -328,10 +330,10 @@ class Server $signature = $this->calcSignature($message); - $params = array( + $params = [ $parameter => $message, 'Signature' => $signature, - ); + ]; $url = \SimpleSAML\Utils\HTTP::addURLParameters($to, $params); if (strlen($url) < 2048) { @@ -364,7 +366,7 @@ class Server private function getCDC() { if (!isset($_COOKIE['_saml_idp'])) { - return array(); + return []; } $ret = (string) $_COOKIE['_saml_idp']; @@ -374,7 +376,7 @@ class Server if ($idp === false) { // Not properly base64 encoded \SimpleSAML\Logger::warning('CDC - Invalid base64-encoding of CDC entry.'); - return array(); + return []; } } @@ -409,14 +411,16 @@ class Server $cookie = $tmp[1]; } - $params = array( + $params = [ 'lifetime' => $this->cookieLifetime, 'path' => '/', 'domain' => '.'.$this->domain, 'secure' => true, 'httponly' => false, - ); + ]; \SimpleSAML\Utils\HTTP::setCookie('_saml_idp', $cookie, $params, false); + + return '_saml_idp'; } } diff --git a/modules/consent/default-enable b/modules/consent/default-disable similarity index 59% rename from modules/consent/default-enable rename to modules/consent/default-disable index 25615cb47c350d23033eb9801627ed8330bcc3e9..fa0bd82e2df7bd79d57593d35bc53c1f9d3ef71f 100644 --- a/modules/consent/default-enable +++ b/modules/consent/default-disable @@ -1,3 +1,3 @@ This file indicates that the default state of this module -is enabled. To disable, create a file named disable in the +is disabled. To enable, create a file named enable in the same directory as this file. diff --git a/modules/consent/dictionaries/consent.php b/modules/consent/dictionaries/consent.php index 509d069ad10b3a85403b6af36b8e20c86943f834..90932786ab4f957ea168a9c613f742d863d07907 100644 --- a/modules/consent/dictionaries/consent.php +++ b/modules/consent/dictionaries/consent.php @@ -1,7 +1,7 @@ <?php -$lang = array( - 'yes' => array( +$lang = [ + 'yes' => [ 'no' => 'Ja, fortsett', 'nn' => 'Ja, fortsett', 'da' => 'Ja, jeg accepterer', @@ -20,8 +20,8 @@ $lang = array( 'pt' => 'Sim, Aceito', 'pt-br' => 'Sim, Aceito', 'tr' => 'Evet, devam et', - ), - 'no' => array( + ], + 'no' => [ 'no' => 'Nei, avbryt', 'nn' => 'Nei, avbryt', 'da' => 'Nej, jeg accepterer ikke', @@ -40,8 +40,8 @@ $lang = array( 'pt' => 'NĂŁo aceito', 'pt-br' => 'NĂŁo, nĂŁo aceito', 'tr' => 'Hayır, iptal et', - ), - 'remember' => array( + ], + 'remember' => [ 'no' => 'Godta ogsĂĄ for fremtiden', 'nn' => 'Godta ogsĂĄ for framtida', 'da' => 'Husk samtykke', @@ -60,8 +60,8 @@ $lang = array( 'pt' => 'Lembrar a minha escolha', 'pt-br' => 'Lembrar Consentimento', 'tr' => 'Hatırla', - ), - 'consent_header' => array( + ], + 'consent_header' => [ 'no' => 'Samtykke om overføring av personinformasjon', 'nn' => 'Samtykke til overføring av personinformasjon', 'da' => 'Samtykke til at frigive personlige oplysninger', @@ -77,8 +77,8 @@ $lang = array( 'pl' => 'Zgoda na wysĹ‚anie danych osobistych', 'pt' => 'Consentimento do envio de informação pessoal', 'tr' => 'KiĹźisel bilgilerin verilmesi hakkında onay', - ), - 'consent_accept' => array( + ], + 'consent_accept' => [ 'no' => 'For ĂĄ fullføre innloggingen mĂĄ du godta at opplysningene nedenfor sendes til SPNAME.', 'nn' => 'For ĂĄ fullføra innlogginga mĂĄ du godta at opplysningane under blir sende til SPNAME', 'da' => 'SPNAME kræver at nedenstĂĄende oplysninger overføres fra IDPNAME. Vil du acceptere dette?', @@ -97,8 +97,8 @@ $lang = array( 'pt' => 'O serviço SPNAME necessita que a informação apresentada em baixo seja transferida.', 'pt-br' => 'VocĂŞ está prestes a acessar o serviço SPNAME. O serviço exige que as informações a seguir sejam transferidas do IDPNAME. VocĂŞ aceita isso?', 'tr' => 'SPNAME aĹźağıdaki bilgilerin gönderilmesine ihtiyaç duyuyor.', - ), - 'consent_purpose' => array( + ], + 'consent_purpose' => [ 'no' => 'FormĂĄlet med SPNAME er SPDESC', 'nn' => 'Hensikta med SPNAME er SPDESC', 'da' => 'SPNAME har til formĂĄl at SPDESC', @@ -114,8 +114,8 @@ $lang = array( 'pl' => 'Celem SPNAME jest SPDESC', 'pt' => 'O propĂłsito de SPNAME Ă© SPDESC', 'tr' => 'SPNAME\'in amacı SPDESC\'tir', - ), - 'consent_privacypolicy' => array( + ], + 'consent_privacypolicy' => [ 'no' => 'Personvern for tjenesten', 'nn' => 'Personvern for tenesta', 'da' => 'Tjenestens politik vedrørende personoplysninger', @@ -132,8 +132,8 @@ $lang = array( 'pt' => 'PolĂtica de privacidade do serviço', 'pt-br' => 'PolĂtica de Privacidade deste serviço', 'tr' => 'Servis için gizlilik politikası', - ), - 'consent_attributes_header' => array( + ], + 'consent_attributes_header' => [ 'no' => 'Opplysninger som vil bli sendt til SPNAME', 'nn' => 'Opplysningar som blir sende til SPNAME', 'da' => 'Attributter som bliver sendt til SPNAME', @@ -149,8 +149,8 @@ $lang = array( 'pl' => 'Atrybuty, ktĂłre zostanÄ… przesĹ‚ane do serwisu', 'pt' => 'Informação que irá ser enviada para SPNAME', 'tr' => 'SPNAME\'e gönderilecek bilgiler', - ), - 'show_attributes' => array( + ], + 'show_attributes' => [ 'no' => 'Vis opplysninger', 'nn' => 'Vis opplysingar', 'da' => 'Vis attributter', @@ -166,8 +166,8 @@ $lang = array( 'pl' => 'WyĹ›wietl atrybuty', 'pt' => 'Mostrar atributos', 'tr' => 'Ă–zellikleri göster', - ), - 'show_attribute' => array( + ], + 'show_attribute' => [ 'no' => 'Vis innhold', 'nn' => 'Vis innhald', 'da' => 'Vis indhold', @@ -176,8 +176,8 @@ $lang = array( 'es' => 'Mostrart consentimiento', 'nl' => 'Toon inhoud', 'sl' => 'PrikaĹľi vsebino', - ), - 'login' => array( + ], + 'login' => [ 'no' => 'innlogging', 'nn' => 'Logg inn', 'da' => 'login', @@ -196,8 +196,8 @@ $lang = array( 'pt' => 'Entrar', 'pt-br' => 'login', 'tr' => 'GiriĹź', - ), - 'service_providers_for' => array( + ], + 'service_providers_for' => [ 'no' => 'Tjenesteleverandør for', 'nn' => 'Tenesteleverandørar for', 'da' => 'Tjenesteudbyder for', @@ -216,8 +216,8 @@ $lang = array( 'pt' => 'Fornecedores de Serviço (SP) para', 'pt-br' => 'Provedor de serviços para', 'tr' => 'için Servis SaÄźlayıcılar', - ), - 'service_provider_header' => array( + ], + 'service_provider_header' => [ 'no' => 'Tjenesteleverandør', 'nn' => 'Tenesteleverandør', 'da' => 'Tjenesteudbyder', @@ -236,8 +236,8 @@ $lang = array( 'pt' => 'Fornecedor de Serviço (SP)', 'pt-br' => 'Provedor de Serviços', 'tr' => 'Servis SaÄźlayıcı', - ), - 'status_header' => array( + ], + 'status_header' => [ 'no' => 'Samtykke-status', 'nn' => 'Samtykkestatus', 'da' => 'Samtykke status', @@ -256,8 +256,8 @@ $lang = array( 'pt' => 'Consentimento', 'pt-br' => 'Status do Consentimento', 'tr' => 'Onay durumu', - ), - 'show_hide_attributes' => array( + ], + 'show_hide_attributes' => [ 'no' => 'Vis/skjul opplysninger', 'nn' => 'Vis/skjul opplysningar', 'da' => 'vis/skjul attributter', @@ -276,8 +276,8 @@ $lang = array( 'pt' => 'Mostrar/Ocultar atributos', 'pt-br' => 'mostra/esconder Atributos', 'tr' => 'bilgileri göster/gizle ', - ), - 'noconsent_title' => array( + ], + 'noconsent_title' => [ 'no' => 'Ikke akseptert overføring av informasjon', 'nn' => 'Ikkje akseptert overføring av informasjon', 'da' => 'Manglende samtykke', @@ -294,8 +294,8 @@ $lang = array( 'pt' => 'Consentimento negado', 'pt-br' => 'Nenhum consentimento dado', 'tr' => 'Onay verilmemiĹź', - ), - 'noconsent_text' => array( + ], + 'noconsent_text' => [ 'no' => 'Du har ikke akseptert ĂĄ overlevere opplysninger til tjenesteleverandøren.', 'nn' => 'Du har ikkje akseptert til at dine opplysningar kan sendast til tenesteleverandøren', 'da' => 'Du har ikke givet samtykke til overleveringen af oplysninger til tjenesten', @@ -312,8 +312,8 @@ $lang = array( 'pt' => 'Negou o consentimento para a transferĂŞncia dos seus atributos para o fornecedor de serviço.', 'pt-br' => 'VocĂŞ nĂŁo deu o consentimento para a transferĂŞncia de seus atributos para o provedor de serviços.', 'tr' => 'Bilgilerinizin servis saÄźlayıcıya gönderilmesi için onay vermediniz.', - ), - 'noconsent_return' => array( + ], + 'noconsent_return' => [ 'no' => 'GĂĄ tilbake til aksept-siden med opplysninger', 'nn' => 'GĂĄ tilbake til aksept-sida for overføring av opplysningar', 'da' => 'GĂĄ tilbage', @@ -330,8 +330,8 @@ $lang = array( 'pt' => 'Voltar Ă página de consentimento', 'pt-br' => 'Retornar a página de consentimento', 'tr' => 'Onay sayfasına geri dön', - ), - 'noconsent_goto_about' => array( + ], + 'noconsent_goto_about' => [ 'no' => 'GĂĄ til informasjonsside om tjenesten', 'nn' => 'GĂĄ til informasjonssida for tenesta', 'da' => 'GĂĄ til side med information om tjenesten', @@ -347,8 +347,8 @@ $lang = array( 'pl' => 'PrzejdĹş do strony informacyjnej dla tego serwisu', 'pt' => 'Ir para página de informação do serviço', 'tr' => 'Servis için bilgi sayfasına git', - ), - 'table_caption' => array( + ], + 'table_caption' => [ 'no' => 'Bruker innformasjon', 'da' => 'Bruger information', 'en' => 'User information', @@ -361,8 +361,8 @@ $lang = array( 'hu' => 'FelhasználĂłi informáciĂłk', 'pt' => 'Informação do utilizador', 'tr' => 'Kullanıcı bilgisi', - ), - 'table_summary' => array( + ], + 'table_summary' => [ 'no' => 'Her listes den innformasjonen om deg som blir send til den tjenesten du er i ferd med ĂĄ logge pĂĄ', 'da' => 'Informationer som vil blive sendt til den service du er ved at logge in pĂĄ', 'en' => 'List the information about you that is about to be transmitted to the service you are going to login to', @@ -374,5 +374,5 @@ $lang = array( 'hu' => 'Ezeket az adatokat fogjuk elkĂĽldeni Ă–nrĹ‘l annak a szolgáltatásnak, ahová be kĂván jelentkezni', 'pt' => 'Listar a informação acerca de si que será enviada para o serviço no qual se está autenticar', 'tr' => 'Girmek istediÄźiniz servise gönderilecek bilginizi listeleyin', - ), -); + ], +]; diff --git a/modules/consent/lib/Auth/Process/Consent.php b/modules/consent/lib/Auth/Process/Consent.php index 7dbacd4a6359f57494cd7d3a79ffcf462cc5a608..f5b6bfc8105732dccc4ed98a80cd2075de87afb1 100644 --- a/modules/consent/lib/Auth/Process/Consent.php +++ b/modules/consent/lib/Auth/Process/Consent.php @@ -23,49 +23,49 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter * * @var string|null */ - private $_focus = null; + private $focus = null; /** * Include attribute values * * @var bool */ - private $_includeValues = false; + private $includeValues = false; /** * Check remember consent * * @var bool */ - private $_checked = false; + private $checked = false; /** * Consent backend storage configuration * * @var \SimpleSAML\Module\consent\Store|null */ - private $_store = null; + private $store = null; /** * Attributes where the value should be hidden * * @var array */ - private $_hiddenAttributes = array(); + private $hiddenAttributes = []; /** * Attributes which should not require consent * * @var array */ - private $_noconsentattributes = array(); + private $noconsentattributes = []; /** * Whether we should show the "about service"-link on the no consent page. * * @var bool */ - private $_showNoConsentAboutService = true; + private $showNoConsentAboutService = true; /** @@ -90,7 +90,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter var_export($config['includeValues'], true).' given.' ); } - $this->_includeValues = $config['includeValues']; + $this->includeValues = $config['includeValues']; } if (array_key_exists('checked', $config)) { @@ -100,17 +100,17 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter var_export($config['checked'], true).' given.' ); } - $this->_checked = $config['checked']; + $this->checked = $config['checked']; } if (array_key_exists('focus', $config)) { - if (!in_array($config['focus'], array('yes', 'no'), true)) { + if (!in_array($config['focus'], ['yes', 'no'], true)) { throw new \SimpleSAML\Error\Exception( 'Consent: focus must be a string with values `yes` or `no`. '. var_export($config['focus'], true).' given.' ); } - $this->_focus = $config['focus']; + $this->focus = $config['focus']; } if (array_key_exists('hiddenAttributes', $config)) { @@ -120,7 +120,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter var_export($config['hiddenAttributes'], true).' given.' ); } - $this->_hiddenAttributes = $config['hiddenAttributes']; + $this->hiddenAttributes = $config['hiddenAttributes']; } if (array_key_exists('attributes.exclude', $config)) { @@ -130,7 +130,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter var_export($config['attributes.exclude'], true).' given.' ); } - $this->_noconsentattributes = $config['attributes.exclude']; + $this->noconsentattributes = $config['attributes.exclude']; } elseif (array_key_exists('noconsentattributes', $config)) { Logger::warning("The 'noconsentattributes' option has been deprecated in favour of 'attributes.exclude'."); if (!is_array($config['noconsentattributes'])) { @@ -139,12 +139,12 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter var_export($config['noconsentattributes'], true).' given.' ); } - $this->_noconsentattributes = $config['noconsentattributes']; + $this->noconsentattributes = $config['noconsentattributes']; } if (array_key_exists('store', $config)) { try { - $this->_store = \SimpleSAML\Module\consent\Store::parseStoreConfig($config['store']); + $this->store = \SimpleSAML\Module\consent\Store::parseStoreConfig($config['store']); } catch (\Exception $e) { Logger::error( 'Consent: Could not create consent storage: '. @@ -157,7 +157,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter if (!is_bool($config['showNoConsentAboutService'])) { throw new \SimpleSAML\Error\Exception('Consent: showNoConsentAboutService must be a boolean.'); } - $this->_showNoConsentAboutService = $config['showNoConsentAboutService']; + $this->showNoConsentAboutService = $config['showNoConsentAboutService']; } } @@ -258,7 +258,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter $state['Source'] = $idpmeta; } - $statsData = array('spEntityID' => $spEntityId); + $statsData = ['spEntityID' => $spEntityId]; // Do not use consent if disabled if (isset($state['Source']['consent.disable']) && @@ -276,14 +276,14 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter return; } - if ($this->_store !== null) { + if ($this->store !== null) { $source = $state['Source']['metadata-set'].'|'.$idpEntityId; $destination = $state['Destination']['metadata-set'].'|'.$spEntityId; $attributes = $state['Attributes']; // Remove attributes that do not require consent foreach ($attributes as $attrkey => $attrval) { - if (in_array($attrkey, $this->_noconsentattributes, true)) { + if (in_array($attrkey, $this->noconsentattributes, true)) { unset($attributes[$attrkey]); } } @@ -294,7 +294,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter $userId = self::getHashedUserID($state['UserID'], $source); $targetedId = self::getTargetedID($state['UserID'], $source, $destination); - $attributeSet = self::getAttributeHash($attributes, $this->_includeValues); + $attributeSet = self::getAttributeHash($attributes, $this->includeValues); Logger::debug( 'Consent: hasConsent() ['.$userId.'|'.$targetedId.'|'. @@ -302,7 +302,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter ); try { - if ($this->_store->hasConsent($userId, $targetedId, $attributeSet)) { + if ($this->store->hasConsent($userId, $targetedId, $attributeSet)) { // Consent already given Logger::stats('consent found'); Stats::log('consent:found', $statsData); @@ -312,7 +312,7 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter Logger::stats('consent notfound'); Stats::log('consent:notfound', $statsData); - $state['consent:store'] = $this->_store; + $state['consent:store'] = $this->store; $state['consent:store.userId'] = $userId; $state['consent:store.destination'] = $targetedId; $state['consent:store.attributeSet'] = $attributeSet; @@ -326,25 +326,25 @@ class Consent extends \SimpleSAML\Auth\ProcessingFilter Stats::log('consent:nostorage', $statsData); } - $state['consent:focus'] = $this->_focus; - $state['consent:checked'] = $this->_checked; - $state['consent:hiddenAttributes'] = $this->_hiddenAttributes; - $state['consent:noconsentattributes'] = $this->_noconsentattributes; - $state['consent:showNoConsentAboutService'] = $this->_showNoConsentAboutService; + $state['consent:focus'] = $this->focus; + $state['consent:checked'] = $this->checked; + $state['consent:hiddenAttributes'] = $this->hiddenAttributes; + $state['consent:noconsentattributes'] = $this->noconsentattributes; + $state['consent:showNoConsentAboutService'] = $this->showNoConsentAboutService; // user interaction necessary. Throw exception on isPassive request if (isset($state['isPassive']) && $state['isPassive'] === true) { Stats::log('consent:nopassive', $statsData); throw new Module\saml\Error\NoPassive( - \SAML2\Constants::STATUS_REQUESTER, - 'Unable to give consent on passive request.' + \SAML2\Constants::STATUS_REQUESTER, + 'Unable to give consent on passive request.' ); } // Save state and redirect $id = \SimpleSAML\Auth\State::saveState($state, 'consent:request'); $url = Module::getModuleURL('consent/getconsent.php'); - Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } diff --git a/modules/consent/lib/Consent/Store/Cookie.php b/modules/consent/lib/Consent/Store/Cookie.php index 52ea5f9520e238fb1d03f2ddf440acb7597c6d83..1a878073525be1850ec912ec36d8bf93b7cc7088 100644 --- a/modules/consent/lib/Consent/Store/Cookie.php +++ b/modules/consent/lib/Consent/Store/Cookie.php @@ -42,7 +42,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store assert(is_string($destinationId)); assert(is_string($attributeSet)); - $cookieName = self::_getCookieName($userId, $destinationId); + $cookieName = self::getCookieName($userId, $destinationId); $data = $userId.':'.$attributeSet.':'.$destinationId; @@ -62,7 +62,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store return false; } - $data = self::_sign($data); + $data = self::sign($data); if ($_COOKIE[$cookieName] !== $data) { \SimpleSAML\Logger::info( @@ -97,13 +97,13 @@ class Cookie extends \SimpleSAML\Module\consent\Store assert(is_string($destinationId)); assert(is_string($attributeSet)); - $name = self::_getCookieName($userId, $destinationId); + $name = self::getCookieName($userId, $destinationId); $value = $userId.':'.$attributeSet.':'.$destinationId; \SimpleSAML\Logger::debug('Consent cookie - Set ['.$value.']'); - $value = self::_sign($value); - $this->_setConsentCookie($name, $value); + $value = self::sign($value); + $this->setConsentCookie($name, $value); } @@ -122,8 +122,8 @@ class Cookie extends \SimpleSAML\Module\consent\Store assert(is_string($userId)); assert(is_string($destinationId)); - $name = self::_getCookieName($userId, $destinationId); - $this->_setConsentCookie($name, null); + $name = self::getCookieName($userId, $destinationId); + $this->setConsentCookie($name, null); } @@ -160,7 +160,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store { assert(is_string($userId)); - $ret = array(); + $ret = []; $cookieNameStart = '\SimpleSAML\Module\consent:'; $cookieNameStartLen = strlen($cookieNameStart); @@ -169,7 +169,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store continue; } - $value = self::_verify($value); + $value = self::verify($value); if ($value === false) { continue; } @@ -204,7 +204,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store * * @return string The signed data. */ - private static function _sign($data) + private static function sign($data) { assert(is_string($data)); @@ -223,7 +223,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store * * @return string|false The data, or false if the signature is invalid. */ - private static function _verify($signedData) + private static function verify($signedData) { assert(is_string($signedData)); @@ -234,7 +234,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store } $data = $data[1]; - $newSignedData = self::_sign($data); + $newSignedData = self::sign($data); if ($newSignedData !== $signedData) { \SimpleSAML\Logger::warning('Consent cookie: Invalid signature.'); return false; @@ -254,7 +254,7 @@ class Cookie extends \SimpleSAML\Module\consent\Store * * @return string The cookie name */ - private static function _getCookieName($userId, $destinationId) + private static function getCookieName($userId, $destinationId) { assert(is_string($userId)); assert(is_string($destinationId)); @@ -271,18 +271,18 @@ class Cookie extends \SimpleSAML\Module\consent\Store * * @return void */ - private function _setConsentCookie($name, $value) + private function setConsentCookie($name, $value) { assert(is_string($name)); assert(is_string($value) || $value === null); $globalConfig = \SimpleSAML\Configuration::getInstance(); - $params = array( + $params = [ 'lifetime' => 7776000, // (90*24*60*60) 'path' => ($globalConfig->getBasePath()), 'httponly' => true, 'secure' => \SimpleSAML\Utils\HTTP::isHTTPS(), - ); + ]; \SimpleSAML\Utils\HTTP::setCookie($name, $value, $params, false); } diff --git a/modules/consent/lib/Consent/Store/Database.php b/modules/consent/lib/Consent/Store/Database.php index 35f438f16716c41004cd4d2f69620638262ec498..a681220209b172f4d7bf4f2a3b4772fd9227584b 100644 --- a/modules/consent/lib/Consent/Store/Database.php +++ b/modules/consent/lib/Consent/Store/Database.php @@ -24,46 +24,46 @@ class Database extends \SimpleSAML\Module\consent\Store /** * DSN for the database. */ - private $_dsn; + private $dsn; /** * The DATETIME SQL function to use */ - private $_dateTime; + private $dateTime; /** * Username for the database. */ - private $_username; + private $username; /** * Password for the database; */ - private $_password; + private $password; /** * Options for the database; */ - private $_options; + private $options; /** * Table with consent. */ - private $_table; + private $table; /** * The timeout of the database connection. * * @var int|null */ - private $_timeout = null; + private $timeout = null; /** * Database handle. * * This variable can't be serialized. */ - private $_db; + private $db; /** @@ -86,49 +86,49 @@ class Database extends \SimpleSAML\Module\consent\Store throw new \Exception('consent:Database - \'dsn\' is supposed to be a string.'); } - $this->_dsn = $config['dsn']; - $this->_dateTime = (0 === strpos($this->_dsn, 'sqlite:')) ? 'DATETIME("NOW")' : 'NOW()'; + $this->dsn = $config['dsn']; + $this->dateTime = (0 === strpos($this->dsn, 'sqlite:')) ? 'DATETIME("NOW")' : 'NOW()'; if (array_key_exists('username', $config)) { if (!is_string($config['username'])) { throw new \Exception('consent:Database - \'username\' is supposed to be a string.'); } - $this->_username = $config['username']; + $this->username = $config['username']; } else { - $this->_username = null; + $this->username = null; } if (array_key_exists('password', $config)) { if (!is_string($config['password'])) { throw new \Exception('consent:Database - \'password\' is supposed to be a string.'); } - $this->_password = $config['password']; + $this->password = $config['password']; } else { - $this->_password = null; + $this->password = null; } if (array_key_exists('options', $config)) { if (!is_array($config['options'])) { throw new \Exception('consent:Database - \'options\' is supposed to be an array.'); } - $this->_options = $config['options']; + $this->options = $config['options']; } else { - $this->_options = null; + $this->options = null; } if (array_key_exists('table', $config)) { if (!is_string($config['table'])) { throw new \Exception('consent:Database - \'table\' is supposed to be a string.'); } - $this->_table = $config['table']; + $this->table = $config['table']; } else { - $this->_table = 'consent'; + $this->table = 'consent'; } if (isset($config['timeout'])) { if (!is_int($config['timeout'])) { throw new \Exception('consent:Database - \'timeout\' is supposed to be an integer.'); } - $this->_timeout = $config['timeout']; + $this->timeout = $config['timeout']; } } @@ -140,14 +140,14 @@ class Database extends \SimpleSAML\Module\consent\Store */ public function __sleep() { - return array( - '_dsn', - '_dateTime', - '_username', - '_password', - '_table', - '_timeout', - ); + return [ + 'dsn', + 'dateTime', + 'username', + 'password', + 'table', + 'timeout', + ]; } @@ -170,11 +170,11 @@ class Database extends \SimpleSAML\Module\consent\Store assert(is_string($destinationId)); assert(is_string($attributeSet)); - $st = $this->_execute( - 'UPDATE '.$this->_table.' '. - 'SET usage_date = '.$this->_dateTime.' '. + $st = $this->execute( + 'UPDATE '.$this->table.' '. + 'SET usage_date = '.$this->dateTime.' '. 'WHERE hashed_user_id = ? AND service_id = ? AND attribute = ?', - array($userId, $destinationId, $attributeSet) + [$userId, $destinationId, $attributeSet] ); if ($st === false) { @@ -211,11 +211,11 @@ class Database extends \SimpleSAML\Module\consent\Store assert(is_string($attributeSet)); // Check for old consent (with different attribute set) - $st = $this->_execute( - 'UPDATE '.$this->_table.' '. - 'SET consent_date = '.$this->_dateTime.', usage_date = '.$this->_dateTime.', attribute = ? '. + $st = $this->execute( + 'UPDATE '.$this->table.' '. + 'SET consent_date = '.$this->dateTime.', usage_date = '.$this->dateTime.', attribute = ? '. 'WHERE hashed_user_id = ? AND service_id = ?', - array($attributeSet, $userId, $destinationId) + [$attributeSet, $userId, $destinationId] ); if ($st === false) { @@ -229,10 +229,10 @@ class Database extends \SimpleSAML\Module\consent\Store } // Add new consent - $st = $this->_execute( - 'INSERT INTO '.$this->_table.' ('.'consent_date, usage_date, hashed_user_id, service_id, attribute'. - ') '.'VALUES ('.$this->_dateTime.', '.$this->_dateTime.', ?, ?, ?)', - array($userId, $destinationId, $attributeSet) + $st = $this->execute( + 'INSERT INTO '.$this->table.' ('.'consent_date, usage_date, hashed_user_id, service_id, attribute'. + ') '.'VALUES ('.$this->dateTime.', '.$this->dateTime.', ?, ?, ?)', + [$userId, $destinationId, $attributeSet] ); if ($st !== false) { @@ -257,23 +257,22 @@ class Database extends \SimpleSAML\Module\consent\Store assert(is_string($userId)); assert(is_string($destinationId)); - $st = $this->_execute( - 'DELETE FROM '.$this->_table.' WHERE hashed_user_id = ? AND service_id = ?;', - array($userId, $destinationId) + $st = $this->execute( + 'DELETE FROM '.$this->table.' WHERE hashed_user_id = ? AND service_id = ?;', + [$userId, $destinationId] ); if ($st === false) { - return; + return 0; } if ($st->rowCount() > 0) { \SimpleSAML\Logger::debug('consent:Database - Deleted consent.'); return $st->rowCount(); - } else { - \SimpleSAML\Logger::warning( - 'consent:Database - Attempted to delete nonexistent consent' - ); } + + \SimpleSAML\Logger::warning('consent:Database - Attempted to delete nonexistent consent'); + return 0; } @@ -288,21 +287,22 @@ class Database extends \SimpleSAML\Module\consent\Store { assert(is_string($userId)); - $st = $this->_execute( - 'DELETE FROM '.$this->_table.' WHERE hashed_user_id = ?', - array($userId) + $st = $this->execute( + 'DELETE FROM '.$this->table.' WHERE hashed_user_id = ?', + [$userId] ); if ($st === false) { - return; + return 0; } if ($st->rowCount() > 0) { \SimpleSAML\Logger::debug('consent:Database - Deleted ('.$st->rowCount().') consent(s).'); return $st->rowCount(); - } else { - \SimpleSAML\Logger::warning('consent:Database - Attempted to delete nonexistent consent'); } + + \SimpleSAML\Logger::warning('consent:Database - Attempted to delete nonexistent consent'); + return 0; } @@ -319,16 +319,16 @@ class Database extends \SimpleSAML\Module\consent\Store { assert(is_string($userId)); - $ret = array(); + $ret = []; - $st = $this->_execute( - 'SELECT service_id, attribute, consent_date, usage_date FROM '.$this->_table. + $st = $this->execute( + 'SELECT service_id, attribute, consent_date, usage_date FROM '.$this->table. ' WHERE hashed_user_id = ?', - array($userId) + [$userId] ); if ($st === false) { - return array(); + return []; } while ($row = $st->fetch(\PDO::FETCH_NUM)) { @@ -350,12 +350,12 @@ class Database extends \SimpleSAML\Module\consent\Store * * @return \PDOStatement|false The statement, or false if execution failed. */ - private function _execute($statement, $parameters) + private function execute($statement, $parameters) { assert(is_string($statement)); assert(is_array($parameters)); - $db = $this->_getDB(); + $db = $this->getDB(); if ($db === false) { return false; } @@ -364,7 +364,7 @@ class Database extends \SimpleSAML\Module\consent\Store if ($st === false) { \SimpleSAML\Logger::error( 'consent:Database - Error preparing statement \''. - $statement.'\': '.self::_formatError($db->errorInfo()) + $statement.'\': '.self::formatError($db->errorInfo()) ); return false; } @@ -372,7 +372,7 @@ class Database extends \SimpleSAML\Module\consent\Store if ($st->execute($parameters) !== true) { \SimpleSAML\Logger::error( 'consent:Database - Error executing statement \''. - $statement.'\': '.self::_formatError($st->errorInfo()) + $statement.'\': '.self::formatError($st->errorInfo()) ); return false; } @@ -393,13 +393,13 @@ class Database extends \SimpleSAML\Module\consent\Store */ public function getStatistics() { - $ret = array(); + $ret = []; // Get total number of consents - $st = $this->_execute('SELECT COUNT(*) AS no FROM '.$this->_table, array()); + $st = $this->execute('SELECT COUNT(*) AS no FROM '.$this->table, []); if ($st === false) { - return array(); + return []; } if ($row = $st->fetch(\PDO::FETCH_NUM)) { @@ -407,14 +407,14 @@ class Database extends \SimpleSAML\Module\consent\Store } // Get total number of users that has given consent - $st = $this->_execute( + $st = $this->execute( 'SELECT COUNT(*) AS no '. - 'FROM (SELECT DISTINCT hashed_user_id FROM '.$this->_table.' ) AS foo', - array() + 'FROM (SELECT DISTINCT hashed_user_id FROM '.$this->table.' ) AS foo', + [] ); if ($st === false) { - return array(); + return []; } if ($row = $st->fetch(\PDO::FETCH_NUM)) { @@ -422,13 +422,13 @@ class Database extends \SimpleSAML\Module\consent\Store } // Get total number of services that has been given consent to - $st = $this->_execute( - 'SELECT COUNT(*) AS no FROM (SELECT DISTINCT service_id FROM '.$this->_table.') AS foo', - array() + $st = $this->execute( + 'SELECT COUNT(*) AS no FROM (SELECT DISTINCT service_id FROM '.$this->table.') AS foo', + [] ); if ($st === false) { - return array(); + return []; } if ($row = $st->fetch(\PDO::FETCH_NUM)) { @@ -444,25 +444,25 @@ class Database extends \SimpleSAML\Module\consent\Store * * @return \PDO|false Database handle, or false if we fail to connect. */ - private function _getDB() + private function getDB() { - if ($this->_db !== null) { - return $this->_db; + if ($this->db !== null) { + return $this->db; } - $driver_options = array(); - if (isset($this->_timeout)) { - $driver_options[\PDO::ATTR_TIMEOUT] = $this->_timeout; + $driver_options = []; + if (isset($this->timeout)) { + $driver_options[\PDO::ATTR_TIMEOUT] = $this->timeout; } - if (isset($this->_options)) { - $this->_options = array_merge($driver_options, $this->_options); + if (isset($this->options)) { + $this->options = array_merge($driver_options, $this->options); } else { - $this->_options = $driver_options; + $this->options = $driver_options; } - $this->_db = new \PDO($this->_dsn, $this->_username, $this->_password, $this->_options); + $this->db = new \PDO($this->dsn, $this->username, $this->password, $this->options); - return $this->_db; + return $this->db; } @@ -475,7 +475,7 @@ class Database extends \SimpleSAML\Module\consent\Store * * @return string Error text. */ - private static function _formatError($error) + private static function formatError($error) { assert(is_array($error)); assert(count($error) >= 3); @@ -491,9 +491,9 @@ class Database extends \SimpleSAML\Module\consent\Store */ public function selftest() { - $st = $this->_execute( - 'SELECT * FROM '.$this->_table.' WHERE hashed_user_id = ? AND service_id = ? AND attribute = ?', - array('test', 'test', 'test') + $st = $this->execute( + 'SELECT * FROM '.$this->table.' WHERE hashed_user_id = ? AND service_id = ? AND attribute = ?', + ['test', 'test', 'test'] ); if ($st === false) { diff --git a/modules/consent/lib/Store.php b/modules/consent/lib/Store.php index 528f2ca16f66ee5e90a950952b52d65d52cd15bf..0e7c612b9e8b8e77124523c40122a735f414d4e4 100644 --- a/modules/consent/lib/Store.php +++ b/modules/consent/lib/Store.php @@ -126,7 +126,7 @@ abstract class Store public static function parseStoreConfig($config) { if (is_string($config)) { - $config = array($config); + $config = [$config]; } if (!is_array($config)) { diff --git a/modules/consent/templates/consentform.php b/modules/consent/templates/consentform.php index 399fa6bedb37c2bcf9a4717c45bec0f99959ee8e..90907e0ed2812bd8654edfa8c10f1b54320b7670 100644 --- a/modules/consent/templates/consentform.php +++ b/modules/consent/templates/consentform.php @@ -19,7 +19,7 @@ $srcName = $this->data['srcName']; $this->data['header'] = $this->t('{consent:consent:consent_header}'); $this->data['head'] = '<link rel="stylesheet" type="text/css" href="'. - SimpleSAML\Module::getModuleURL("consent/assets/consent.css").'" />'."\n"; + SimpleSAML\Module::getModuleURL("consent/assets/css/consent.css").'" />'."\n"; $this->includeAtTemplateBase('includes/header.php'); ?> @@ -59,11 +59,7 @@ if ($this->data['sppp'] !== false) { echo "</p>"; } -echo '<h3 id="attributeheader">'. - $this->t( - '{consent:consent:consent_attributes_header}', - array('SPNAME' => $dstName, 'IDPNAME' => $srcName) - ).'</h3>'; +echo '<h3 id="attributeheader">'.$this->data['consent_attributes_header'].'</h3>'; echo $this->data['attributes_html']; diff --git a/modules/consent/templates/consentform.twig b/modules/consent/templates/consentform.twig index ca07f84f7e6c7e041370a354284aa4d8ef51ff3f..b1433046a9e07af6757ec0453c9b2c14c715f98b 100644 --- a/modules/consent/templates/consentform.twig +++ b/modules/consent/templates/consentform.twig @@ -2,7 +2,7 @@ {% extends "base.twig" %} {% block preload %} -<link rel="stylesheet" type="text/css" href="{{ baseurlpath }}assets/consent.css" /> +<link rel="stylesheet" type="text/css" href="{{ baseurlpath }}assets/css/consent.css" /> {% endblock %} {% block content %} @@ -19,12 +19,12 @@ {% endif %} <input type="hidden" name="StateId" value="{{ stateId }}" /> - <button type="submit" name="yes" class="btn" id="yesbutton">{{ '{consent:consent:yes}'|trans }}</button> + <button type="submit" name="yes" class="btn" id="yesbutton"{%- if autofocus == 'yesbutton' %} autofocus{% endif -%}>{{ '{consent:consent:yes}'|trans }}</button> </form> <form id="consent_no" action="{{ noTarget }}"> <input type="hidden" name="StateId" value="{{ stateId }}" /> - <button type="submit" class="btn" name="no" id="nobutton">{{ '{consent:consent:no}'|trans }}</button> + <button type="submit" class="btn" name="no" id="nobutton"{%- if autofocus == 'nobutton' %} autofocus{% endif -%}>{{ '{consent:consent:no}'|trans }}</button> </form> {% if sppp != false %} diff --git a/modules/consent/www/assets/css/consent.css b/modules/consent/www/assets/css/consent.css new file mode 100644 index 0000000000000000000000000000000000000000..33bef3d64a6c17123c12518e796453e5c1465dd4 --- /dev/null +++ b/modules/consent/www/assets/css/consent.css @@ -0,0 +1,54 @@ +fieldset { + padding: 0px; +} + +fieldset legend { + background: #eee; +} + +h3#attributeheader { + margin: 1.5em 0em 0.5em 0em; +} + +table#table_with_attributes .attrname { + text-align: right; + font-weight: bold; +} + +table#table_with_attributes .attrvalue { + padding-left: 1em; + margin: 0.5em 0em; +} + +table#table_with_attributes tr:last-child td { + border-bottom: none; +} + +table#table_with_attributes img { + border: 1px solid #777; + margin: 4px; +} + +table#table_with_attributes ul { + margin: 0px; + padding-left: 1em; +} + +form#consent_yes { + display: inline; + margin: 0px; + padding: 0px; +} + +form#consent_no { + display: inline; + margin-left: .5em; +} + +.hidden { + display: none; +} + +td.td_odd { + padding: 2em; +} diff --git a/modules/consent/www/getconsent.php b/modules/consent/www/getconsent.php index 2bdfc82b8c4e66e1eb1b5ab02912980625a7223b..d36e5883c3e3e984713cfe105186988e89601206 100644 --- a/modules/consent/www/getconsent.php +++ b/modules/consent/www/getconsent.php @@ -6,11 +6,10 @@ * authorizes the release of attributes. * * @package SimpleSAMLphp - */ -/** - * Explicit instruct consent page to send no-cache header to browsers to make + * + * Explicit instruct consent page to send no-cache header to browsers to make * sure the users attribute information are not store on client disk. - * + * * In an vanilla apache-php installation is the php variables set to: * * session.cache_limiter = nocache @@ -34,7 +33,7 @@ $state = \SimpleSAML\Auth\State::loadState($id, 'consent:request'); if (array_key_exists('core:SP', $state)) { $spentityid = $state['core:SP']; -} else if (array_key_exists('saml:sp:State', $state)) { +} elseif (array_key_exists('saml:sp:State', $state)) { $spentityid = $state['saml:sp:State']['core:SP']; } else { $spentityid = 'UNKNOWN'; @@ -49,15 +48,15 @@ if (array_key_exists('yes', $_REQUEST)) { \SimpleSAML\Logger::stats('consentResponse rememberNot'); } - $statsInfo = array( + $statsInfo = [ 'remember' => array_key_exists('saveconsent', $_REQUEST), - ); + ]; if (isset($state['Destination']['entityid'])) { $statsInfo['spEntityID'] = $state['Destination']['entityid']; } \SimpleSAML\Stats::log('consent:accept', $statsInfo); - if (array_key_exists('consent:store', $state) + if (array_key_exists('consent:store', $state) && array_key_exists('saveconsent', $_REQUEST) && $_REQUEST['saveconsent'] === '1' ) { @@ -69,7 +68,7 @@ if (array_key_exists('yes', $_REQUEST)) { \SimpleSAML\Logger::debug( 'Consent - saveConsent() : ['.$userId.'|'.$targetedId.'|'.$attributeSet.']' - ); + ); try { $store->saveConsent($userId, $targetedId, $attributeSet); } catch (\Exception $e) { @@ -90,9 +89,9 @@ foreach ($attributes as $attrkey => $attrval) { unset($attributes[$attrkey]); } } -$para = array( +$para = [ 'attributes' => &$attributes -); +]; // Reorder attributes according to attributepresentation hooks \SimpleSAML\Module::callHooks('attributepresentation', $para); @@ -120,9 +119,9 @@ $translator = $t->getTranslator(); $t->data['srcMetadata'] = $state['Source']; $t->data['dstMetadata'] = $state['Destination']; $t->data['yesTarget'] = \SimpleSAML\Module::getModuleURL('consent/getconsent.php'); -$t->data['yesData'] = array('StateId' => $id); +$t->data['yesData'] = ['StateId' => $id]; $t->data['noTarget'] = \SimpleSAML\Module::getModuleURL('consent/noconsent.php'); -$t->data['noData'] = array('StateId' => $id); +$t->data['noData'] = ['StateId' => $id]; $t->data['attributes'] = $attributes; $t->data['checked'] = $state['consent:checked']; $t->data['stateId'] = $id; @@ -132,18 +131,18 @@ $dstName = htmlspecialchars(is_array($dstName) ? $translator->t($dstName) : $dst $t->data['consent_attributes_header'] = $translator->t( '{consent:consent:consent_attributes_header}', - array('SPNAME' => $dstName, 'IDPNAME' => $srcName) + ['SPNAME' => $dstName, 'IDPNAME' => $srcName] ); $t->data['consent_accept'] = $translator->t( '{consent:consent:consent_accept}', - array('SPNAME' => $dstName, 'IDPNAME' => $srcName) + ['SPNAME' => $dstName, 'IDPNAME' => $srcName] ); if (array_key_exists('descr_purpose', $state['Destination'])) { $t->data['consent_purpose'] = $translator->t( '{consent:consent:consent_purpose}', - array( + [ 'SPNAME' => $dstName, 'SPDESC' => $translator->getPreferredTranslation( \SimpleSAML\Utils\Arrays::arrayize( @@ -151,7 +150,7 @@ if (array_key_exists('descr_purpose', $state['Destination'])) { 'en' ) ), - ) + ] ); } @@ -169,7 +168,7 @@ if (array_key_exists('privacypolicy', $state['Destination'])) { if ($privacypolicy !== false) { $privacypolicy = str_replace( '%SPENTITYID%', - urlencode($spentityid), + urlencode($spentityid), $privacypolicy ); } @@ -193,7 +192,7 @@ $t->data['usestorage'] = array_key_exists('consent:store', $state); if (array_key_exists('consent:hiddenAttributes', $state)) { $t->data['hiddenAttributes'] = $state['consent:hiddenAttributes']; } else { - $t->data['hiddenAttributes'] = array(); + $t->data['hiddenAttributes'] = []; } $t->data['attributes_html'] = present_attributes($t, $attributes, ''); @@ -214,7 +213,7 @@ function present_attributes($t, $attributes, $nameParent) { $translator = $t->getTranslator(); - $alternate = array('odd', 'even'); + $alternate = ['odd', 'even']; $i = 0; $summary = 'summary="'.$translator->t('{consent:consent:table_summary}').'"'; diff --git a/modules/consent/www/logout.php b/modules/consent/www/logout.php index 0065cbea172eb3c2625e454e8d1fd339995033a0..f84a51bb246d616206137696002c1cda35aeddf9 100644 --- a/modules/consent/www/logout.php +++ b/modules/consent/www/logout.php @@ -10,7 +10,7 @@ if (!array_key_exists('StateId', $_GET)) { } $state = \SimpleSAML\Auth\State::loadState($_GET['StateId'], 'consent:request'); -$state['Responder'] = array('\SimpleSAML\Module\consent\Logout', 'postLogout'); +$state['Responder'] = ['\SimpleSAML\Module\consent\Logout', 'postLogout']; $idp = \SimpleSAML\IdP::getByState($state); $idp->handleLogoutRequest($state, null); diff --git a/modules/consent/www/noconsent.php b/modules/consent/www/noconsent.php index 544f8bd8c00a15743a34215213fdfef77a62d38d..acd6ffc06514c17430e391d6c03d941593899a2e 100644 --- a/modules/consent/www/noconsent.php +++ b/modules/consent/www/noconsent.php @@ -17,12 +17,12 @@ $state = \SimpleSAML\Auth\State::loadState($id, 'consent:request'); $resumeFrom = \SimpleSAML\Module::getModuleURL( 'consent/getconsent.php', - array('StateId' => $id) + ['StateId' => $id] ); $logoutLink = \SimpleSAML\Module::getModuleURL( 'consent/logout.php', - array('StateId' => $id) + ['StateId' => $id] ); $aboutService = null; @@ -32,7 +32,7 @@ if (!isset($state['consent:showNoConsentAboutService']) || $state['consent:showN } } -$statsInfo = array(); +$statsInfo = []; if (isset($state['Destination']['entityid'])) { $statsInfo['spEntityID'] = $state['Destination']['entityid']; } @@ -57,7 +57,7 @@ $t->data['logoutLink'] = $logoutLink; $dstName = htmlspecialchars(is_array($dstName) ? $translator->t($dstName) : $dstName); -$t->data['noconsent_text'] = $translator->t('{consent:consent:noconsent_text}', array('SPNAME' => $dstName)); -$t->data['noconsent_abort'] = $translator->t('{consent:consent:abort}', array('SPNAME' => $dstName)); +$t->data['noconsent_text'] = $translator->t('{consent:consent:noconsent_text}', ['SPNAME' => $dstName]); +$t->data['noconsent_abort'] = $translator->t('{consent:consent:abort}', ['SPNAME' => $dstName]); $t->show(); diff --git a/modules/consentAdmin/config-templates/module_consentAdmin.php b/modules/consentAdmin/config-templates/module_consentAdmin.php index 02fdf8d42009d69a9128b9e068353b7e02715e8d..9c5420387ecc04b26ade1b5661ce814242359d14 100644 --- a/modules/consentAdmin/config-templates/module_consentAdmin.php +++ b/modules/consentAdmin/config-templates/module_consentAdmin.php @@ -5,22 +5,22 @@ * @author Jacob Christiansen, <jach@wayf.dk> * @package SimpleSAMLphp */ -$config = array( +$config = [ /* * Configuration for the database connection. */ - 'consentadmin' => array( + 'consentadmin' => [ 'consent:Database', 'dsn' => 'mysql:host=DBHOST;dbname=DBNAME', 'username' => 'USERNAME', 'password' => 'PASSWORD', - ), + ], // Hash attributes including values or not 'attributes.hash' => true, // If you set attributes.exclude in the consent module, this must match - // 'attributes.exclude' => array(), + // 'attributes.exclude' => [], // Where to direct the user after logout // REMEMBER to prefix with http:// otherwise the relaystate is only appended @@ -32,4 +32,4 @@ $config = array( // Set authority 'authority' => 'saml2', -); +]; diff --git a/modules/consentAdmin/dictionaries/consentadmin.definition.json b/modules/consentAdmin/dictionaries/consentadmin.definition.json index a887cf3b7681cb12db9758f1495e2e035b39a827..01a48eddb226ef703cd0a5699798c73772e27000 100644 --- a/modules/consentAdmin/dictionaries/consentadmin.definition.json +++ b/modules/consentAdmin/dictionaries/consentadmin.definition.json @@ -1,7 +1,4 @@ { - "sp_empty_name": { - "en": "(name not specified)" - }, "sp_empty_description": { "en": "(no description)" }, @@ -62,4 +59,4 @@ "consentadmin_purpose": { "en": "The purpose of the service is" } -} \ No newline at end of file +} diff --git a/modules/consentAdmin/dictionaries/consentadmin.translation.json b/modules/consentAdmin/dictionaries/consentadmin.translation.json index 7a874d0ac9cb77929c6f9d299ac999407680c0b2..18af923572217905c30575593f096aad44162623 100644 --- a/modules/consentAdmin/dictionaries/consentadmin.translation.json +++ b/modules/consentAdmin/dictionaries/consentadmin.translation.json @@ -1,34 +1,4 @@ { - "sp_empty_name": { - "da": "(navn ikke angivet)", - "no": "(navn ikke spesifisert)", - "de": "(Name nicht angegeben)", - "sl": "(brez naziva)", - "pt": "(nome n\u00e3o especificado)", - "sv": "(namn ej angivet)", - "fr": "(nom non indiqu\u00e9)", - "hr": "(naziv nije specificiran)", - "hu": "(nincs n\u00e9v)", - "it": "(nome non specificato)", - "es": "(nombre no especificado)", - "lt": "(pavadinimas nenurodytas)", - "nl": "(naam niet opgegeven)", - "ja": "(\u540d\u524d\u7121\u3057)", - "zh-tw": "(\u672a\u5b9a\u7fa9\u540d\u7a31)", - "nn": "(namn ikkje spesifisert)", - "et": "(nimi m\u00e4\u00e4ramata)", - "he": "(\u05dc\u05d0 \u05e0\u05d9\u05ea\u05df \u05e9\u05dd)", - "zh": "\uff08\u6ca1\u6709\u6307\u5b9a\u540d\u5b57\uff09", - "ar": "\u0627\u0644\u0627\u0633\u0645 \u063a\u064a\u0631 \u0645\u062d\u062f\u062f", - "lv": "(v\u0101rds nav nor\u0101d\u012bts)", - "id": "(Nama tidak diisi)", - "sr": "(ime nije specificirano)", - "ro": "(nu a fost specificat numele)", - "ru": "(\u0438\u043c\u044f \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e)", - "cs": "(jm\u00e9no nespecifikov\u00e1no)", - "eu": "(izena ez da zehaztu)", - "el": "(\u03c7\u03c9\u03c1\u03af\u03c2 \u03cc\u03bd\u03bf\u03bc\u03b1)" - }, "sp_empty_description": { "da": "(ingen beskrivelse)", "no": "(ingen beskrivelse)", diff --git a/modules/consentAdmin/hooks/hook_frontpage.php b/modules/consentAdmin/hooks/hook_frontpage.php index 792e2ff45cc9f9dbffd8dc8c44c9b15a344def71..87edf27d2e41d58fa57f23c12e697612c2c4b9c6 100644 --- a/modules/consentAdmin/hooks/hook_frontpage.php +++ b/modules/consentAdmin/hooks/hook_frontpage.php @@ -10,8 +10,8 @@ function consentAdmin_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['config'][] = array( + $links['config'][] = [ 'href' => SimpleSAML\Module::getModuleURL('consentAdmin/consentAdmin.php'), 'text' => '{core:frontpage:link_consentAdmin}', - ); + ]; } diff --git a/modules/consentAdmin/locales/ar/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/ar/LC_MESSAGES/consentAdmin.po index ed203049a1c3669f338dd9deeda66db2ace19d31..d778277bbbd973ea9b48e4d9d45be983a28cf369 100644 --- a/modules/consentAdmin/locales/ar/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/ar/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "لا ŮŠŮجد ŮصŮ" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "مشغلي الخدمة Ů„" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "الاسم غير Ů…ŘŘŻŘŻ" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "Ů„ŘŘ°Ů Ů…ŮاŮŮ‚ŘŞŮ</h3>الغي صندŮŮ‚ مشغل الخدمة<h3>رŮابط</h3> <ul> <li><a " diff --git a/modules/consentAdmin/locales/cs/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/cs/LC_MESSAGES/consentAdmin.po index 7709b6911b51c29f44ac9425b9e81a8b0f749645..42b3f5277700f88d87b40fc7041f039fecf67bf0 100644 --- a/modules/consentAdmin/locales/cs/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/cs/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(žádnĂ˝ popis)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "PoskytovatelĂ© sluĹľeb pro" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(jmĂ©no nespecifikováno)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Jak smazat vaše povolenĂ</h3> OdznaÄŤte polĂÄŤko odpovĂdajĂcĂ " diff --git a/modules/consentAdmin/locales/da/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/da/LC_MESSAGES/consentAdmin.po index 8961aba8256d658aec74a165ea31c0b1dfac5fb1..bdd2573a1065490cef72ee1eb106c9f952eb0ae2 100644 --- a/modules/consentAdmin/locales/da/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/da/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(ingen beskrivelse)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Service Providers for" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(navn ikke angivet)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>SĂĄdan sletter du et samtykke</h3>Fjern fluebenet ud for tjenesten, " diff --git a/modules/consentAdmin/locales/de/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/de/LC_MESSAGES/consentAdmin.po index 2e53b5ce2cac6344e26fcd5942c89dcff33fddbb..72b0ae0fa94fba55e3b92e7b3a2c030c0b78de71 100644 --- a/modules/consentAdmin/locales/de/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/de/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(keine Beschreibung)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Diensteanbieter fĂĽr" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(Name nicht angegeben)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Wie Sie Ihre Einverständniserklärung löschen</h3> Entfernen Sie das " diff --git a/modules/consentAdmin/locales/el/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/el/LC_MESSAGES/consentAdmin.po index 207fb949db09116809c6fb1aa71512d5679c445e..15e128a24f917975089837dc7d006911fafc8ed6 100644 --- a/modules/consentAdmin/locales/el/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/el/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(χωĎÎŻĎ‚ πεĎιγĎαφή)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "ΠάĎοχοι ΥπηĎεĎιών για" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(χωĎÎŻĎ‚ όνομα)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Î ĎŽĎ‚ να αναιĎÎĎετε τη ĎυγκατάθεĎή Ďας</h3>ΑποεπιλÎξτε Ď„Îż κουτί " diff --git a/modules/consentAdmin/locales/en/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/en/LC_MESSAGES/consentAdmin.po index 9d68f7f24ba110af81afb3da516e9db56563c63e..ea3d3207f8797a56112448c1a83f502544d8d7cd 100644 --- a/modules/consentAdmin/locales/en/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/en/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(no description)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Service Providers for" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(name not specified)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "\n" diff --git a/modules/consentAdmin/locales/es/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/es/LC_MESSAGES/consentAdmin.po index 8ddfa631c742ae1a76aebbe0c935da710a006a49..6d937dde8fbd11e3432a25e23aca819de8925cef 100644 --- a/modules/consentAdmin/locales/es/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/es/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(sin descripciĂłn)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Proveedores de servicio para" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(nombre no especificado)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Como eliminar su consentimiento</h3> Desmarque la opciĂłn " diff --git a/modules/consentAdmin/locales/et/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/et/LC_MESSAGES/consentAdmin.po index 37219898d7f72962d99ed837c73fce14cdcc8dcd..4a815ad5bddb7ad81c3820f8965419c0b8a00233 100644 --- a/modules/consentAdmin/locales/et/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/et/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(kirjeldus puudub)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Teenusepakkujad" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(nimi määramata)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Kuidas eemaldada nõusolekut</h3> Eemalda vastava teenusepakkuja " diff --git a/modules/consentAdmin/locales/eu/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/eu/LC_MESSAGES/consentAdmin.po index 6d67389b76bc15aaf17aaa0df8b9507cc3f4e8d1..adeb050e0426a80810a2b97c469529d8f224343a 100644 --- a/modules/consentAdmin/locales/eu/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/eu/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(deskribapenik gabe)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Zerbitzu hornitzaileak hontarako: " -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(izena ez da zehaztu)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Zure onespena nola ezabatu</h3> Zerbitzu hornitzaileari dagokion " diff --git a/modules/consentAdmin/locales/fr/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/fr/LC_MESSAGES/consentAdmin.po index ca3bde7f1215e6c84a940016d6e13c84c3aafe59..65abab4fd1a305ab9fa691c6799fbab8a4070d80 100644 --- a/modules/consentAdmin/locales/fr/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/fr/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(pas de description)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Fournisseurs de service pour" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(nom non indiquĂ©)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Comment rĂ©voquer un consentement</h3>DĂ©cochez la case correspondante " diff --git a/modules/consentAdmin/locales/he/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/he/LC_MESSAGES/consentAdmin.po index 30a632e9d8898500052c4420d0ddb5e778d66051..4cb1b7703ef9f872146d4b0046b6cc5c7401c04b 100644 --- a/modules/consentAdmin/locales/he/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/he/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(×ין תי×ור)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "ספקי שירות עבור" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(×ś× × ×™×Ş×ź שם)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>×יך להסיר ×ת הסכמתך</h3> לחץ בתיבה המת×ימה לספק השירות " diff --git a/modules/consentAdmin/locales/hr/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/hr/LC_MESSAGES/consentAdmin.po index 46436725170845942314a291a4089488ddafaf94..b7be441fd7c5e13fc64e0b9d049fcd27d56e62c0 100644 --- a/modules/consentAdmin/locales/hr/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/hr/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(nema opisa)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Davatelji usluga za" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(naziv nije specificiran)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Kako obrisati dozvolu</h3> Maknite kvaÄŤicu iz polja koje se odnosi na" diff --git a/modules/consentAdmin/locales/hu/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/hu/LC_MESSAGES/consentAdmin.po index 78b785ca9b07bdf8827a759a2bdefd57d674e93f..51f0166a1313e3fe22cc6bc400707742668ca2be 100644 --- a/modules/consentAdmin/locales/hu/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/hu/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(nincs leĂrás)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "SzolgáltatĂł" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(nincs nĂ©v)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Hogyan kell visszavonni egy hozzájárulást?</h3> A szolgáltatĂłhoz " diff --git a/modules/consentAdmin/locales/id/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/id/LC_MESSAGES/consentAdmin.po index 04468f2620a739789bfd096cf0a00a1da6472808..64e517dbd6b58654d7a3738ace30fb8accd80089 100644 --- a/modules/consentAdmin/locales/id/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/id/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(Tidak ada penjelasan)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Service Provider untuk" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(Nama tidak diisi)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Bagaimana cara menghapus consent anda</h3> Hapus centak pada kotak " diff --git a/modules/consentAdmin/locales/it/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/it/LC_MESSAGES/consentAdmin.po index 6b4875d91ef234dbbf4cbd563febf38cb2dd171a..10b213d142448ecf0ffb5b63a0864c6e889bb019 100644 --- a/modules/consentAdmin/locales/it/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/it/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(nessuna descrizione)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Service provider per" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(nome non specificato)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Come rimuovere il consenso></h3> Togliere il segno di spunta al " diff --git a/modules/consentAdmin/locales/ja/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/ja/LC_MESSAGES/consentAdmin.po index 6cf0c9dc019f10a1f4e00307000fa46134b10a61..5a26c6aa45459759d116c5feef45794524daa12c 100644 --- a/modules/consentAdmin/locales/ja/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/ja/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(č¨čż°ç„ˇă—)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "サăĽă“ă‚ąă—ăăイ〠- " -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(ĺŤĺ‰Ťç„ˇă—)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>承認ă®ĺ‰Šé™¤ć–ąćł•</h3> 該当ă™ă‚‹ă‚µăĽă“ă‚ąă—ăăイă€ă®ăェăクを外ă—ăľă™ă€‚<h3>ăŞăłă‚Ż</h3> <ul> <li><a " diff --git a/modules/consentAdmin/locales/lt/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/lt/LC_MESSAGES/consentAdmin.po index 41e8fb3b0d09f57a617bb267e417be9fe12e7b01..7596d5e822d2e09388136a49a82a403b06322d5f 100644 --- a/modules/consentAdmin/locales/lt/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/lt/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(apibĹ«dinimas nenurodytas)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Paslaugos tiekÄ—jai" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(pavadinimas nenurodytas)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Kaip pašalinti savo leidimÄ…</h3> Panaikinkite paĹľymÄ—jimÄ… ties " diff --git a/modules/consentAdmin/locales/lv/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/lv/LC_MESSAGES/consentAdmin.po index fea6d8bd60879d9a6b63aff98b4b3a1f2d30c3ec..6f5ff436fccd52f22f89e44860a9d7d03abf4a8c 100644 --- a/modules/consentAdmin/locales/lv/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/lv/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(nav apraksta)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Servisa piegÄdÄtÄji priekš" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(vÄrds nav norÄdÄ«ts)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>KÄ dzÄ“st noteikumus</h3> Izņemiet Ä·eksÄ«ti pie atbilstoĹˇÄ servisa " diff --git a/modules/consentAdmin/locales/nb/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/nb/LC_MESSAGES/consentAdmin.po index c6d1c68b309c614fa525c5e00e8c16e8f3157547..d981bba9d2827e2f8b6cb04274cb75b6f7263237 100644 --- a/modules/consentAdmin/locales/nb/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/nb/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(ingen beskrivelse)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Tjenesteleverandører for" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(navn ikke spesifisert)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Hvordan trekke samtykke tilbake</h3> Fjern haken i boksen for gitte " diff --git a/modules/consentAdmin/locales/nl/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/nl/LC_MESSAGES/consentAdmin.po index e763eda1a8dbdb4decca76524ca3d70117c853a6..77c74edc95b9b1b5616238ff9dadb6133771a107 100644 --- a/modules/consentAdmin/locales/nl/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/nl/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(geen omschrijving)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Service Providers voor" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(naam niet opgegeven)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Hoe verwijdert u toestemmingen</h3> Vinkt u het vakje af dat " diff --git a/modules/consentAdmin/locales/nn/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/nn/LC_MESSAGES/consentAdmin.po index 35aba2cd0132416dc9132c35f2a68444877007c5..dcfd7cba639b552d509c9cf1116c7db5571215ad 100644 --- a/modules/consentAdmin/locales/nn/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/nn/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(mangler informasjon)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Tenesteleverandør for " -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(namn ikkje spesifisert)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Korleis dra tilbake samtykke</h3> Fjern haka i boksen for enkelte " diff --git a/modules/consentAdmin/locales/pt/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/pt/LC_MESSAGES/consentAdmin.po index 0673dcb7e9dd1c3eaaf247d63f1ca414429b80b0..85983c36f722c0a1222a87fc79261f044b969a1b 100644 --- a/modules/consentAdmin/locales/pt/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/pt/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(sem descrição)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Fornecedores de Serviços para" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(nome nĂŁo especificado)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Como remover o seu consentimento</h3> Retire a marca correspondente " diff --git a/modules/consentAdmin/locales/ro/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/ro/LC_MESSAGES/consentAdmin.po index e83dbf971376c429f7379b9fc77ae4919ba15f93..6c1943bfc757495f46d83fcf2e76732383d62b77 100644 --- a/modules/consentAdmin/locales/ro/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/ro/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(fÄrÄ descriere)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Furnizori de servicii pentru" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(nu a fost specificat numele)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Cum poate fi anulat acordul dumneavoastrÄ</h3>DebifaČ›i cÄsuČ›a " diff --git a/modules/consentAdmin/locales/ru/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/ru/LC_MESSAGES/consentAdmin.po index 9169cfd9130b0f950e37357b677c460e435cff4b..a641ee0e4cc58939b9aef9aea5f0da0a36d8cce7 100644 --- a/modules/consentAdmin/locales/ru/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/ru/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(опиŃание отŃŃŃ‚ŃтвŃет)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "ĐˇĐµŃ€Đ˛Đ¸Ń ĐżŃ€ĐľĐ˛Đ°ĐąĐ´ĐµŃ€Ń‹ для" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(имя не Ńказано)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Как Ńдалить ваŃе ŃоглаŃие</h3> Снимите выделение Ń ŃĐµŃ€Đ˛Đ¸Ń ĐżŃ€ĐľĐ˛Đ°ĐąĐ´ĐµŃ€Đ° " diff --git a/modules/consentAdmin/locales/sl/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/sl/LC_MESSAGES/consentAdmin.po index 7afe72a12de1174e0cd4acc94ccc563b8b1e32cb..915d1669df449f9c89a576b2a8e74040ad42808c 100644 --- a/modules/consentAdmin/locales/sl/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/sl/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(brez opisa)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Ponudniki storitev za" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(brez naziva)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Kako razveljavim dano privolitev?</h3> Odstranite kljukico pred " diff --git a/modules/consentAdmin/locales/sr/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/sr/LC_MESSAGES/consentAdmin.po index 5cd0b78871f939ea3419e2bbbec6906e409f6d5a..6099ce86fc2b0291084bfe30dc98fda6b3834e51 100644 --- a/modules/consentAdmin/locales/sr/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/sr/LC_MESSAGES/consentAdmin.po @@ -55,9 +55,6 @@ msgstr "(nema opisa)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Davaoci Servisa za" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(ime nije specificirano)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Kako obrisati dozvolu</h3> Uklonite kvaÄŤicu iz polja koje se odnosi " diff --git a/modules/consentAdmin/locales/sv/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/sv/LC_MESSAGES/consentAdmin.po index d825178b11084d6263753a422eb21332b9754a23..6777d22f6b70fbd554d3866d917683109ca50dea 100644 --- a/modules/consentAdmin/locales/sv/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/sv/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(ingen beskrivning)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "Tjänsteleverantörer för" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(namn ej angivet)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>Hur du tar bort ditt samtycke</h3> Ta bort markeringen i rutan " diff --git a/modules/consentAdmin/locales/zh-tw/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/zh-tw/LC_MESSAGES/consentAdmin.po index b7d2e43bea97dfd1f6777ed056b0f36662932f44..79766547053c53e48b0d5ad4390f0e4893e05be0 100644 --- a/modules/consentAdmin/locales/zh-tw/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/zh-tw/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "(無描述)" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "服務ćŹäľ›č€…çš„" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "(未定義ĺŤç¨±)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>在這ĺŞé™¤ć‚¨çš„ćŽć¬Š</h3> 取ć¶ĺ‹ľé¸ćśŤĺ‹™ćŹäľ›č€…ĺ°Ťć‡‰çš„ć ¸ĺŹ–ć–ąĺˇŠ <h3>連çµ</h3> <ul> <li><a " diff --git a/modules/consentAdmin/locales/zh/LC_MESSAGES/consentAdmin.po b/modules/consentAdmin/locales/zh/LC_MESSAGES/consentAdmin.po index 0a3b247785351bba5d0793d8c792aa76bcd5fbfa..ab6ab8d229baa7f56d50013f391ffb47c212f4e6 100644 --- a/modules/consentAdmin/locales/zh/LC_MESSAGES/consentAdmin.po +++ b/modules/consentAdmin/locales/zh/LC_MESSAGES/consentAdmin.po @@ -54,9 +54,6 @@ msgstr "ďĽć˛ˇćś‰ćŹŹčż°ďĽ‰" msgid "{consentAdmin:consentadmin:service_providers_for}" msgstr "服务ćŹäľ›ĺ•†ćśŤĺŠˇäşŽ" -msgid "{consentAdmin:consentadmin:sp_empty_name}" -msgstr "ďĽć˛ˇćś‰ćŚ‡ĺ®šĺŤĺ—)" - msgid "{consentAdmin:consentadmin:consentadmin_description2}" msgstr "" "<h3>如何ĺ é™¤ä˝ çš„č®¸ĺŹŻ</h3>反选相应的SP选择框<h3>Links</h3> <ul> <li><a " diff --git a/modules/consentAdmin/templates/consentadmin.php b/modules/consentAdmin/templates/consentadmin.php index b0a5b21bd5bdcb84961e9316b09c6748a6d00363..e8c3bcc839735c465ff979ab1a9994eb21c93995 100644 --- a/modules/consentAdmin/templates/consentadmin.php +++ b/modules/consentAdmin/templates/consentadmin.php @@ -1,7 +1,8 @@ -<?php - $this->data['head'] = '<link rel="stylesheet" type="text/css" href="'.SimpleSAML\Module::getModuleURL("consentAdmin/assets/css/consentAdmin.css").'" />'."\n"; - $this->data['head'] .= '<script type="text/javascript" src="'.SimpleSAML\Module::getModuleURL("consentAdmin/assets/js/consentAdmin.js").'"></script>'; - $this->data['head'] .= '<script type="text/javascript" src="'.SimpleSAML\Module::getModuleURL("consentAdmin/assets/js/consentSimpleAjax.js").'"></script>'; +<?php + $this->data['head'] = '<link rel="stylesheet" type="text/css" href="'. + SimpleSAML\Module::getModuleURL("consentAdmin/assets/css/consentAdmin.css").'" />'."\n"; + $this->data['head'] .= '<script type="text/javascript" src="'. + SimpleSAML\Module::getModuleURL("consentAdmin/assets/js/consentAdmin.js").'"></script>'; // default theme $this->includeAtTemplateBase('includes/header.php'); ?> @@ -13,7 +14,7 @@ <table> <tr> <th width="80%"><?php echo $this->t('{consentAdmin:consentadmin:service_provider_header}') ?></th> - <th width="140"><?php echo $this->t('{consentAdmin:consentadmin:status_header}') ?></th> + <th><?php echo $this->t('{consentAdmin:consentadmin:status_header}') ?></th> </tr> <?php $spList = $this->data['spList']; @@ -22,14 +23,13 @@ $hide_text = $this->t('{consentAdmin:consentadmin:hide}'); $attributes_text = $this->t('{consentAdmin:consentadmin:attributes_text}'); foreach ($spList as $spName => $spValues) { - $this->getTranslator()->includeInlineTranslation('spname', $spValues['name']); - $this->getTranslator()->includeInlineTranslation('spdescription', $spValues['description']); if (!is_null($spValues['serviceurl'])) { - $htmlSpName = '<a href="'.$spValues['serviceurl'].'" style="color: black; font-weight: bold;">'.htmlspecialchars($this->t('spname', array(), false, true)).'</a>'; + $htmlSpName = '<a class="serviceUrl" href="'.$spValues['serviceurl'].'">'. + htmlspecialchars($spValues['name']).'</a>'; } else { - $htmlSpName = htmlspecialchars($this->t('spname', array(), false, true)); + $htmlSpName = htmlspecialchars($spValues['name']); } - $spDescription = htmlspecialchars($this->t('spdescription', array(), false, true)); + $spDescription = htmlspecialchars($spValues['description']); $checkedAttr = $spValues['consentStatus'] == 'ok' ? 'checked="checked"' : ''; $consentValue = $spValues['consentValue']; $consentText = $spValues['consentStatus'] == 'changed' ? "attributes has changed" : ""; @@ -38,8 +38,11 @@ <tr class="$row_class"> <td> <table> - <tr class="$row_class"><td><span class='caSPName'><span title='$spDescription'>$htmlSpName</span> <span style="font-size: 80%;"onclick="javascript:toggleShowAttributes('$show_spid');"><span id='showing_$show_spid'>$show_text</span><span id='hiding_$show_spid' style='display:none;'>$hide_text</span>$attributes_text</span></span></td></tr> - <tr><td colspan="2" class="caAttributes"><div id="attributes_$show_spid" style="display: none;"> + <tr class="$row_class"> + <td><span class='caSPName'><span title='$spDescription'>$htmlSpName</span>  + <span class="show_hide" id="show_hide_$show_spid"><span id='showing_$show_spid'>$show_text</span> + <span id='hiding_$show_spid'>$hide_text</span> $attributes_text</span></span></td></tr> + <tr><td colspan="2" class="caAttributes"><div id="attributes_$show_spid"> TRSTART; $attributes = $spValues['attributes_by_sp']; if ($this->data['showDescription']) { @@ -47,12 +50,7 @@ TRSTART; } echo "\n<ul>\n"; foreach ($attributes as $name => $value) { - - if (isset($this->data['attribute_'.htmlspecialchars(strtolower($name))])) { - $name = $this->data['attribute_'.htmlspecialchars(strtolower($name))]; - } - $name = $this->getTranslator()->getAttributeTranslation($name); // translate - if (sizeof($value) > 1) { + if (sizeof($value) > 1) { echo "<li>".htmlspecialchars($name).":\n<ul>\n"; foreach ($value as $v) { echo '<li>'.htmlspecialchars($v)."</li>\n"; @@ -68,7 +66,9 @@ TRSTART; </table> </td> -<td class='caAllowed'><input onclick="javascript:checkConsent(this.value, $show_spid, this.checked)" value='$consentValue' type='checkbox' $checkedAttr /><span id="consentText$show_spid">$consentText</span></td> +<td class='caAllowed'> + <input id="checkbox_$show_spid" class="checkbox" value='$consentValue' type='checkbox' $checkedAttr /> + <span id="consentText_$show_spid">$consentText</span></td> TRSTART; echo "</tr>\n"; $show_spid++; @@ -80,7 +80,11 @@ TRSTART; <?php echo $this->t('{consentAdmin:consentadmin:consentadmin_description2}') ?> </p> <h2>Logout</h2> - - <p><a href="<?php echo \SimpleSAML\Module::getModuleURL('consentAdmin/consentAdmin.php', array('logout' => 1)); ?>">Logout</a></p> + <p> + <a href=" + <?php + echo \SimpleSAML\Module::getModuleURL('consentAdmin/consentAdmin.php', ['logout' => 1]); + ?>">Logout</a> + </p> <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/consentAdmin/templates/consentadmin.twig b/modules/consentAdmin/templates/consentadmin.twig new file mode 100644 index 0000000000000000000000000000000000000000..d27b8a63d399432c22585deb97e35d6aa7f54156 --- /dev/null +++ b/modules/consentAdmin/templates/consentadmin.twig @@ -0,0 +1,82 @@ +{% set pagetitle = '{consentAdmin:consentadmin:consentadmin_header}'|trans %} +{% extends "base.twig" %} + +{% block preload %} +<link rel="stylesheet" type="text/css" href="{{ basepathurl }}assets/css/consentAdmin.css" /> +{% endblock %} + +{% block postload %} +<script src="{{ baseurlpath }}assets/js/consentAdmin.js"></script> +{% endblock %} + +{% block content %} + +<h2>{{ '{consentAdmin:consentadmin:consentadmin_header}'|trans }}</h2> +<p>{{ '{consentAdmin:consentadmin:consentadmin_description1}'|trans }}</p> + +<table> + <tr> + <th colspan="2" width="80%">{{ '{consentAdmin:consentadmin:service_provider_header}'|trans }}</th> + <th width="140">{{ '{consentAdmin:consentadmin:status_header}'|trans }}</th> + </tr> + +{% for spName, spValues in spList %} + + {% if loop.index0 % 2 == 0 %} + {% set rowClass = 'row0' %} + {% else %} + {% set rowClass = 'row1' %} + {% endif %} + + <tr class="{{ rowClass }}"> + <td> + <span class='caSPName'> + <span title='{{ spValues.description|escape('html') }}'> + {% if spValues.serviceurl is defined %} + {{ spValues.name|escape('html') }} + {% else %} + <a class="serviceUrl" href="{{ spValues.serviceurl }}">{{ spValues.name|escape('html') }}</a> + {% endif %} + </span> + <span class="show_hide" id="show_hide_{{ loop.index0 }}"> + <span id="showing_{{ loop.index0 }}">{{ '{consentAdmin:consentadmin:show}'|trans }}</span> + <span id="hiding_{{ loop.index0 }}">{{ '{consentAdmin:consentadmin:hide}'|trans }}</span> + {{ '{consentAdmin:consentadmin:attributes_text}'|trans }} + </span> + </span> + </td> + <td class="caAttributes"> + <div id="attributes_{{ loop.index0 }}"> + {% if showDescription %} + <p>{{ '{consentAdmin:consentadmin:consentadmin_purpose}'|trans }}{{ spValues.description|escape('html') }}</p> + {% endif %} + <ul> + {% for attrName, attrValue in spValues.attributes_by_sp %} + {% if attrValue|length > 1 %} + <li>{{ attrName|escape('html') }}: + <ul> + {% for valKey, value in attrValue %} + <li>{{ value|escape('html') }}</li> + {% endfor %} + </ul> + </li> + {% else %} + <li>{{ attrName|escape('html') }}: {{ attrValue|first|escape('html') }}</li> + {% endif %} + {% endfor %} + </ul> + </div> + </td> + <td class="caAllowed"> + <input class="checkbox" id="checkbox_{{ loop.index0 }}" value='{{ spValues.consentValue }}' type='checkbox'{% if spValues.consentStatus == 'ok'%} checked="checked"{% endif %} /><span id="consentText_{{ loop.index0 }}">{% if spValues.consentStatus == 'changed' %}attributes has changed{% endif %}</span> + </td> + </tr> +{% endfor %} +</table> + +<p>{{ '{consentAdmin:consentadmin:consentadmin_description2}'|trans|raw }}</p> + +<h2>Logout</h2> +<p><a href="{{ baseurlpath }}consentAdmin.php?logout=1">Logout</a></p> + +{% endblock %} diff --git a/modules/consentAdmin/templates/consentadminajax.php b/modules/consentAdmin/templates/consentadminajax.php index f6d54c72dba3b5641842f0798d8cdd967714430c..c8520b085576ddfdde6850fd8920f5566a022d2d 100644 --- a/modules/consentAdmin/templates/consentadminajax.php +++ b/modules/consentAdmin/templates/consentadminajax.php @@ -1,2 +1,2 @@ -<?php +<?php echo $res; diff --git a/modules/consentAdmin/www/assets/css/consentAdmin.css b/modules/consentAdmin/www/assets/css/consentAdmin.css index 86735025420d0b54880d7d0971d430b12c6200a9..94c4a190c4c796224a8ad9a7c9ed4b6449552a9f 100644 --- a/modules/consentAdmin/www/assets/css/consentAdmin.css +++ b/modules/consentAdmin/www/assets/css/consentAdmin.css @@ -20,3 +20,20 @@ tr.row1 td { a.orange { color: #ffd633; } + +span.show_hide { + font-size: 80%; +} + +a.serviceUrl { + color: black; + font-weight: bold; +} + +span[id^='hiding_'], span[id*='hiding_'] { + display: none; +} + +div[id^='attributes_'], div[id*='attributes_'] { + display: none; +} diff --git a/modules/consentAdmin/www/assets/js/consentAdmin.js b/modules/consentAdmin/www/assets/js/consentAdmin.js index cfe0fb71ae4148f0e12cef49453901896b67d971..59cf4e17b4bbf471ed32249df7df163e45be1368 100644 --- a/modules/consentAdmin/www/assets/js/consentAdmin.js +++ b/modules/consentAdmin/www/assets/js/consentAdmin.js @@ -1,3 +1,79 @@ -function setConsentText(consentStatus, show_spid) { - document.getElementById("consentText" + show_spid).innerHTML = consentStatus; +var xmlHttp; + +function checkConsent() +{ + var show_spid = this.id.charAt(this.id.length-1); + var checkbox = document.getElementById("checkbox_"+show_spid); + + xmlHttp = GetXmlHttpObject() + if (xmlHttp == null) { + alert("Browser does not support HTTP Request") + return + } + + var url = "consentAdmin.php" + url = url+"?cv="+checkbox.value + url = url+"&action="+checkbox.checked + url = url+"&sid="+Math.random() + + xmlHttp.onreadystatechange = function () { + if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { + document.getElementById("consentText_" + show_spid).innerHTML = xmlHttp.responseText; + } + } + + xmlHttp.open("GET", url, true) + xmlHttp.send(null) } + +// This function creates an XMLHttpRequest +function GetXmlHttpObject() +{ + var xmlHttp = null; + try { + // Firefox, Opera 8.0+, Safari + xmlHttp = new XMLHttpRequest(); + } catch (e) { + //Internet Explorer + try { + xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); + } + } + return xmlHttp; +} + +function toggleShowAttributes() +{ + var show_spid = this.id.charAt(this.id.length-1); + + var disp = document.getElementById('attributes_' + show_spid); + var showing = document.getElementById('showing_' + show_spid); + var hiding = document.getElementById('hiding_' + show_spid); + + disp.style.display = (disp.style.display == 'none' ? 'block' : 'none'); + showing.style.display = (disp.style.display == 'none' ? 'inline' : 'none'); + hiding.style.display = (disp.style.display == 'none' ? 'none' : 'inline'); +} + +document.addEventListener( + 'DOMContentLoaded', + function () { + var show_hide = document.getElementsByClassName("show_hide"); + for (var i = 0; i < show_hide.length; i++) { + show_hide[i].addEventListener( + 'click', + toggleShowAttributes + ); + } + + var checkbox = document.getElementsByClassName("checkbox"); + for (var i = 0; i < checkbox.length; i++) { + checkbox[i].addEventListener( + 'click', + checkConsent + ); + } + } +); diff --git a/modules/consentAdmin/www/assets/js/consentSimpleAjax.js b/modules/consentAdmin/www/assets/js/consentSimpleAjax.js deleted file mode 100644 index 7ea896c630fa05a2f269330d63f7d70a4837232f..0000000000000000000000000000000000000000 --- a/modules/consentAdmin/www/assets/js/consentSimpleAjax.js +++ /dev/null @@ -1,70 +0,0 @@ -var xmlHttp; - -function checkConsent(consentValue, show_spid, checkAction) -{ - xmlHttp=GetXmlHttpObject() - if (xmlHttp==null) { - alert ("Browser does not support HTTP Request") - - return - } - - var url="consentAdmin.php" - url=url+"?cv="+consentValue - url=url+"&action="+checkAction - url=url+"&sid="+Math.random() - xmlHttp.onreadystatechange=function() { - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - setConsentText(xmlHttp.responseText, show_spid); - } -} - - xmlHttp.open("GET",url,true) - xmlHttp.send(null) -} - -// This function will be automaticly called when the Ajax call is done returning data -function stateChanged() { - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - //Alert("Status of consent:" + xmlHttp.responseText ); - } -} - -// This function creates an XMLHttpRequest -function GetXmlHttpObject() { - var xmlHttp=null; - try - { - // Firefox, Opera 8.0+, Safari - xmlHttp=new XMLHttpRequest(); - } - catch (e) - { - //Internet Explorer - try - { - xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) - { - xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); - } - } - - return xmlHttp; -} - -function toggleShowAttributes(show_spid) { - var disp = document.getElementById('attributes_' + show_spid); - //var showhide = document.getElementById('showhide_' + show_spid); - var showing = document.getElementById('showing_' + show_spid); - var hiding = document.getElementById('hiding_' + show_spid); - - disp.style.display = (disp.style.display == 'none' ? 'block' : 'none'); - //showhide.innerHTML = (disp.style.display == 'none' ? 'Show' : 'Hide') - showing.style.display = (disp.style.display == 'none' ? 'inline' : 'none'); - hiding.style.display = (disp.style.display == 'none' ? 'none' : 'inline'); - //alert('hiding display'+hiding.display); -} diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php index 5477786c3951eba333d4cdf95f487259257f895a..17a091d0871c7a32efdc150c074f7daaaeb8a3c3 100644 --- a/modules/consentAdmin/www/consentAdmin.php +++ b/modules/consentAdmin/www/consentAdmin.php @@ -23,9 +23,8 @@ function driveProcessingChain( $attributes, $userid, $hashAttributes = false, - $excludeAttributes = array() -) -{ + $excludeAttributes = [] +) { /* * Create a new processing chain */ @@ -35,14 +34,14 @@ function driveProcessingChain( * Construct the state. * REMEMBER: Do not set Return URL if you are calling processStatePassive */ - $authProcState = array( + $authProcState = [ 'Attributes' => $attributes, 'Destination' => $sp_metadata, 'SPMetadata' => $sp_metadata, 'Source' => $idp_metadata, 'IdPMetadata' => $idp_metadata, 'isPassive' => true, - ); + ]; /* we're being bridged, so add that info to the state */ if (strpos($source, '-idp-remote|') !== false) { $authProcState['saml:sp:IdP'] = substr($source, strpos($source, '|') + 1); @@ -75,7 +74,7 @@ function driveProcessingChain( \SimpleSAML\Logger::info('consentAdmin: attribute: '.$attribute_hash); // Return values - return array($targeted_id, $attribute_hash, $attributes); + return [$targeted_id, $attribute_hash, $attributes]; } // Get config object @@ -93,7 +92,7 @@ if (array_key_exists('logout', $_REQUEST)) { $hashAttributes = $cA_config->getValue('attributes.hash'); -$excludeAttributes = $cA_config->getValue('attributes.exclude', array()); +$excludeAttributes = $cA_config->getValue('attributes.exclude', []); // Check if valid local session exists $as->requireAuth(); @@ -122,7 +121,11 @@ if ($as->getAuthData('saml:sp:IdP') !== null) { } // Get user ID -$userid_attributename = (isset($idp_metadata['userid.attribute']) && is_string($idp_metadata['userid.attribute'])) ? $idp_metadata['userid.attribute'] : 'eduPersonPrincipalName'; +if (isset($idp_metadata['userid.attribute']) && is_string($idp_metadata['userid.attribute'])) { + $userid_attributename = $idp_metadata['userid.attribute']; +} else { + $userid_attributename = 'eduPersonPrincipalName'; +} $userids = $attributes[$userid_attributename]; @@ -150,7 +153,7 @@ if (!empty($_GET['action'])) { // Remove services, whitch have consent disabled if (isset($idp_metadata['consent.disable'])) { - foreach ($idp_metadata['consent.disable'] AS $disable) { + foreach ($idp_metadata['consent.disable'] as $disable) { if (array_key_exists($disable, $all_sp_metadata)) { unset($all_sp_metadata[$disable]); } @@ -168,14 +171,26 @@ $hashed_user_id = \SimpleSAML\Module\consent\Auth\Process\Consent::getHashedUser // If a checkbox have been clicked if ($action !== null && $sp_entityid !== null) { // init template to enable translation of status messages - $template = new \SimpleSAML\XHTML\Template($config, 'consentAdmin:consentadminajax.php', 'consentAdmin:consentadmin'); + $template = new \SimpleSAML\XHTML\Template( + $config, + 'consentAdmin:consentadminajax.php', + 'consentAdmin:consentadmin' + ); // Get SP metadata $sp_metadata = $metadata->getMetaData($sp_entityid, 'saml20-sp-remote'); // Run AuthProc filters - list($targeted_id, $attribute_hash, $attributes_new) = driveProcessingChain($idp_metadata, $source, $sp_metadata, - $sp_entityid, $attributes, $userid, $hashAttributes, $excludeAttributes); + list($targeted_id, $attribute_hash, $attributes_new) = driveProcessingChain( + $idp_metadata, + $source, + $sp_metadata, + $sp_entityid, + $attributes, + $userid, + $hashAttributes, + $excludeAttributes + ); // Add a consent (or update if attributes have changed and old consent for SP and IdP exists) if ($action == 'true') { @@ -208,18 +223,18 @@ if ($action !== null && $sp_entityid !== null) { $user_consent_list = $consent_storage->getConsents($hashed_user_id); // Parse list of consents -$user_consent = array(); +$user_consent = []; foreach ($user_consent_list as $c) { $user_consent[$c[0]] = $c[1]; } -$template_sp_content = array(); +$template_sp_content = []; // Init template $template = new \SimpleSAML\XHTML\Template($config, 'consentAdmin:consentadmin.php', 'consentAdmin:consentadmin'); $translator = $template->getTranslator(); $translator->includeLanguageFile('attributes'); // attribute listings translated by this dictionary -$sp_empty_name = $translator->getTag('sp_empty_name'); + $sp_empty_description = $translator->getTag('sp_empty_description'); // Process consents for all SP @@ -228,8 +243,27 @@ foreach ($all_sp_metadata as $sp_entityid => $sp_values) { $sp_metadata = $metadata->getMetaData($sp_entityid, 'saml20-sp-remote'); // Run attribute filters - list($targeted_id, $attribute_hash, $attributes_new) = driveProcessingChain($idp_metadata, $source, $sp_metadata, - $sp_entityid, $attributes, $userid, $hashAttributes, $excludeAttributes); + list($targeted_id, $attribute_hash, $attributes_new) = driveProcessingChain( + $idp_metadata, + $source, + $sp_metadata, + $sp_entityid, + $attributes, + $userid, + $hashAttributes, + $excludeAttributes + ); + + // Translate attribute-names + foreach ($attributes_new as $orig_name => $value) { + if (isset($template->data['attribute_'.htmlspecialchars(strtolower($orig_name))])) { + $old_name = $template->data['attribute_'.htmlspecialchars(strtolower($orig_name))]; + } + $name = $translator->getAttributeTranslation(strtolower($orig_name)); // translate + + $attributes_new[$name] = $value; + unset($attributes_new[$orig_name]); + } // Check if consent exists if (array_key_exists($targeted_id, $user_consent)) { @@ -255,7 +289,7 @@ foreach ($all_sp_metadata as $sp_entityid => $sp_values) { } elseif (isset($sp_values['OrganizationDisplayName']) && is_array($sp_values['OrganizationDisplayName'])) { $sp_name = $sp_metadata['OrganizationDisplayName']; } else { - $sp_name = $sp_empty_name; + $sp_name = $sp_entityid; } } @@ -269,8 +303,15 @@ foreach ($all_sp_metadata as $sp_entityid => $sp_values) { // Add a URL to the service if present in metadata $sp_service_url = isset($sp_metadata['ServiceURL']) ? $sp_metadata['ServiceURL'] : null; + // Translate SP name and description + $translator->includeInlineTranslation('spname', $sp_name); + $translator->includeInlineTranslation('spdescription', $sp_description); + + $sp_name = $translator->getPreferredTranslation($translator->getTag('spname')); + $sp_description = $translator->getPreferredTranslation($translator->getTag('spdescription')); + // Fill out array for the template - $sp_list[$sp_entityid] = array( + $sp_list[$sp_entityid] = [ 'spentityid' => $sp_entityid, 'name' => $sp_name, 'description' => $sp_description, @@ -278,7 +319,7 @@ foreach ($all_sp_metadata as $sp_entityid => $sp_values) { 'consentValue' => $sp_entityid, 'attributes_by_sp' => $attributes_new, 'serviceurl' => $sp_service_url, - ); + ]; } $template->data['header'] = 'Consent Administration'; diff --git a/modules/core/dictionaries/frontpage.definition.json b/modules/core/dictionaries/frontpage.definition.json index c470b5ba82bed86ce9c485f8b80fa007fe5b574f..bb5b229a8b7548462dcc06fb8cf08a0013b01715 100644 --- a/modules/core/dictionaries/frontpage.definition.json +++ b/modules/core/dictionaries/frontpage.definition.json @@ -17,12 +17,6 @@ "checkphp": { "en": "Checking your PHP installation" }, - "about_header": { - "en": "About SimpleSAMLphp" - }, - "about_text": { - "en": "This SimpleSAMLphp thing is pretty cool, where can I read more about it? You can find more information about it at the <a href=\"https:\/\/simplesamlphp.org\/\">SimpleSAMLphp web page <\/a> over at <a href=\"http:\/\/uninett.no\">UNINETT<\/a>." - }, "required": { "en": "Required" }, @@ -137,6 +131,9 @@ "loggedin_as_admin": { "en": "You are logged in as administrator" }, + "logout": { + "en": "Logout" + }, "auth": { "en": "Authentication" }, diff --git a/modules/core/dictionaries/frontpage.translation.json b/modules/core/dictionaries/frontpage.translation.json index 13337fd263ec07c09c334032650f68ef4bc73a41..0cb5eed172acb3f95e6c212331a4e31ddc3025c4 100644 --- a/modules/core/dictionaries/frontpage.translation.json +++ b/modules/core/dictionaries/frontpage.translation.json @@ -174,76 +174,6 @@ "ro": "Verificarea instal\u0103rii PHP", "el": "\u0388\u03bb\u03b5\u03b3\u03c7\u03bf\u03c2 \u03b5\u03b3\u03ba\u03b1\u03c4\u03ac\u03c3\u03c4\u03b1\u03c3\u03b7\u03c2 PHP" }, - "about_header": { - "no": "Om SimpleSAMLphp", - "nn": "Om SimpleSAMLphp", - "sv": "Om SimpleSAMLphp", - "es": "Sobre SimpleSAMLphp", - "fr": "\u00c0 propos de SimpleSAMLphp", - "de": "\u00dcber SimpleSAMLphp", - "nl": "Over SimpleSAMLphp", - "lb": "Iwwert SimpleSAMLphp", - "sl": "O SimpleSAMLphp", - "da": "Om SimpleSAMLphp", - "hr": "O programskom alatu SimpleSAMLphp", - "hu": "A SimpleSAMLphp-r\u00f3l b\u0151vebben", - "fi": "SimpleSAMLphp:st\u00e4", - "pt-br": "Sobre o SimpleSAMLphp", - "pt": "Sobre o SimpleSAMLphp", - "pl": "O SimpleSAMLphp", - "cs": "O aplikaci SimpleSAMLphp", - "eu": "SimpleSAMLphp-ari buruz", - "tr": "SimpleSAMLphp hakk\u0131nda", - "it": "A proposito di SimpleSAMLphp", - "lt": "Apie SimpleSAMLphp", - "ja": "SimpleSAMLphp \u306b\u3064\u3044\u3066", - "zh-tw": "\u6709\u95dc SimpleSAMLphp", - "ru": "\u041e SimpleSAMLphp", - "et": "Teave SimpleSAMLphp kohta", - "he": "\u05d0\u05d5\u05d3\u05d5\u05ea SimpleSAMLphp", - "zh": "\u5173\u4e8eSimpleSAMLphp", - "ar": "\u0639\u0646 SimpleSAMLphp", - "id": "Tentang SimpleSAMLphp", - "lv": "Par SimpleSAMLphp", - "sr": "O SimpleSAMLphp-u", - "ro": "Despre SimpleSAMLphp", - "el": "\u03a3\u03c7\u03b5\u03c4\u03b9\u03ba\u03ac \u03bc\u03b5 \u03c4\u03bf SimpleSAMLphp" - }, - "about_text": { - "no": "Yey! SimpleSAMLphp virker jammen kult, hvor kan jeg finne ut mer om det? Du kan lese mer om SimpleSAMLphp p\u00e5 <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp sin hjemmeside<\/a>.", - "nn": "Yey! SimpleSAMLphp er jammen kult, kvar finn eg ut meir? Du kan lesa meir om SimpleSAMLphp p\u00e5 <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">heimesida til SimpleSAMLphp<\/a>.", - "sv": "SimpleSAMLphp \u00e4r cool, var kan jag l\u00e4sa mer om det? Du kan hitta mer information om <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp p\u00e5 Feide RnD blogg<\/a> hos <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "es": "¡Eh! Esto de SimpleSAMLphp es interesante, ¿dónde puedo averiguar más? Puedes encontrar más información en la <a href=\"https:\/\/simplesamlphp.org\/\">página web de SimpleSAMLphp<\/a>, en <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "fr": "Ce logiciel SimpleSAMLphp est plut\u00f4t sympa, o\u00f9 puis-je en lire plus \u00e0 son sujet? Vous trouverez plus d'informations sur <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp sur le blog de la R&D de Feide<\/a> sur <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "de": "Hey, dieses SimpleSAMLphp ist eine ziemlich coole Sache, wo kann ich mehr dar\u00fcber lesen? Sie finden mehr Informationen \u00fcber <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp auf dem Feide RnD blog<\/a> auf <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "nl": "H\u00e9, dat SimpleSAMLphp dingetje is vet cool, waar kan ik er meer over vinden? Je kan meer informatie over <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp<\/a> vinden op de Feide RnD blog van <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "lb": "Desen SimpleSAMLphp system as nach ew\u00ebll d\u00ebcken Gas, wou kann ech m\u00e9i doriwwer gewuer gin? Mei Informatiounen iwer <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp at the Feide RnD blog<\/a> op <a href=\"http:\/\/uninett.no\">UNINETT<\/a>", - "sl": "Da! SimpleSAMLphp je zares kul! Kje si lahko preberem kaj ve\u010d o tem? Dodatne informacije se nahajajo na <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp Feide RnD blogu<\/a>.", - "da": "Yes, det er cool! Hvor kan jeg l\u00e6se mere om det? G\u00e5 til <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp's hjemmeside<\/a>", - "hr": "Vi\u0161e informacija o programskom alatu SimpleSAMLphp mo\u017eete prona\u0107i na <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp stranici Feide RnD bloga<\/a>.", - "hu": "Ez a SimpleSAMLphp-dolog nagyon hasznos, hol olvashatn\u00e9k t\u00f6bbet r\u00f3la? Tov\u00e1bbi inform\u00e1ci\u00f3kat a <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\"> Feide RnD SimpleSAMLphp-r\u00f3l sz\u00f3l\u00f3 blogj\u00e1ban <\/a> tal\u00e1lhat a <a href=\"http:\/\/uninett.no\">UNINETT-en<\/a>.", - "fi": "T\u00e4\u00e4 simpleSAMPphp on aiga magee, mutta mist\u00e4 voin lukea enemm\u00e4n asiasta? L\u00f6yd\u00e4t enemm\u00e4n tietoa <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp blogista Feide RnD:ll\u00e4<\/a> <a href=\"http:\/\/uninett.no\">UNINETT<\/a>issa.", - "pt-br": "Este SimpleSAMLphp \u00e9 uma coisa muito legal, onde posso ler mais sobre isso? Voc\u00ea pode encontrar mais informa\u00e7\u00f5es sobre o <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp no blog de Feide RnD<\/a> durante a <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "pt": "Pode encontrar mais informa\u00e7\u00e3o sobre o <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp no blog da Feide RnD<\/a> em <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "pl": "Ten SimpleSAMLphp jest niez\u0142y, gdzie mog\u0119 poczyta\u0107 o tym? Mo\u017cesz znale\u017a\u0107 wi\u0119cej informacji o <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp na blogu Feide RnD<\/a> oraz na stronie <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "cs": "Tato vlastnost SimpleSAMLphp je velmi p\u011bkn\u00e1, kde se o n\u00ed mohu do\u010d\u00edst v\u00edce? Dal\u0161\u00ed informace o SimpleSAMLphp z\u00edsk\u00e1te <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">na blogu Feide RnD<\/a> na <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "tr": "Bu SimpleSAMLphp olduk\u00e7a iyiymi\u015f, daha fazla bilgiyi nereden okuyabilirim? <a href=\"http:\/\/uninett.no\">UNINETT<\/a> \u00fczerinde <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">Feide RnD blog'unda SimpleSAMLphp <\/a> hakk\u0131nda daha fazlas\u0131n\u0131 bulabilirsiniz.", - "it": "Questo SimpleSAMLphp è davvero un bel prodotto, dove trovo ulteriori informazioni a riguardo? Puoi trovare maggiori informazioni su <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp nel Blog di Feide RnD<\/a> oltre che <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "lt": "\u0160is SimpleSAMLphp dalykas yra gana puikus, kur gal\u0117\u010diau daugiau apie j\u012f paskaityti? Daugiau informacijos apie <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp galite rasti Feide RnD blog'e<\/a> bei <a href=\"http:\/\/uninett.no\">UNINETT<\/a> svetain\u0117je.", - "ja": "\u3053\u306e SimpleSAMLphp \u306f\u7d20\u6674\u3089\u3057\u3044\u3082\u306e\u3067\u3059\u3002\u3053\u308c\u4ee5\u4e0a\u306e\u8aac\u660e\u304c\u5728\u308a\u307e\u3059\u304b\uff1f\u3053\u3061\u3089\u306e\u30ea\u30f3\u30af\u3067\u66f4\u306a\u308b\u60c5\u5831\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059 <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp at the Feide RnD blog<\/a>", - "zh-tw": "\u89ba\u5f97 SimpleSAMLphp \u9084\u883b\u9177\u7684\u561b\uff0c\u5728\u54ea\u53ef\u4ee5\u627e\u5230\u66f4\u591a\u76f8\u95dc\u8cc7\u8a0a\u5462\uff1f\u4f60\u53ef\u4ee5\u5728\u4e0b\u5217\u7db2\u5740\u627e\u5230\u66f4\u591a\u76f8\u95dc\u8cc7\u8a0a\uff0c\u65bc <a href=\"http:\/\/uninett.no\">UNINETT<\/a> \u7684 <a href=\"https:\/\/simplesamlphp.org\/\">SimpleSAMLphp<\/a>", - "ru": "SimpleSAMLphp - \u0432\u0435\u0449\u044c \u043a\u043b\u0430\u0441\u0441\u043d\u0430\u044f, \u0433\u0434\u0435 \u044f \u043c\u043e\u0433\u0443 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c? \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp \u0432 \u0431\u043b\u043e\u0433\u0435 Feide RnD<\/a> \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430 <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "et": "See SimpleSAMLphp on p\u00e4ris \u00e4ge! Kust ma saaks selle kohta t\u00e4psemalt lugeda? Rohkem infot leiad <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp blogist<\/a>, mis asub <a href=\"http:\/\/uninett.no\">UNINETT<\/a>-is.", - "he": "\u05d4-SimpleSAMLphp \u05d4\u05d6\u05d4 \u05d4\u05d5\u05d0 \u05de\u05d4 \u05d6\u05d4 \u05de\u05d2\u05e0\u05d9\u05d1, \u05d0\u05d9\u05dd\u05d4 \u05d0\u05e0\u05d9 \u05d9\u05db\u05d5\u05dc \u05dc\u05e7\u05e8\u05d5\u05d0 \u05d9\u05d5\u05ea\u05e8 \u05e2\u05dc\u05d9\u05d5?\u05d0\u05ea\u05d4 \u05d9\u05db\u05d5\u05dc \u05dc\u05de\u05e6\u05d5\u05d0 \u05de\u05d9\u05d3\u05e2 \u05e0\u05d5\u05e1\u05e3 \u05d1- <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\"> SimpleSAMLphp \u05d1 Feide \u05d1\u05d1\u05dc\u05d5\u05d2 \u05d4\u05e4\u05d9\u05ea\u05d5\u05d7 \u05e9\u05dc \u05e9\u05e0\u05de\u05e6\u05d0 \u05d1- <a href=\"http:\/\/uninett.no\">UNINETT<\/a>. ", - "zh": "\u662f\u4e0d\u662f\u89c9\u5f97SimpleSAMLphp\u5f88\u9177\uff1f\u6211\u5728\u54ea\u91cc\u80fd\u627e\u5230\u66f4\u591a\u8d44\u6599\u5462\uff1f\u4f60\u53ef\u4ee5\u5728\u4e0b\u5217\u7f51\u5740\u627e\u5230\u66f4\u591a\u4fe1\u606f\uff1a <a href=\"http:\/\/uninett.no\">UNINETT<\/a> \u7684 <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp at the Feide RnD \u5f00\u53d1\u8005\u535a\u5ba2<\/a>", - "ar": "\u0644\u0644\u0645\u0632\u064a\u062f \u0639\u0646 SimpleSAMLphp \u0627\u0630\u0647\u0628 \u0627\u0644\u064a<a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp \u0628\u0645\u062f\u0648\u0646\u0629 Feide RnD <\/a> over at <a href=\"http:\/\/uninett.no\">UNINETT<\/a>", - "lv": "SimpleSAMLphp ir baigi for\u0161s, kur par to var palas\u012bt vair\u0101k? Vair\u0101k inform\u0101cijas ir <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp Feide RnD blog\u0101<\/a> pie <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "id": "SimpleSAMLphp sangat menarik, dimana Saya bisa membaca lebih jauh tentang hal ini ? Anda dapat mencari informasi lebih jauh tentang <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp pada blog Feide RnD<\/a> ke arah <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "sr": "SimpleSAMLphp je veoma kul, gde mogu da pro\u010ditam vi\u0161e o njemu? Vi\u0161e informacija o SimpleSAMLphp-u mo\u017eete prona\u0107i na <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp stranici Feide RnD bloga<\/a>.", - "ro": "Acest SimpleSAMLphp este interesant, unde pot g\u0103si mai multe informa\u021bii ? Pute\u021bi g\u0103si mai multe informa\u021bii despre <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\"> la blog-ul Feide despre SimpleSAMLphp<\/a> de la <a href=\"http:\/\/uninett.no\">UNINETT<\/a>.", - "eu": "SimpleSAMLphp-en kontu hau interesgarria da benetan, non bila nezake informazio gehiago honen inguruan? <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">SimpleSAMLphp Feideren I+G blogeko <a href=\"http:\/\/uninett.no\">UNINETT<\/a>n.", - "el": "\u03a4\u03bf SimpleSAMLphp \u03b5\u03af\u03bd\u03b1\u03b9 \u03c0\u03bf\u03bb\u03cd \u03b5\u03bd\u03b4\u03b9\u03b1\u03c6\u03ad\u03c1\u03bf\u03bd, \u03c0\u03bf\u03cd \u03bc\u03c0\u03bf\u03c1\u03ce \u03bd\u03b1 \u03bc\u03ac\u03b8\u03c9 \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b1 \u03b3\u03b9\u0027 \u03b1\u03c5\u03c4\u03cc\u003b \u039c\u03c0\u03bf\u03c1\u03b5\u03af\u03c4\u03b5 \u03bd\u03b1 \u03b2\u03c1\u03b5\u03af\u03c4\u03b5 \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b5\u03c2 \u03c0\u03bb\u03b7\u03c1\u03bf\u03c6\u03bf\u03c1\u03af\u03b5\u03c2 \u03c3\u03c4\u03bf\u03bd <a href=\"http:\/\/rnd.feide.no\/simplesamlphp\">\u03b9\u03c3\u03c4\u03cc\u03c4\u03bf\u03c0\u03bf \u03c4\u03bf\u03c5 SimpleSAMLphp<\/a> \u03c0\u03bf\u03c5 \u03c6\u03b9\u03bb\u03bf\u03be\u03b5\u03bd\u03b5\u03af\u03c4\u03b1\u03b9 \u03b1\u03c0\u03cc \u03c4\u03bf <a href=\"http:\/\/uninett.no\">UNINETT<\/a>." - }, "required": { "no": "P\u00e5krevd", "nn": "Naudsynt", @@ -455,39 +385,39 @@ "el": "\u03a0\u03c1\u03bf\u03b5\u03b9\u03b4\u03bf\u03c0\u03bf\u03b9\u03ae\u03c3\u03b5\u03b9\u03c2" }, "warnings_https": { - "no": "<strong>Du bruker ikke HTTPS<\/strong> - kryptert kommunikasjon med brukeren. HTTP fungerer utmerket til testform\u00e5l, men i et produksjonsmilj\u00f8 anbefales sterkt \u00e5 skru p\u00e5 sikker kommunikasjon med HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Les mer i dokumentet: SimpleSAMLphp maintenance<\/a> ]", - "nn": "<strong>Du bruker ikkje HTTPS<\/strong> - kryptert kommunikasjon med brukaren. Du kan bruka SimpleSAMLphp uten HTTPS til testform\u00e5l, men dersom du skal bruka SimpleSAMLphp i eit produksjonsmilj\u00f8, vil vi sterkt tilr\u00e5 \u00e5 skru p\u00e5 sikker kommunikasjon med HTTPS. [ Les meir i dokumentet: <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">SimpleSAMLphp maintenance<\/a> ]", - "sv": "<strong>Du anv\u00e4nder inte HTTPS<\/strong> - krypterad kommunikation med anv\u00e4ndaren. HTTP fungerar bra under test men i produktion ska du anv\u00e4nda HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">L\u00e4s mer i dokumentet SimpleSAMLphp maintenance<\/a> ]", + "no": "<strong>Du bruker ikke HTTPS<\/strong> - kryptert kommunikasjon med brukeren. HTTP fungerer utmerket til testform\u00e5l, men i et produksjonsmilj\u00f8 anbefales sterkt \u00e5 skru p\u00e5 sikker kommunikasjon med HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Les mer i dokumentet: SimpleSAMLphp maintenance<\/a> ]", + "nn": "<strong>Du bruker ikkje HTTPS<\/strong> - kryptert kommunikasjon med brukaren. Du kan bruka SimpleSAMLphp uten HTTPS til testform\u00e5l, men dersom du skal bruka SimpleSAMLphp i eit produksjonsmilj\u00f8, vil vi sterkt tilr\u00e5 \u00e5 skru p\u00e5 sikker kommunikasjon med HTTPS. [ Les meir i dokumentet: <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">SimpleSAMLphp maintenance<\/a> ]", + "sv": "<strong>Du anv\u00e4nder inte HTTPS<\/strong> - krypterad kommunikation med anv\u00e4ndaren. HTTP fungerar bra under test men i produktion ska du anv\u00e4nda HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">L\u00e4s mer i dokumentet SimpleSAMLphp maintenance<\/a> ]", "es": "<strong>No est\u00e1 usando HTTPS<\/strong> - comunicaciones cifradas con el usuario. HTTP funciona bien en entornos de evaluaci\u00f3n, pero si va a emplearlo en producci\u00f3n, deber\u00eda emplear HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Lea m\u00e1s acerca del mantenimiento de SimpleSAMLphp <\/a> ]", - "fr": "<strong>Vous n'utilisez pas HTTPS<\/strong> - communications chiffr\u00e9es avec l'utilisateur. Utiliser SimpleSAMLphp marchera parfaitement avec HTTP pour des tests, mais si vous voulez l'utiliser dans un environnement de production, vous devriez utiliser HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">En lire plus sur la maintenance de SimpleSAMLphp<\/a> ]", - "de": "<strong>Sie benutzen keine HTTPS<\/strong> - verschl\u00fcsselte Kommunikation mit dem Nutzer. SimpleSAMLphp funktioniert zum Testen auch mit HTTP problemlos, aber in einer Produktionsumgebung sollten Sie HTTPS benutzen. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Lesen sie mehr \u00fcber die Verwaltung von SimpleSAMLphp<\/a> ]", - "nl": "<strong>Je gebruikt geen HTTPS<\/strong> - versleutelde communicatie met de gebruiker. SimpleSAMLphp werkt prima op HTTP voor testdoeleinden, maar als je SimpleSAMLphp in een productieomgeving gaat gebruiken, zou je dat moeten doen over HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">lees meer over SimpleSAMLphp-onderhoud<\/a> ]", - "lb": "<strong>Der benotzt ken HTTPS<\/strong> - verschl\u00ebsselt Kommunikatioun mat dem Benotzer. SimpleSAMLphp funktion\u00e9iert einwandfr\u00e4i mat HTTP fir Testzw\u00e9ecker mais an engem produktiven Emfeld sollt et besser mat HTTPS lafen. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Liest m\u00e9i iwert Maintenance vun SimpleSAMLphp<\/a> ]", - "sl": "<strong>Ne uporabljate HTTPS<\/strong>-\u0161ifrirane komunikacije. SimpleSAMLphp deluje brez te\u017eav na HTTP, vendar le za testne namene, za uporabo SimpleSAMLphp v produkcijskem okolju uporabite HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Preberite ve\u010d o SimpleSAMLphp vzdr\u017eevanju<\/a> ]", - "da": "<strong>Du benytter ikke HTTPS<\/strong>-krypteret kommunikation med brugeren. SimpleSAMLphp vil fungere uden problemer med HTTP alene, men hvis du anvender systemet i produktionssystemer, anbefales det st\u00e6rkt at benytte sikker kommunikation i form af HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">l\u00e6s mere i dokumentet: SimpleSAMLphp maintenance<\/a> ] ", - "hr": "<strong>Ne koristite HTTPS<\/strong> - kriptiranu komunikaciju s korisnikom. HTTP se mo\u017ee koristiti za potrebe testiranja, ali u produkcijskom okru\u017eenju trebali biste koristiti HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Pro\u010ditajte vi\u0161e o SimpleSAMLphp postavkama<\/a> ]", - "hu": "<strong>Nem HTTPS protokollt haszn\u00e1l<\/strong> - nem titkos\u00edtott a kommunik\u00e1ci\u00f3! HTTP j\u00f3 megold\u00e1s lehet teszt rendszerek eset\u00e9ben, de az \u00e9les rendszerben lehet\u0151s\u00e9g szerint haszn\u00e1ljon HTTPS-t! [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">T\u00f6bbet olvashat a SimpleSAMLphp be\u00e1ll\u00edt\u00e1s\u00e1r\u00f3l<\/a> ]", - "fi": "<strong>Et k\u00e4yt\u00e4 HTTPS<\/strong> - vahvaa yhteyst\u00e4 k\u00e4ytt\u00e4j\u00e4\u00e4n. HTTP-protokolla on sopiva testeihin, mutta tuotantoj\u00e4rjestelm\u00e4ss\u00e4 sinun tulee k\u00e4ytt\u00e4\u00e4 HTTPS:\u00e4\u00e4. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Lue SimpleSAMLphp yll\u00e4pidosta (eng)<\/a> ]", - "pt-br": "<strong>Voc\u00ea n\u00e3o est\u00e1 utilizando HTTPS<\/strong> - comunica\u00e7\u00e3o encriptada com o usu\u00e1rio. HTTP funciona bem para testes, mas voc\u00ea deve utilizar HTTPS para produ\u00e7\u00e3o. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Leia mais sobre manuten\u00e7\u00e3o do SimpleSAMLphp<\/a> ]", - "pt": "<strong>N\u00e3o est\u00e1 a ser usado HTTPS<\/strong> - comunica\u00e7\u00e3o cifrada com o utilizador. Para ambientes de teste, liga\u00e7\u00f5es HTTP s\u00e3o suficientes, mas num ambiente de produ\u00e7\u00e3o deve ser usado HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Ler mais sobre manuten\u00e7\u00e3o do SimpleSAMLphp<\/a> ]", - "pl": "<strong>Nie u\u017cywasz HTTPS<\/strong> - szyfrowana komunikacja z u\u017cytkownikiem. HTTP jest OK dla test\u00f3w, ale na produkcji powiniene\u015b u\u017cywa\u0107 tylko HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Przeczytaj wi\u0119cej o zarz\u0105dzaniu SimpleSAMLphp<\/a> ]", - "cs": "<strong>Nepou\u017e\u00edv\u00e1te HTTPS<\/strong> - \u0161ivrovanou komunikaci s u\u017eivatelem. HTTP je vhodn\u00e9 jen k testovac\u00edm \u00fa\u010del\u016fm, pro produk\u010dn\u00ed \u00fa\u010dely pou\u017eijte HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">\u010ctete v\u00edce o \u00fadr\u017eb\u011b SimpleSAMLphp<\/a> ]", - "tr": "Kullan\u0131c\u0131yla \u015fifreli ileti\u015fim -<strong>HTTPS kullanm\u0131yorsunuz<\/strong>. HTTP test ama\u00e7l\u0131 olarak kullan\u0131labilir, ancak \u00fcretim ortam\u0131nda, HTTPS kullanmal\u0131s\u0131n\u0131z. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">SimpleSAMLphp bak\u0131m\u0131 hakk\u0131nda daha fazlas\u0131n\u0131 okuyun<\/a> ]", - "it": "<strong>Non stai usando HTTPS<\/strong> - comunicazione cifrata con l'utente. HTTP può funzionare per i test, ma in un ambiente di produzione si dovrebbe usare HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Maggiori informazioni sulla manutenzione di SimpleSAMLphp<\/a> ]", - "lt": "<strong>J\u016bs nenaudojate HTTPS<\/strong> - \u0161ifruotos komunikacijos su vartotoju. HTTP puikiai tinka testavimo reikm\u0117ms, ta\u010diau realioje aplinkoje tur\u0117tum\u0117te naudoti HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Skaityti daugiau apie SimpleSAMLphp prie\u017ei\u016br\u0105<\/a> ]", - "ja": "<strong>\u3042\u306a\u305f\u306fHTTPS(\u6697\u53f7\u5316\u901a\u4fe1)\u3092\u884c\u3063\u3066\u3044\u307e\u305b\u3093\u3002<\/strong>HTTP\u306f\u30c6\u30b9\u30c8\u74b0\u5883\u3067\u3042\u308c\u3070\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u307e\u3059\u3001\u3057\u304b\u3057\u88fd\u54c1\u74b0\u5883\u3067\u306fHTTPS\u3092\u4f7f\u7528\u3059\u308b\u3079\u304d\u3067\u3059\u3002[ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">\u8a73\u3057\u304f\u306f SimpleSAMLphp \u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u60c5\u5831\u3092\u8aad\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/a> ]", + "fr": "<strong>Vous n'utilisez pas HTTPS<\/strong> - communications chiffr\u00e9es avec l'utilisateur. Utiliser SimpleSAMLphp marchera parfaitement avec HTTP pour des tests, mais si vous voulez l'utiliser dans un environnement de production, vous devriez utiliser HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">En lire plus sur la maintenance de SimpleSAMLphp<\/a> ]", + "de": "<strong>Sie benutzen keine HTTPS<\/strong> - verschl\u00fcsselte Kommunikation mit dem Nutzer. SimpleSAMLphp funktioniert zum Testen auch mit HTTP problemlos, aber in einer Produktionsumgebung sollten Sie HTTPS benutzen. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Lesen sie mehr \u00fcber die Verwaltung von SimpleSAMLphp<\/a> ]", + "nl": "<strong>Je gebruikt geen HTTPS<\/strong> - versleutelde communicatie met de gebruiker. SimpleSAMLphp werkt prima op HTTP voor testdoeleinden, maar als je SimpleSAMLphp in een productieomgeving gaat gebruiken, zou je dat moeten doen over HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">lees meer over SimpleSAMLphp-onderhoud<\/a> ]", + "lb": "<strong>Der benotzt ken HTTPS<\/strong> - verschl\u00ebsselt Kommunikatioun mat dem Benotzer. SimpleSAMLphp funktion\u00e9iert einwandfr\u00e4i mat HTTP fir Testzw\u00e9ecker mais an engem produktiven Emfeld sollt et besser mat HTTPS lafen. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Liest m\u00e9i iwert Maintenance vun SimpleSAMLphp<\/a> ]", + "sl": "<strong>Ne uporabljate HTTPS<\/strong>-\u0161ifrirane komunikacije. SimpleSAMLphp deluje brez te\u017eav na HTTP, vendar le za testne namene, za uporabo SimpleSAMLphp v produkcijskem okolju uporabite HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Preberite ve\u010d o SimpleSAMLphp vzdr\u017eevanju<\/a> ]", + "da": "<strong>Du benytter ikke HTTPS<\/strong>-krypteret kommunikation med brugeren. SimpleSAMLphp vil fungere uden problemer med HTTP alene, men hvis du anvender systemet i produktionssystemer, anbefales det st\u00e6rkt at benytte sikker kommunikation i form af HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">l\u00e6s mere i dokumentet: SimpleSAMLphp maintenance<\/a> ] ", + "hr": "<strong>Ne koristite HTTPS<\/strong> - kriptiranu komunikaciju s korisnikom. HTTP se mo\u017ee koristiti za potrebe testiranja, ali u produkcijskom okru\u017eenju trebali biste koristiti HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Pro\u010ditajte vi\u0161e o SimpleSAMLphp postavkama<\/a> ]", + "hu": "<strong>Nem HTTPS protokollt haszn\u00e1l<\/strong> - nem titkos\u00edtott a kommunik\u00e1ci\u00f3! HTTP j\u00f3 megold\u00e1s lehet teszt rendszerek eset\u00e9ben, de az \u00e9les rendszerben lehet\u0151s\u00e9g szerint haszn\u00e1ljon HTTPS-t! [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">T\u00f6bbet olvashat a SimpleSAMLphp be\u00e1ll\u00edt\u00e1s\u00e1r\u00f3l<\/a> ]", + "fi": "<strong>Et k\u00e4yt\u00e4 HTTPS<\/strong> - vahvaa yhteyst\u00e4 k\u00e4ytt\u00e4j\u00e4\u00e4n. HTTP-protokolla on sopiva testeihin, mutta tuotantoj\u00e4rjestelm\u00e4ss\u00e4 sinun tulee k\u00e4ytt\u00e4\u00e4 HTTPS:\u00e4\u00e4. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Lue SimpleSAMLphp yll\u00e4pidosta (eng)<\/a> ]", + "pt-br": "<strong>Voc\u00ea n\u00e3o est\u00e1 utilizando HTTPS<\/strong> - comunica\u00e7\u00e3o encriptada com o usu\u00e1rio. HTTP funciona bem para testes, mas voc\u00ea deve utilizar HTTPS para produ\u00e7\u00e3o. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Leia mais sobre manuten\u00e7\u00e3o do SimpleSAMLphp<\/a> ]", + "pt": "<strong>N\u00e3o est\u00e1 a ser usado HTTPS<\/strong> - comunica\u00e7\u00e3o cifrada com o utilizador. Para ambientes de teste, liga\u00e7\u00f5es HTTP s\u00e3o suficientes, mas num ambiente de produ\u00e7\u00e3o deve ser usado HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Ler mais sobre manuten\u00e7\u00e3o do SimpleSAMLphp<\/a> ]", + "pl": "<strong>Nie u\u017cywasz HTTPS<\/strong> - szyfrowana komunikacja z u\u017cytkownikiem. HTTP jest OK dla test\u00f3w, ale na produkcji powiniene\u015b u\u017cywa\u0107 tylko HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Przeczytaj wi\u0119cej o zarz\u0105dzaniu SimpleSAMLphp<\/a> ]", + "cs": "<strong>Nepou\u017e\u00edv\u00e1te HTTPS<\/strong> - \u0161ivrovanou komunikaci s u\u017eivatelem. HTTP je vhodn\u00e9 jen k testovac\u00edm \u00fa\u010del\u016fm, pro produk\u010dn\u00ed \u00fa\u010dely pou\u017eijte HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">\u010ctete v\u00edce o \u00fadr\u017eb\u011b SimpleSAMLphp<\/a> ]", + "tr": "Kullan\u0131c\u0131yla \u015fifreli ileti\u015fim -<strong>HTTPS kullanm\u0131yorsunuz<\/strong>. HTTP test ama\u00e7l\u0131 olarak kullan\u0131labilir, ancak \u00fcretim ortam\u0131nda, HTTPS kullanmal\u0131s\u0131n\u0131z. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">SimpleSAMLphp bak\u0131m\u0131 hakk\u0131nda daha fazlas\u0131n\u0131 okuyun<\/a> ]", + "it": "<strong>Non stai usando HTTPS<\/strong> - comunicazione cifrata con l'utente. HTTP può funzionare per i test, ma in un ambiente di produzione si dovrebbe usare HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Maggiori informazioni sulla manutenzione di SimpleSAMLphp<\/a> ]", + "lt": "<strong>J\u016bs nenaudojate HTTPS<\/strong> - \u0161ifruotos komunikacijos su vartotoju. HTTP puikiai tinka testavimo reikm\u0117ms, ta\u010diau realioje aplinkoje tur\u0117tum\u0117te naudoti HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Skaityti daugiau apie SimpleSAMLphp prie\u017ei\u016br\u0105<\/a> ]", + "ja": "<strong>\u3042\u306a\u305f\u306fHTTPS(\u6697\u53f7\u5316\u901a\u4fe1)\u3092\u884c\u3063\u3066\u3044\u307e\u305b\u3093\u3002<\/strong>HTTP\u306f\u30c6\u30b9\u30c8\u74b0\u5883\u3067\u3042\u308c\u3070\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u307e\u3059\u3001\u3057\u304b\u3057\u88fd\u54c1\u74b0\u5883\u3067\u306fHTTPS\u3092\u4f7f\u7528\u3059\u308b\u3079\u304d\u3067\u3059\u3002[ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">\u8a73\u3057\u304f\u306f SimpleSAMLphp \u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u60c5\u5831\u3092\u8aad\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/a> ]", "zh-tw": "<strong>\u60a8\u672a\u4f7f\u7528 HTTPS <\/strong> \u5c0d\u50b3\u8f38\u904e\u7a0b\u9032\u884c\u52a0\u5bc6\u901a\u8a0a\u3002HTTP \u53ef\u4ee5\u6b63\u5e38\u7684\u904b\u4f5c\u65bc\u6e2c\u8a66\u74b0\u5883\u3002\u4f46\u5728\u6b63\u5f0f\u74b0\u5883\u88e1\uff0c\u60a8\u61c9\u8a72\u8981\u4f7f\u7528 HTTPS\u3002[ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">\u95b1\u8b80\u66f4\u591a\u6709\u95dc\u65bc SimpleSAMLphp \u7684\u7dad\u8b77\u65b9\u5f0f<\/a> ]", - "ru": "<strong>\u0412\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 HTTPS<\/strong> - \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. HTTP \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u0435\u0439, \u043d\u043e \u0432 \u044d\u043a\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">\u0423\u0437\u043d\u0430\u0439\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0438 SimpleSAMLphp<\/a> ]", - "et": "<strong>Sa ei kasuta andmete vahetamiseks HTTPS kr\u00fcpteeritud sidet<\/strong>. HTTP sobib testimiseks h\u00e4sti, kuid toodangus peaksid kindlasti HTTPS-i kasutama. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Loe t\u00e4psemalt SimpleSAMLphp hooldamisest<\/a> ]", - "he": "<strong>\u05d0\u05ea\u05d4 \u05dc\u05d0 \u05de\u05e9\u05ea\u05de\u05e9 \u05d1- HTTPS <\/strong> - \u05d4\u05ea\u05e7\u05e9\u05e8\u05d5\u05ea \u05de\u05d5\u05e6\u05e4\u05e0\u05ea \u05e2\u05dd \u05d4\u05de\u05e9\u05ea\u05de\u05e9. HTTP \u05e2\u05d5\u05d1\u05d3 \u05d1\u05e1\u05d3\u05e8 \u05dc\u05de\u05d8\u05e8\u05d5\u05ea \u05d1\u05d3\u05d9\u05e7\u05d4, \u05d0\u05d5\u05dc\u05dd \u05dc\u05de\u05e2\u05e8\u05db\u05d5\u05ea \u05d0\u05de\u05d9\u05ea\u05d9\u05d5\u05ea, \u05db\u05d3\u05d9 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d4 HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\"> \u05e7\u05e8\u05d0 \u05e2\u05d5\u05d3 \u05e2\u05dc \u05ea\u05d7\u05d6\u05d5\u05e7 SimpleSAMLphp <\/a> ]", - "zh": "<strong>\u4f60\u6ca1\u6709\u4f7f\u7528HTTPS<\/strong> - \u548c\u7528\u6237\u52a0\u5bc6\u7684\u901a\u4fe1\u3002HTTP\u5728\u6d4b\u8bd5\u76ee\u7684\u4e0b\u5f88\u597d,\u4f46\u751f\u4ea7\u73af\u5883\u8bf7\u4f7f\u7528HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">\u83b7\u53d6\u66f4\u591aSimpleSAMLphp\u7ef4\u62a4\u7684\u4fe1\u606f<\/a> ]", - "ar": "<strong>\u0627\u0646\u062a \u0644\u0627 \u062a\u0633\u062a\u062e\u062f\u0645 HTTPS<\/strong> - \u0645\u062d\u0627\u062f\u062b\u0629 \u0645\u0634\u0641\u0631\u0629 \u0645\u0639 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645. HTTP \u062c\u064a\u062f \u0644\u0644\u0627\u062e\u062a\u0628\u0627\u0631\u0627\u062a \u0644\u0643\u0646 \u0641\u064a \u0628\u064a\u0626\u0629 \u0627\u0644\u0646\u0638\u0627\u0645 \u0627\u0644\u0645\u0628\u062f\u0626\u064a \u064a\u0646\u0628\u063a\u064a \u0627\u0633\u062a\u062e\u062f\u0627\u0645 HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/contents\/simplesamlphp-maintenance-and-configuration\">read more about SimpleSAMLphp maintenance<\/a>]", - "lv": "<strong>J\u016bs neizmantojat HTTPS<\/strong> - \u0161ifr\u0113tu komunik\u0101ciju ar lietot\u0101ju. HTTP ir labs testa nol\u016bkiem, bet ra\u017eo\u0161an\u0101 j\u0101izmanto HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Lasiet vair\u0101k par SimpleSAMLphp uztur\u0113\u0161anu<\/a> ]", - "id": "<strong>Anda tidak menggunakan HTTPS<\/strong> - komunikasi yang dienkripsi dengan user. HTTP bekerja baik-baik saja untuk tujuan pengetesan , tapi dalam lingkungan produksi, Anda sebaiknya menggunakan HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Baca lebih lanjut tentang proses pemeliraan SimpleSAMLphp.<\/a> ]", - "sr": "<strong>Ne koristite HTTPS<\/strong> - kriptovanu komunikaciju s korisnikom. HTTP se mo\u017ee koristiti za potrebe testiranja, ali u produkcionom okru\u017eenju trebali biste koristiti HTTPS. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Pro\u010ditajte vi\u0161e o SimpleSAMLphp pode\u0161avanjima<\/a> ]", - "ro": "<strong>Aten\u021bie, nu utiliza\u021bi HTTPS<\/strong> - comunicare criptat\u0103 cu utilizatorul. HTTP func\u021bioneaza bine pentru teste, dar \u00een produc\u021bie trebuie folosit HTTPS. [<a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Citi\u021bi mai multe despre \u00eentre\u021binerea SimpleSAMLphp<\/a> ]", - "eu": "<strong>Ez zara erabiltzen ari HTTPSak<\/strong> - erabiltzailearekin zifratutako komunikazioak. HTTP zuzen ibiltzen da ebaluaketa ingurunetan, baina ustiapenean erabili behar baduzu, HTTPS erabili beharko zenuke. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">Irakur ezazu gehiago SimpleSAMLphp-ren mantentze-lanei buruz <\/a> ]", - "el": "\u0394\u03b5\u03bd \u03c7\u03c1\u03b7\u03c3\u03b9\u03bc\u03bf\u03c0\u03bf\u03b9\u03b5\u03af\u03c4\u03b5 <strong>HTTPS<\/strong> \u03b3\u03b9\u03b1 \u03ba\u03c1\u03c5\u03c0\u03c4\u03bf\u03b3\u03c1\u03b1\u03c6\u03b7\u03bc\u03ad\u03bd\u03b7 \u03b5\u03c0\u03b9\u03ba\u03bf\u03b9\u03bd\u03c9\u03bd\u03af\u03b1 \u03bc\u03b5 \u03c4\u03bf\u03bd \u03c7\u03c1\u03ae\u03c3\u03c4\u03b7. \u03a4\u03bf HTTP \u03b5\u03c0\u03b1\u03c1\u03ba\u03b5\u03af \u03b3\u03b9\u03b1 \u03b4\u03bf\u03ba\u03b9\u03bc\u03b1\u03c3\u03c4\u03b9\u03ba\u03bf\u03cd\u03c2 \u03c3\u03ba\u03bf\u03c0\u03bf\u03cd\u03c2, \u03c9\u03c3\u03c4\u03cc\u03c3\u03bf \u03c3\u03b5 \u03c0\u03b5\u03c1\u03b9\u03b2\u03ac\u03bb\u03bb\u03bf\u03bd \u03c0\u03b1\u03c1\u03b1\u03b3\u03c9\u03b3\u03ae\u03c2 \u03b8\u03b1 \u03c0\u03c1\u03ad\u03c0\u03b5\u03b9 \u03bd\u03b1 \u03c7\u03c1\u03b7\u03c3\u03b9\u03bc\u03bf\u03c0\u03bf\u03b9\u03ae\u03c3\u03b5\u03c4\u03b5 \u0048\u0054\u0054\u0050\u0053. [ <a href=\"http:\/\/rnd.feide.no\/content\/simplesamlphp-maintenance-and-configuration\">\u0394\u03b9\u03b1\u03b2\u03ac\u03c3\u03c4\u03b5 \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b1...<\/a> ]" + "ru": "<strong>\u0412\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 HTTPS<\/strong> - \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. HTTP \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0446\u0435\u043b\u0435\u0439, \u043d\u043e \u0432 \u044d\u043a\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">\u0423\u0437\u043d\u0430\u0439\u0442\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0438 SimpleSAMLphp<\/a> ]", + "et": "<strong>Sa ei kasuta andmete vahetamiseks HTTPS kr\u00fcpteeritud sidet<\/strong>. HTTP sobib testimiseks h\u00e4sti, kuid toodangus peaksid kindlasti HTTPS-i kasutama. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Loe t\u00e4psemalt SimpleSAMLphp hooldamisest<\/a> ]", + "he": "<strong>\u05d0\u05ea\u05d4 \u05dc\u05d0 \u05de\u05e9\u05ea\u05de\u05e9 \u05d1- HTTPS <\/strong> - \u05d4\u05ea\u05e7\u05e9\u05e8\u05d5\u05ea \u05de\u05d5\u05e6\u05e4\u05e0\u05ea \u05e2\u05dd \u05d4\u05de\u05e9\u05ea\u05de\u05e9. HTTP \u05e2\u05d5\u05d1\u05d3 \u05d1\u05e1\u05d3\u05e8 \u05dc\u05de\u05d8\u05e8\u05d5\u05ea \u05d1\u05d3\u05d9\u05e7\u05d4, \u05d0\u05d5\u05dc\u05dd \u05dc\u05de\u05e2\u05e8\u05db\u05d5\u05ea \u05d0\u05de\u05d9\u05ea\u05d9\u05d5\u05ea, \u05db\u05d3\u05d9 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d4 HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\"> \u05e7\u05e8\u05d0 \u05e2\u05d5\u05d3 \u05e2\u05dc \u05ea\u05d7\u05d6\u05d5\u05e7 SimpleSAMLphp <\/a> ]", + "zh": "<strong>\u4f60\u6ca1\u6709\u4f7f\u7528HTTPS<\/strong> - \u548c\u7528\u6237\u52a0\u5bc6\u7684\u901a\u4fe1\u3002HTTP\u5728\u6d4b\u8bd5\u76ee\u7684\u4e0b\u5f88\u597d,\u4f46\u751f\u4ea7\u73af\u5883\u8bf7\u4f7f\u7528HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">\u83b7\u53d6\u66f4\u591aSimpleSAMLphp\u7ef4\u62a4\u7684\u4fe1\u606f<\/a> ]", + "ar": "<strong>\u0627\u0646\u062a \u0644\u0627 \u062a\u0633\u062a\u062e\u062f\u0645 HTTPS<\/strong> - \u0645\u062d\u0627\u062f\u062b\u0629 \u0645\u0634\u0641\u0631\u0629 \u0645\u0639 \u0627\u0644\u0645\u0633\u062a\u062e\u062f\u0645. HTTP \u062c\u064a\u062f \u0644\u0644\u0627\u062e\u062a\u0628\u0627\u0631\u0627\u062a \u0644\u0643\u0646 \u0641\u064a \u0628\u064a\u0626\u0629 \u0627\u0644\u0646\u0638\u0627\u0645 \u0627\u0644\u0645\u0628\u062f\u0626\u064a \u064a\u0646\u0628\u063a\u064a \u0627\u0633\u062a\u062e\u062f\u0627\u0645 HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">read more about SimpleSAMLphp maintenance<\/a>]", + "lv": "<strong>J\u016bs neizmantojat HTTPS<\/strong> - \u0161ifr\u0113tu komunik\u0101ciju ar lietot\u0101ju. HTTP ir labs testa nol\u016bkiem, bet ra\u017eo\u0161an\u0101 j\u0101izmanto HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Lasiet vair\u0101k par SimpleSAMLphp uztur\u0113\u0161anu<\/a> ]", + "id": "<strong>Anda tidak menggunakan HTTPS<\/strong> - komunikasi yang dienkripsi dengan user. HTTP bekerja baik-baik saja untuk tujuan pengetesan , tapi dalam lingkungan produksi, Anda sebaiknya menggunakan HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Baca lebih lanjut tentang proses pemeliraan SimpleSAMLphp.<\/a> ]", + "sr": "<strong>Ne koristite HTTPS<\/strong> - kriptovanu komunikaciju s korisnikom. HTTP se mo\u017ee koristiti za potrebe testiranja, ali u produkcionom okru\u017eenju trebali biste koristiti HTTPS. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Pro\u010ditajte vi\u0161e o SimpleSAMLphp pode\u0161avanjima<\/a> ]", + "ro": "<strong>Aten\u021bie, nu utiliza\u021bi HTTPS<\/strong> - comunicare criptat\u0103 cu utilizatorul. HTTP func\u021bioneaza bine pentru teste, dar \u00een produc\u021bie trebuie folosit HTTPS. [<a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Citi\u021bi mai multe despre \u00eentre\u021binerea SimpleSAMLphp<\/a> ]", + "eu": "<strong>Ez zara erabiltzen ari HTTPSak<\/strong> - erabiltzailearekin zifratutako komunikazioak. HTTP zuzen ibiltzen da ebaluaketa ingurunetan, baina ustiapenean erabili behar baduzu, HTTPS erabili beharko zenuke. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">Irakur ezazu gehiago SimpleSAMLphp-ren mantentze-lanei buruz <\/a> ]", + "el": "\u0394\u03b5\u03bd \u03c7\u03c1\u03b7\u03c3\u03b9\u03bc\u03bf\u03c0\u03bf\u03b9\u03b5\u03af\u03c4\u03b5 <strong>HTTPS<\/strong> \u03b3\u03b9\u03b1 \u03ba\u03c1\u03c5\u03c0\u03c4\u03bf\u03b3\u03c1\u03b1\u03c6\u03b7\u03bc\u03ad\u03bd\u03b7 \u03b5\u03c0\u03b9\u03ba\u03bf\u03b9\u03bd\u03c9\u03bd\u03af\u03b1 \u03bc\u03b5 \u03c4\u03bf\u03bd \u03c7\u03c1\u03ae\u03c3\u03c4\u03b7. \u03a4\u03bf HTTP \u03b5\u03c0\u03b1\u03c1\u03ba\u03b5\u03af \u03b3\u03b9\u03b1 \u03b4\u03bf\u03ba\u03b9\u03bc\u03b1\u03c3\u03c4\u03b9\u03ba\u03bf\u03cd\u03c2 \u03c3\u03ba\u03bf\u03c0\u03bf\u03cd\u03c2, \u03c9\u03c3\u03c4\u03cc\u03c3\u03bf \u03c3\u03b5 \u03c0\u03b5\u03c1\u03b9\u03b2\u03ac\u03bb\u03bb\u03bf\u03bd \u03c0\u03b1\u03c1\u03b1\u03b3\u03c9\u03b3\u03ae\u03c2 \u03b8\u03b1 \u03c0\u03c1\u03ad\u03c0\u03b5\u03b9 \u03bd\u03b1 \u03c7\u03c1\u03b7\u03c3\u03b9\u03bc\u03bf\u03c0\u03bf\u03b9\u03ae\u03c3\u03b5\u03c4\u03b5 \u0048\u0054\u0054\u0050\u0053. [ <a href=\"https:\/\/simplesamlphp.org\/docs\/stable\/simplesamlphp-maintenance\">\u0394\u03b9\u03b1\u03b2\u03ac\u03c3\u03c4\u03b5 \u03c0\u03b5\u03c1\u03b9\u03c3\u03c3\u03cc\u03c4\u03b5\u03c1\u03b1...<\/a> ]" }, "link_saml2example": { "no": "SAML 2.0 SP eksempel - test innlogging med SAML 2.0 via din IdP", @@ -1425,6 +1355,10 @@ "ro": "V-a\u021bi autentificat ca administrator", "el": "\u03a3\u03c5\u03bd\u03b4\u03b5\u03b4\u03b5\u03bc\u03ad\u03bd\u03bf\u03c2 \u03c9\u03c2 \u03b4\u03b9\u03b1\u03c7\u03b5\u03b9\u03c1\u03b9\u03c3\u03c4\u03ae\u03c2" }, + "logout": { + "en": "Logout", + "nl": "Uitloggen" + }, "auth": { "no": "Autentisering", "sv": "Autentisering", diff --git a/modules/core/docs/authproc_php.md b/modules/core/docs/authproc_php.md index 66968eda1a7b9853c2a3b9eafacb784cd7e0d79b..b913d8fe6d242d613b82afe2d1728ac409c5b174 100644 --- a/modules/core/docs/authproc_php.md +++ b/modules/core/docs/authproc_php.md @@ -1,7 +1,7 @@ `core:PHP` ========== -This is a filter which makes it possible to run arbitrary PHP code to modify the attributes of an user. +This is a filter which makes it possible to run arbitrary PHP code to modify the attributes or state of an user. Parameters ---------- @@ -11,8 +11,14 @@ Parameters It must be `'core:PHP'`. `code` -: The PHP code that should be run. This code will have only one variable available: `$attributes`. +: The PHP code that should be run. This code will have two variables available: + +* `$attributes`. This is an associative array of attributes, and can be modified to add or remove attributes. + +* `$state`. + This is an associative array of request state. It can be modified to adjust data related to the authentication + such as desired NameId, requested Attributes, authnContextRef and many more. Examples -------- @@ -43,3 +49,10 @@ Create a random number variable: ); ', ), + +Force a specific NameIdFormat. Useful if an SP misbehaves and requests (or publishes) an incorrect NameId + + 90 => array( + 'class' => 'core:PHP', + 'code' => '$state["saml:NameIDFormat"] = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient";' + ), \ No newline at end of file diff --git a/modules/core/hooks/hook_frontpage.php b/modules/core/hooks/hook_frontpage.php index ea7aefd570013d0c1dce3a464a2a990424dabe07..d2b6eef9c0b15aa8d0020dd8cdd29472c1cf2edf 100644 --- a/modules/core/hooks/hook_frontpage.php +++ b/modules/core/hooks/hook_frontpage.php @@ -10,24 +10,24 @@ function core_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['links']['frontpage_welcome'] = array( + $links['links']['frontpage_welcome'] = [ 'href' => SimpleSAML\Module::getModuleURL('core/frontpage_welcome.php'), 'text' => '{core:frontpage:welcome}', 'shorttext' => '{core:frontpage:welcome}', - ); - $links['links']['frontpage_config'] = array( + ]; + $links['links']['frontpage_config'] = [ 'href' => SimpleSAML\Module::getModuleURL('core/frontpage_config.php'), 'text' => '{core:frontpage:configuration}', 'shorttext' => '{core:frontpage:configuration}', - ); - $links['links']['frontpage_auth'] = array( + ]; + $links['links']['frontpage_auth'] = [ 'href' => SimpleSAML\Module::getModuleURL('core/frontpage_auth.php'), 'text' => '{core:frontpage:auth}', 'shorttext' => '{core:frontpage:auth}', - ); - $links['links']['frontpage_federation'] = array( + ]; + $links['links']['frontpage_federation'] = [ 'href' => SimpleSAML\Module::getModuleURL('core/frontpage_federation.php'), 'text' => '{core:frontpage:federation}', 'shorttext' => '{core:frontpage:federation}', - ); + ]; } diff --git a/modules/core/hooks/hook_sanitycheck.php b/modules/core/hooks/hook_sanitycheck.php index 2f40c8cfe3a3b43e31feec5c5a6ef2bdc8f14bf6..3e3dd52701492762fc5de3ab7dd0ed338bf5f072 100644 --- a/modules/core/hooks/hook_sanitycheck.php +++ b/modules/core/hooks/hook_sanitycheck.php @@ -28,13 +28,14 @@ function core_hook_sanitycheck(&$hookinfo) if (version_compare(phpversion(), '5.4', '>=')) { $hookinfo['info'][] = '[core] You are running a PHP version suitable for SimpleSAMLphp.'; } else { - $hookinfo['errors'][] = '[core] You are running an old PHP installation. Please check the requirements for your SimpleSAMLphp version and upgrade.'; + $hookinfo['errors'][] = '[core] You are running an old PHP installation. '. + 'Please check the requirements for your SimpleSAMLphp version and upgrade.'; } - $info = array(); - $mihookinfo = array( + $info = []; + $mihookinfo = [ 'info' => &$info, - ); + ]; $availmodules = SimpleSAML\Module::getModules(); SimpleSAML\Module::callHooks('moduleinfo', $mihookinfo); foreach ($info as $mi => $i) { diff --git a/modules/core/lib/ACL.php b/modules/core/lib/ACL.php index aa67c31c5bdf4880e098a5f5f2274455ff09477e..2c682a3e08d6bfa8aab90ae4eadcdee1f95e8fdf 100644 --- a/modules/core/lib/ACL.php +++ b/modules/core/lib/ACL.php @@ -40,7 +40,9 @@ class ACL $action = array_shift($rule); if ($action !== 'allow' && $action !== 'deny') { - throw new \SimpleSAML\Error\Exception('Invalid action in rule in access control list: '.var_export($action, true)); + throw new \SimpleSAML\Error\Exception( + 'Invalid action in rule in access control list: '.var_export($action, true) + ); } } $this->acl = $acl; @@ -85,6 +87,7 @@ class ACL return false; } } + return false; } /** @@ -153,7 +156,7 @@ class ACL $attributeName = array_shift($rule); if (!array_key_exists($attributeName, $attributes)) { - $attributeValues = array(); + $attributeValues = []; } else { $attributeValues = $attributes[$attributeName]; } @@ -193,7 +196,7 @@ class ACL $attributeName = array_shift($rule); if (!array_key_exists($attributeName, $attributes)) { - $attributeValues = array(); + $attributeValues = []; } else { $attributeValues = $attributes[$attributeName]; } @@ -234,7 +237,7 @@ class ACL $attributeName = array_shift($rule); if (!array_key_exists($attributeName, $attributes)) { - $attributeValues = array(); + $attributeValues = []; } else { $attributeValues = $attributes[$attributeName]; } @@ -261,7 +264,7 @@ class ACL $attributeName = array_shift($rule); if (!array_key_exists($attributeName, $attributes)) { - $attributeValues = array(); + $attributeValues = []; } else { $attributeValues = $attributes[$attributeName]; } diff --git a/modules/core/lib/Auth/Process/AttributeAdd.php b/modules/core/lib/Auth/Process/AttributeAdd.php index 076287f9f98b4946e026b44d9f7dca07ae9ab8e4..deb3ac310c4f1e8d6d4152080473dacaadc39814 100644 --- a/modules/core/lib/Auth/Process/AttributeAdd.php +++ b/modules/core/lib/Auth/Process/AttributeAdd.php @@ -23,7 +23,7 @@ class AttributeAdd extends \SimpleSAML\Auth\ProcessingFilter * * Assiciative array of arrays. */ - private $attributes = array(); + private $attributes = []; /** * Initialize this filter. @@ -48,7 +48,7 @@ class AttributeAdd extends \SimpleSAML\Auth\ProcessingFilter } if (!is_array($values)) { - $values = array($values); + $values = [$values]; } foreach ($values as $value) { if (!is_string($value)) { diff --git a/modules/core/lib/Auth/Process/AttributeAlter.php b/modules/core/lib/Auth/Process/AttributeAlter.php index 5672947c694497e26701c61b88df3489380e9ad1..0d181a0d7cd45700556bd4d121cf4c90da087704 100644 --- a/modules/core/lib/Auth/Process/AttributeAlter.php +++ b/modules/core/lib/Auth/Process/AttributeAlter.php @@ -135,7 +135,7 @@ class AttributeAlter extends \SimpleSAML\Auth\ProcessingFilter if ($this->replace) { // replace the whole value foreach ($attributes[$this->subject] as &$value) { - $matches = array(); + $matches = []; if (preg_match($this->pattern, $value, $matches) > 0) { $new_value = $matches[0]; @@ -146,15 +146,15 @@ class AttributeAlter extends \SimpleSAML\Auth\ProcessingFilter if ($this->subject === $this->target) { $value = $new_value; } else { - $attributes[$this->target] = array($new_value); + $attributes[$this->target] = [$new_value]; } } } } elseif ($this->remove) { // remove the whole value - $removedAttrs = array(); + $removedAttrs = []; foreach ($attributes[$this->subject] as $value) { - $matches = array(); + $matches = []; if (preg_match($this->pattern, $value, $matches) > 0) { $removedAttrs[] = $value; } @@ -168,7 +168,8 @@ class AttributeAlter extends \SimpleSAML\Auth\ProcessingFilter // replace only the part that matches if ($this->subject === $this->target) { $attributes[$this->target] = preg_replace( - $this->pattern, $this->replacement, + $this->pattern, + $this->replacement, $attributes[$this->subject] ); } else { diff --git a/modules/core/lib/Auth/Process/AttributeCopy.php b/modules/core/lib/Auth/Process/AttributeCopy.php index 44d3b71f00548e75fa1e460eab75985b3f274a55..1b54da17ae14826a5c6abe82c83b87fef681c6a3 100644 --- a/modules/core/lib/Auth/Process/AttributeCopy.php +++ b/modules/core/lib/Auth/Process/AttributeCopy.php @@ -23,7 +23,7 @@ class AttributeCopy extends \SimpleSAML\Auth\ProcessingFilter /** * Assosiative array with the mappings of attribute names. */ - private $map = array(); + private $map = []; /** * Initialize this filter, parse configuration @@ -38,7 +38,6 @@ class AttributeCopy extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($config)); foreach ($config as $source => $destination) { - if (!is_string($source)) { throw new \Exception('Invalid source attribute name: '.var_export($source, true)); } diff --git a/modules/core/lib/Auth/Process/AttributeLimit.php b/modules/core/lib/Auth/Process/AttributeLimit.php index f5ba3aaca3b28c9a36e4396a9d1180449bedf2b4..b90d1b0cdedad5ec6f3d34264254d30ec8128744 100644 --- a/modules/core/lib/Auth/Process/AttributeLimit.php +++ b/modules/core/lib/Auth/Process/AttributeLimit.php @@ -14,7 +14,7 @@ class AttributeLimit extends \SimpleSAML\Auth\ProcessingFilter /** * List of attributes which this filter will allow through. */ - private $allowedAttributes = array(); + private $allowedAttributes = []; /** * Whether the 'attributes' option in the metadata takes precedence. @@ -134,7 +134,7 @@ class AttributeLimit extends \SimpleSAML\Auth\ProcessingFilter private function filterAttributeValues(array $values, array $allowedConfigValues) { if (array_key_exists('regex', $allowedConfigValues) && $allowedConfigValues['regex'] === true) { - $matchedValues = array(); + $matchedValues = []; foreach ($allowedConfigValues as $option => $pattern) { if (!is_int($option)) { // Ignore any configuration options in $allowedConfig. e.g. regex=>true diff --git a/modules/core/lib/Auth/Process/AttributeMap.php b/modules/core/lib/Auth/Process/AttributeMap.php index 42ab192631b2b3fed5e3ec4ce40b3e6aac82135e..cedde6877a536992a6b8e6c312f88f1b487efa85 100644 --- a/modules/core/lib/Auth/Process/AttributeMap.php +++ b/modules/core/lib/Auth/Process/AttributeMap.php @@ -14,7 +14,7 @@ class AttributeMap extends \SimpleSAML\Auth\ProcessingFilter /** * Associative array with the mappings of attribute names. */ - private $map = array(); + private $map = []; /** * Should attributes be duplicated or renamed. @@ -35,7 +35,7 @@ class AttributeMap extends \SimpleSAML\Auth\ProcessingFilter parent::__construct($config, $reserved); assert(is_array($config)); - $mapFiles = array(); + $mapFiles = []; foreach ($config as $origName => $newName) { if (is_int($origName)) { @@ -117,7 +117,7 @@ class AttributeMap extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($request)); assert(array_key_exists('Attributes', $request)); - $mapped_attributes = array(); + $mapped_attributes = []; foreach ($request['Attributes'] as $name => $values) { if (array_key_exists($name, $this->map)) { diff --git a/modules/core/lib/Auth/Process/AttributeRealm.php b/modules/core/lib/Auth/Process/AttributeRealm.php index 866dbb0dcfd70cd91530f0c3d6f241aeb3c2ed2e..f6366e9fe66abb5cd0cd219d173dae82ba3cc7fc 100644 --- a/modules/core/lib/Auth/Process/AttributeRealm.php +++ b/modules/core/lib/Auth/Process/AttributeRealm.php @@ -53,6 +53,6 @@ class AttributeRealm extends \SimpleSAML\Auth\ProcessingFilter if (count($decomposed) !== 2) { return; } - $request['Attributes'][$this->attributename] = array($decomposed[1]); + $request['Attributes'][$this->attributename] = [$decomposed[1]]; } } diff --git a/modules/core/lib/Auth/Process/AttributeValueMap.php b/modules/core/lib/Auth/Process/AttributeValueMap.php index 15dce8e16da93f3f09110e2a6c9e54969b578ac6..9979ea66f27b8d5768c89c122ec10dddbc6be795 100644 --- a/modules/core/lib/Auth/Process/AttributeValueMap.php +++ b/modules/core/lib/Auth/Process/AttributeValueMap.php @@ -24,7 +24,7 @@ class AttributeValueMap extends \SimpleSAML\Auth\ProcessingFilter /** * The required $sourceattribute values and target affiliations. */ - private $values = array(); + private $values = []; /** * Whether $sourceattribute should be kept or not. @@ -114,12 +114,12 @@ class AttributeValueMap extends \SimpleSAML\Auth\ProcessingFilter } $sourceattribute = $attributes[$this->sourceattribute]; - $targetvalues = array(); + $targetvalues = []; if (is_array($sourceattribute)) { foreach ($this->values as $value => $values) { if (!is_array($values)) { - $values = array($values); + $values = [$values]; } if (count(array_intersect($values, $sourceattribute)) > 0) { \SimpleSAML\Logger::debug("AttributeValueMap: intersect match for '$value'"); diff --git a/modules/core/lib/Auth/Process/Cardinality.php b/modules/core/lib/Auth/Process/Cardinality.php index 6f85b8b393d4adc02c4278fc8f804c2f834695a3..ac4f1aad1edca4ca87a0ab54c71b40fe28fe9902 100644 --- a/modules/core/lib/Auth/Process/Cardinality.php +++ b/modules/core/lib/Auth/Process/Cardinality.php @@ -2,7 +2,7 @@ namespace SimpleSAML\Module\core\Auth\Process; -use SimpleSAML\Utils\HTTPAdapter; +use SimpleSAML\Utils\HttpAdapter; /** * Filter to ensure correct cardinality of attributes @@ -14,10 +14,10 @@ use SimpleSAML\Utils\HTTPAdapter; class Cardinality extends \SimpleSAML\Auth\ProcessingFilter { /** @var array Associative array with the mappings of attribute names. */ - private $cardinality = array(); + private $cardinality = []; /** @var array Entities that should be ignored */ - private $ignoreEntities = array(); + private $ignoreEntities = []; /** @var HTTPAdapter */ private $http; @@ -30,12 +30,12 @@ class Cardinality extends \SimpleSAML\Auth\ProcessingFilter * @param HTTPAdapter $http HTTP utility service (handles redirects). * @throws \SimpleSAML\Error\Exception */ - public function __construct($config, $reserved, HTTPAdapter $http = null) + public function __construct($config, $reserved, HttpAdapter $http = null) { parent::__construct($config, $reserved); assert(is_array($config)); - $this->http = $http ? : new HTTPAdapter(); + $this->http = $http ? : new HttpAdapter(); foreach ($config as $attribute => $rules) { if ($attribute === '%ignoreEntities') { @@ -46,7 +46,7 @@ class Cardinality extends \SimpleSAML\Auth\ProcessingFilter if (!is_string($attribute)) { throw new \SimpleSAML\Error\Exception('Invalid attribute name: '.var_export($attribute, true)); } - $this->cardinality[$attribute] = array('warn' => false); + $this->cardinality[$attribute] = ['warn' => false]; /* allow either positional or name-based parameters */ if (isset($rules[0])) { @@ -114,23 +114,30 @@ class Cardinality extends \SimpleSAML\Auth\ProcessingFilter } foreach ($request['Attributes'] as $k => $v) { - if (!array_key_exists($k, $this->cardinality)) { continue; } if (!is_array($v)) { - $v = array($v); + $v = [$v]; } /* minimum cardinality */ if (count($v) < $this->cardinality[$k]['min']) { if ($this->cardinality[$k]['warn']) { - \SimpleSAML\Logger::warning(sprintf( - 'Cardinality: attribute %s from %s does not meet minimum cardinality of %d (%d)', - $k, $entityid, $this->cardinality[$k]['min'], count($v) - )); + \SimpleSAML\Logger::warning( + sprintf( + 'Cardinality: attribute %s from %s does not meet minimum cardinality of %d (%d)', + $k, + $entityid, + $this->cardinality[$k]['min'], + count($v) + ) + ); } else { - $request['core:cardinality:errorAttributes'][$k] = array(count($v), $this->cardinality[$k]['_expr']); + $request['core:cardinality:errorAttributes'][$k] = [ + count($v), + $this->cardinality[$k]['_expr'] + ]; } continue; } @@ -138,12 +145,20 @@ class Cardinality extends \SimpleSAML\Auth\ProcessingFilter /* maximum cardinality */ if (array_key_exists('max', $this->cardinality[$k]) && count($v) > $this->cardinality[$k]['max']) { if ($this->cardinality[$k]['warn']) { - \SimpleSAML\Logger::warning(sprintf( - 'Cardinality: attribute %s from %s does not meet maximum cardinality of %d (%d)', - $k, $entityid, $this->cardinality[$k]['max'], count($v) - )); + \SimpleSAML\Logger::warning( + sprintf( + 'Cardinality: attribute %s from %s does not meet maximum cardinality of %d (%d)', + $k, + $entityid, + $this->cardinality[$k]['max'], + count($v) + ) + ); } else { - $request['core:cardinality:errorAttributes'][$k] = array(count($v), $this->cardinality[$k]['_expr']); + $request['core:cardinality:errorAttributes'][$k] = [ + count($v), + $this->cardinality[$k]['_expr'] + ]; } continue; } @@ -157,10 +172,14 @@ class Cardinality extends \SimpleSAML\Auth\ProcessingFilter if ($this->cardinality[$k]['warn']) { \SimpleSAML\Logger::warning(sprintf( 'Cardinality: attribute %s from %s is missing', - $k, $entityid + $k, + $entityid )); } else { - $request['core:cardinality:errorAttributes'][$k] = array(0, $this->cardinality[$k]['_expr']); + $request['core:cardinality:errorAttributes'][$k] = [ + 0, + $this->cardinality[$k]['_expr'] + ]; } } @@ -168,7 +187,7 @@ class Cardinality extends \SimpleSAML\Auth\ProcessingFilter if (array_key_exists('core:cardinality:errorAttributes', $request)) { $id = \SimpleSAML\Auth\State::saveState($request, 'core:cardinality'); $url = \SimpleSAML\Module::getModuleURL('core/cardinality_error.php'); - $this->http->redirectTrustedURL($url, array('StateId' => $id)); + $this->http->redirectTrustedURL($url, ['StateId' => $id]); return; } } diff --git a/modules/core/lib/Auth/Process/CardinalitySingle.php b/modules/core/lib/Auth/Process/CardinalitySingle.php index be7707e597f9898e2e72523ede3b795c95eb8095..ac251319beef8ffe40c2e15e3da4db498bd4798b 100644 --- a/modules/core/lib/Auth/Process/CardinalitySingle.php +++ b/modules/core/lib/Auth/Process/CardinalitySingle.php @@ -17,19 +17,19 @@ use SimpleSAML\Utils\HttpAdapter; class CardinalitySingle extends \SimpleSAML\Auth\ProcessingFilter { /** @var array Attributes that should be single-valued or we generate an error */ - private $singleValued = array(); + private $singleValued = []; /** @var array Attributes for which the first value should be taken */ - private $firstValue = array(); + private $firstValue = []; /** @var array Attributes that can be flattened to a single value */ - private $flatten = array(); + private $flatten = []; /** @var string Separator for flattened value */ private $flattenWith = ';'; /** @var array Entities that should be ignored */ - private $ignoreEntities = array(); + private $ignoreEntities = []; /** @var HTTPAdapter */ private $http; @@ -41,12 +41,12 @@ class CardinalitySingle extends \SimpleSAML\Auth\ProcessingFilter * @param mixed $reserved For future use. * @param HTTPAdapter $http HTTP utility service (handles redirects). */ - public function __construct($config, $reserved, HTTPAdapter $http = null) + public function __construct($config, $reserved, HttpAdapter $http = null) { parent::__construct($config, $reserved); assert(is_array($config)); - $this->http = $http ? : new HTTPAdapter(); + $this->http = $http ? : new HttpAdapter(); if (array_key_exists('singleValued', $config)) { $this->singleValued = $config['singleValued']; @@ -55,7 +55,11 @@ class CardinalitySingle extends \SimpleSAML\Auth\ProcessingFilter $this->firstValue = $config['firstValue']; } if (array_key_exists('flattenWith', $config)) { - $this->flattenWith = is_array($config['flattenWith']) ? array_shift($config['flattenWith']) : $config['flattenWith']; + if (is_array($config['flattenWith'])) { + $this->flattenWith = array_shift($config['flattenWith']); + } else { + $this->flattenWith = $config['flattenWith']; + } } if (array_key_exists('flatten', $config)) { $this->flatten = $config['flatten']; @@ -96,15 +100,15 @@ class CardinalitySingle extends \SimpleSAML\Auth\ProcessingFilter } if (in_array($k, $this->singleValued)) { - $request['core:cardinality:errorAttributes'][$k] = array(count($v), '0 ≤ n ≤ 1'); + $request['core:cardinality:errorAttributes'][$k] = [count($v), '0 ≤ n ≤ 1']; continue; } if (in_array($k, $this->firstValue)) { - $request['Attributes'][$k] = array(array_shift($v)); + $request['Attributes'][$k] = [array_shift($v)]; continue; } if (in_array($k, $this->flatten)) { - $request['Attributes'][$k] = array(implode($this->flattenWith, $v)); + $request['Attributes'][$k] = [implode($this->flattenWith, $v)]; continue; } } @@ -113,7 +117,7 @@ class CardinalitySingle extends \SimpleSAML\Auth\ProcessingFilter if (array_key_exists('core:cardinality:errorAttributes', $request)) { $id = \SimpleSAML\Auth\State::saveState($request, 'core:cardinality'); $url = \SimpleSAML\Module::getModuleURL('core/cardinality_error.php'); - $this->http->redirectTrustedURL($url, array('StateId' => $id)); + $this->http->redirectTrustedURL($url, ['StateId' => $id]); return; } } diff --git a/modules/core/lib/Auth/Process/ExtendIdPSession.php b/modules/core/lib/Auth/Process/ExtendIdPSession.php index 4d28c5cf7f2ed7efddf68d05effa137f90bc9c23..92102262b572ee8d0b0bfb07e35ef011c106c9a8 100644 --- a/modules/core/lib/Auth/Process/ExtendIdPSession.php +++ b/modules/core/lib/Auth/Process/ExtendIdPSession.php @@ -35,7 +35,9 @@ class ExtendIdPSession extends \SimpleSAML\Auth\ProcessingFilter // If remember me is active $rememberMeExpire = $session->getRememberMeExpire(); - if (!empty($state['RememberMe']) && $rememberMeExpire !== null && $globalConfig->getBoolean('session.rememberme.enable', false)) { + if (!empty($state['RememberMe']) && $rememberMeExpire !== null && + $globalConfig->getBoolean('session.rememberme.enable', false) + ) { $session->setRememberMeExpire(); return; } diff --git a/modules/core/lib/Auth/Process/GenerateGroups.php b/modules/core/lib/Auth/Process/GenerateGroups.php index 12af86f803370ea8af16ff46b09269b5cf62f89c..ab9d15aad0498e93e46fc9f4e2552455b9529912 100644 --- a/modules/core/lib/Auth/Process/GenerateGroups.php +++ b/modules/core/lib/Auth/Process/GenerateGroups.php @@ -30,11 +30,11 @@ class GenerateGroups extends \SimpleSAML\Auth\ProcessingFilter if (count($config) === 0) { // Use default groups - $this->generateGroupsFrom = array( + $this->generateGroupsFrom = [ 'eduPersonAffiliation', 'eduPersonOrgUnitDN', 'eduPersonEntitlement', - ); + ]; } else { // Validate configuration foreach ($config as $attributeName) { @@ -57,7 +57,7 @@ class GenerateGroups extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($request)); assert(array_key_exists('Attributes', $request)); - $groups = array(); + $groups = []; $attributes = &$request['Attributes']; $realm = self::getRealm($attributes); @@ -135,7 +135,7 @@ class GenerateGroups extends \SimpleSAML\Auth\ProcessingFilter return preg_replace_callback( '/([^a-zA-Z0-9_@=.])/', - function($m) { + function ($m) { return sprintf("%%%02x", ord($m[1])); }, $string diff --git a/modules/core/lib/Auth/Process/LanguageAdaptor.php b/modules/core/lib/Auth/Process/LanguageAdaptor.php index bcd4210fb5a99bcfbba2bd74ac69c305b8344a1a..771fb6357216575621aeaa067b77036e77c34e3a 100644 --- a/modules/core/lib/Auth/Process/LanguageAdaptor.php +++ b/modules/core/lib/Auth/Process/LanguageAdaptor.php @@ -62,7 +62,7 @@ class LanguageAdaptor extends \SimpleSAML\Auth\ProcessingFilter \SimpleSAML\Locale\Language::setLanguageCookie($attrlang); } elseif (!isset($attrlang) && isset($lang)) { // Language set in cookie, but not in attribute. Update attribute - $request['Attributes'][$this->langattr] = array($lang); + $request['Attributes'][$this->langattr] = [$lang]; } } } diff --git a/modules/core/lib/Auth/Process/PHP.php b/modules/core/lib/Auth/Process/PHP.php index 7a538ec1bb3e3964371d7f8d748354039fb97d54..064f86bc45977e6273d80b9cdf9d2853e1ec5a22 100644 --- a/modules/core/lib/Auth/Process/PHP.php +++ b/modules/core/lib/Auth/Process/PHP.php @@ -49,7 +49,9 @@ class PHP extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($request)); assert(array_key_exists('Attributes', $request)); - $function = function(/** @scrutinizer ignore-unused */ &$attributes) { eval($this->code); }; - $function($request['Attributes']); + $function = function (/** @scrutinizer ignore-unused */ &$attributes, &$state) { + eval($this->code); + }; + $function($request['Attributes'], $request); } } diff --git a/modules/core/lib/Auth/Process/ScopeAttribute.php b/modules/core/lib/Auth/Process/ScopeAttribute.php index 46605783afcfdb66745c556635e2ea426e8a195a..1db7d3c18a1bf3dd3f1f4cc1a3d1cc1bd090d7d7 100644 --- a/modules/core/lib/Auth/Process/ScopeAttribute.php +++ b/modules/core/lib/Auth/Process/ScopeAttribute.php @@ -78,7 +78,7 @@ class ScopeAttribute extends \SimpleSAML\Auth\ProcessingFilter } if (!isset($attributes[$this->targetAttribute])) { - $attributes[$this->targetAttribute] = array(); + $attributes[$this->targetAttribute] = []; } if ($this->onlyIfEmpty && count($attributes[$this->targetAttribute]) > 0) { diff --git a/modules/core/lib/Auth/Process/ScopeFromAttribute.php b/modules/core/lib/Auth/Process/ScopeFromAttribute.php index 8497fbb058c42eb9c469155c8409ff4ba877181c..b043de9fd86a0c58ba16e8d332b730c26ded02f6 100644 --- a/modules/core/lib/Auth/Process/ScopeFromAttribute.php +++ b/modules/core/lib/Auth/Process/ScopeFromAttribute.php @@ -80,7 +80,7 @@ class ScopeFromAttribute extends \SimpleSAML\Auth\ProcessingFilter $scopeIndex = strrpos($sourceAttrVal, '@'); if ($scopeIndex !== false) { - $attributes[$this->targetAttribute] = array(); + $attributes[$this->targetAttribute] = []; $scope = substr($sourceAttrVal, $scopeIndex + 1); $attributes[$this->targetAttribute][] = $scope; \SimpleSAML\Logger::debug('ScopeFromAttribute: Inserted new attribute '. diff --git a/modules/core/lib/Auth/Process/TargetedID.php b/modules/core/lib/Auth/Process/TargetedID.php index 99ebdc04e36d16cb5d892bdfe387a2ca5e3af399..5ea29bec74a42d27d769e0c8c412f99b240761c8 100644 --- a/modules/core/lib/Auth/Process/TargetedID.php +++ b/modules/core/lib/Auth/Process/TargetedID.php @@ -139,7 +139,7 @@ class TargetedID extends \SimpleSAML\Auth\ProcessingFilter $nameId = $uid; } - $state['Attributes']['eduPersonTargetedID'] = array($nameId); + $state['Attributes']['eduPersonTargetedID'] = [$nameId]; } /** diff --git a/modules/core/lib/Auth/Process/WarnShortSSOInterval.php b/modules/core/lib/Auth/Process/WarnShortSSOInterval.php index 6e6d392b9cc998292fc20e577392abad72a4c8fe..1d488b9db935886a2a2e2359ffddaf10ef3e4e56 100644 --- a/modules/core/lib/Auth/Process/WarnShortSSOInterval.php +++ b/modules/core/lib/Auth/Process/WarnShortSSOInterval.php @@ -48,6 +48,6 @@ class WarnShortSSOInterval extends \SimpleSAML\Auth\ProcessingFilter // Save state and redirect $id = \SimpleSAML\Auth\State::saveState($state, 'core:short_sso_interval'); $url = \SimpleSAML\Module::getModuleURL('core/short_sso_interval.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } } diff --git a/modules/core/lib/Auth/Source/AdminPassword.php b/modules/core/lib/Auth/Source/AdminPassword.php index e7e11874643880646d18dd2877932d6aa77841ef..45ce4c2696bb2514f9b579fcdf29f8c4dbcc1431 100644 --- a/modules/core/lib/Auth/Source/AdminPassword.php +++ b/modules/core/lib/Auth/Source/AdminPassword.php @@ -60,6 +60,6 @@ class AdminPassword extends \SimpleSAML\Module\core\Auth\UserPassBase if (!\SimpleSAML\Utils\Crypto::pwValid($adminPassword, $password)) { throw new \SimpleSAML\Error\Error('WRONGUSERPASS'); } - return array('user' => array('admin')); + return ['user' => ['admin']]; } } diff --git a/modules/core/lib/Auth/UserPassBase.php b/modules/core/lib/Auth/UserPassBase.php index eb426d19d2af8841b46f57dd62fa3ed2aefd8f12..5f0ee4ffa33040da24c254c4f1ffe34fa691d031 100644 --- a/modules/core/lib/Auth/UserPassBase.php +++ b/modules/core/lib/Auth/UserPassBase.php @@ -217,7 +217,7 @@ abstract class UserPassBase extends \SimpleSAML\Auth\Source * state array as a parameter to the login form. */ $url = \SimpleSAML\Module::getModuleURL('core/loginuserpass.php'); - $params = array('AuthState' => $id); + $params = ['AuthState' => $id]; \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, $params); // The previous function never returns, so this code is never executed. diff --git a/modules/core/lib/Auth/UserPassOrgBase.php b/modules/core/lib/Auth/UserPassOrgBase.php index d7a718cd828724911c7007313c4db02af4d6fb2f..33168524c85c692c1f19fac1b3f08b684e3c3878 100644 --- a/modules/core/lib/Auth/UserPassOrgBase.php +++ b/modules/core/lib/Auth/UserPassOrgBase.php @@ -130,7 +130,7 @@ abstract class UserPassOrgBase extends \SimpleSAML\Auth\Source */ protected function setUsernameOrgMethod($usernameOrgMethod) { - assert(in_array($usernameOrgMethod, array('none', 'allow', 'force'), true)); + assert(in_array($usernameOrgMethod, ['none', 'allow', 'force'], true)); $this->usernameOrgMethod = $usernameOrgMethod; } @@ -205,7 +205,7 @@ abstract class UserPassOrgBase extends \SimpleSAML\Auth\Source $id = \SimpleSAML\Auth\State::saveState($state, self::STAGEID); $url = \SimpleSAML\Module::getModuleURL('core/loginuserpassorg.php'); - $params = array('AuthState' => $id); + $params = ['AuthState' => $id]; \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, $params); } diff --git a/modules/core/lib/Stats/Output/File.php b/modules/core/lib/Stats/Output/File.php index 1e6941c214f05b6809b74fe65a8f0c59bf6a7c18..cac817c83b784f5e7fca13d3a6dca81d0497ab18 100644 --- a/modules/core/lib/Stats/Output/File.php +++ b/modules/core/lib/Stats/Output/File.php @@ -18,7 +18,7 @@ class File extends \SimpleSAML\Stats\Output /** * The file handle for the current file. - * @var resource + * @var resource|null|false */ private $file = null; diff --git a/modules/core/lib/Stats/Output/Log.php b/modules/core/lib/Stats/Output/Log.php index 41d04ddf7fc90ec0fec5011839d3deb33e138f8c..e3eff86663cac6955df4ff620944547578e4d415 100644 --- a/modules/core/lib/Stats/Output/Log.php +++ b/modules/core/lib/Stats/Output/Log.php @@ -24,7 +24,7 @@ class Log extends \SimpleSAML\Stats\Output public function __construct(\SimpleSAML\Configuration $config) { $logLevel = $config->getString('level', 'notice'); - $this->logger = array('\SimpleSAML\Logger', $logLevel); + $this->logger = ['\SimpleSAML\Logger', $logLevel]; if (!is_callable($this->logger)) { throw new \Exception('Invalid log level: '.var_export($logLevel, true)); } diff --git a/modules/core/lib/Storage/SQLPermanentStorage.php b/modules/core/lib/Storage/SQLPermanentStorage.php index 8b73c77a8e1e2d1c5ab95d2e4a9feac0a1279d2a..4360d5e84ad015e37438810cdc61712a85aef9ee 100644 --- a/modules/core/lib/Storage/SQLPermanentStorage.php +++ b/modules/core/lib/Storage/SQLPermanentStorage.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Module\core\Storage; /** * SQLPermanentStorage - * + * * Generic SQL Store to store key value pairs. To be used in several other modules that needs * to store data permanently. * @@ -26,7 +26,7 @@ class SQLPermanentStorage if (!is_dir($datadir)) { throw new \Exception('Data directory ['.$datadir.'] does not exist'); - } else if (!is_writable($datadir)) { + } elseif (!is_writable($datadir)) { throw new \Exception('Data directory ['.$datadir.'] is not writable'); } @@ -51,7 +51,7 @@ class SQLPermanentStorage PRIMARY KEY (key1,key2,type) ); '); - } + } } else { throw new \Exception('Error creating SQL lite database ['.$dbfile.'].'); } @@ -73,10 +73,10 @@ class SQLPermanentStorage $query = "INSERT INTO data (key1, key2, type, created, updated, expire, value)". " VALUES(:key1, :key2, :type, :created, :updated, :expire, :value)"; $prepared = $this->db->prepare($query); - $data = array(':key1' => $key1, ':key2' => $key2, + $data = [':key1' => $key1, ':key2' => $key2, ':type' => $type, ':created' => time(), ':updated' => time(), ':expire' => $expire, - ':value' => serialize($value)); + ':value' => serialize($value)]; $prepared->execute($data); $results = $prepared->fetchAll(\PDO::FETCH_ASSOC); return $results; @@ -86,11 +86,12 @@ class SQLPermanentStorage { $expire = is_null($duration) ? null : (time() + $duration); - $query = "UPDATE data SET updated = :updated, value = :value, expire = :expire WHERE key1 = :key1 AND key2 = :key2 AND type = :type"; + $query = "UPDATE data SET updated = :updated, value = :value, ". + "expire = :expire WHERE key1 = :key1 AND key2 = :key2 AND type = :type"; $prepared = $this->db->prepare($query); - $data = array(':key1' => $key1, ':key2' => $key2, + $data = [':key1' => $key1, ':key2' => $key2, ':type' => $type, ':updated' => time(), - ':expire' => $expire, ':value' => serialize($value)); + ':expire' => $expire, ':value' => serialize($value)]; $prepared->execute($data); $results = $prepared->fetchAll(\PDO::FETCH_ASSOC); return $results; @@ -129,7 +130,7 @@ class SQLPermanentStorage { $query = 'SELECT * FROM data WHERE type = :type AND key1 = :key1 AND key2 = :key2 LIMIT 1'; $prepared = $this->db->prepare($query); - $data = array(':type' => $type, ':key1' => $key1, ':key2' => $key2); + $data = [':type' => $type, ':key1' => $key1, ':key2' => $key2]; $prepared->execute($data); $results = $prepared->fetchAll(\PDO::FETCH_ASSOC); return (count($results) == 1); @@ -155,14 +156,14 @@ class SQLPermanentStorage public function getKeys($type = null, $key1 = null, $key2 = null, $whichKey = 'type') { - if (!in_array($whichKey, array('key1', 'key2', 'type'), true)) { + if (!in_array($whichKey, ['key1', 'key2', 'type'], true)) { throw new \Exception('Invalid key type'); } $conditions = $this->getCondition($type, $key1, $key2); $query = 'SELECT DISTINCT :whichKey FROM data WHERE '.$conditions; $prepared = $this->db->prepare($query); - $data = array('whichKey' => $whichKey); + $data = ['whichKey' => $whichKey]; $prepared->execute($data); $results = $prepared->fetchAll(\PDO::FETCH_ASSOC); @@ -170,7 +171,7 @@ class SQLPermanentStorage return null; } - $resarray = array(); + $resarray = []; foreach ($results as $key => $value) { $resarray[] = $value[$whichKey]; } @@ -181,7 +182,7 @@ class SQLPermanentStorage { $query = 'DELETE FROM data WHERE type = :type AND key1 = :key1 AND key2 = :key2'; $prepared = $this->db->prepare($query); - $data = array(':type' => $type, ':key1' => $key1, ':key2' => $key2); + $data = [':type' => $type, ':key1' => $key1, ':key2' => $key2]; $prepared->execute($data); $results = $prepared->fetchAll(\PDO::FETCH_ASSOC); return (count($results) == 1); @@ -191,7 +192,7 @@ class SQLPermanentStorage { $query = "DELETE FROM data WHERE expire IS NOT NULL AND expire < :expire"; $prepared = $this->db->prepare($query); - $data = array(':expire' => time()); + $data = [':expire' => time()]; $prepared->execute($data); return $prepared->rowCount(); } @@ -201,7 +202,7 @@ class SQLPermanentStorage */ private function getCondition($type = null, $key1 = null, $key2 = null) { - $conditions = array(); + $conditions = []; if (!is_null($type)) { $conditions[] = "type = ".$this->db->quote($type); } @@ -216,4 +217,3 @@ class SQLPermanentStorage return join(' AND ', $conditions); } } - diff --git a/modules/core/locales/ar/LC_MESSAGES/core.po b/modules/core/locales/ar/LC_MESSAGES/core.po index 35c36fccd75b73807530865718ffc9db311c47ce..84c0fc10ca1ca5631ce6175e2751a6bf68f3f968 100644 --- a/modules/core/locales/ar/LC_MESSAGES/core.po +++ b/modules/core/locales/ar/LC_MESSAGES/core.po @@ -179,8 +179,8 @@ msgid "{core:frontpage:warnings_https}" msgstr "" "<strong>انت لا تستخدم HTTPS</strong> - Ů…Řادثة Ů…Ř´Ůرة Ů…Řą المستخدم. HTTP جيد" " للاختبارات Ů„Ůن ŮŮŠ بيئة النظام المبدئي ينبغي استخدام HTTPS. [ <a " -"href=\"http://rnd.feide.no/contents/simplesamlphp-maintenance-and-" -"configuration\">read more about SimpleSAMLphp maintenance</a>]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">read more about SimpleSAMLphp maintenance</a>]" msgid "{core:frontpage:federation}" msgstr "الدخŮŮ„ المŮŘŘŻ" @@ -376,8 +376,8 @@ msgid "" msgstr "" "<strong>انت لا تستخدم HTTPS</strong> - Ů…Řادثة Ů…Ř´Ůرة Ů…Řą المستخدم. HTTP جيد" " للاختبارات Ů„Ůن ŮŮŠ بيئة النظام المبدئي ينبغي استخدام HTTPS. [ <a " -"href=\"http://rnd.feide.no/contents/simplesamlphp-maintenance-and-" -"configuration\">read more about SimpleSAMLphp maintenance</a>]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">read more about SimpleSAMLphp maintenance</a>]" msgid "Metadata" msgstr "البيانات الŮصŮŮŠŘ©/الميتاداتا " diff --git a/modules/core/locales/cs/LC_MESSAGES/core.po b/modules/core/locales/cs/LC_MESSAGES/core.po index 5293daa9a89a9e34e3006e15654f769a89f56b1a..0c5a0b5c613eeca008b188e005dd65acbe14d84d 100644 --- a/modules/core/locales/cs/LC_MESSAGES/core.po +++ b/modules/core/locales/cs/LC_MESSAGES/core.po @@ -184,8 +184,8 @@ msgid "{core:frontpage:warnings_https}" msgstr "" "<strong>NepouĹľĂváte HTTPS</strong> - šivrovanou komunikaci s uĹľivatelem. " "HTTP je vhodnĂ© jen k testovacĂm účelĹŻm, pro produkÄŤnà účely pouĹľijte " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">ÄŚtete vĂce o ĂşdrĹľbÄ› SimpleSAMLphp</a> ]" +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ÄŚtete vĂce o ĂşdrĹľbÄ› SimpleSAMLphp</a> ]" msgid "{core:frontpage:federation}" msgstr "Federace" @@ -386,8 +386,8 @@ msgid "" msgstr "" "<strong>NepouĹľĂváte HTTPS</strong> - šivrovanou komunikaci s uĹľivatelem. " "HTTP je vhodnĂ© jen k testovacĂm účelĹŻm, pro produkÄŤnà účely pouĹľijte " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">ÄŚtete vĂce o ĂşdrĹľbÄ› SimpleSAMLphp</a> ]" +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ÄŚtete vĂce o ĂşdrĹľbÄ› SimpleSAMLphp</a> ]" msgid "Metadata" msgstr "Metadata" diff --git a/modules/core/locales/da/LC_MESSAGES/core.po b/modules/core/locales/da/LC_MESSAGES/core.po index 6ae96bedf513a9cab2613878602f2367971ed107..ed0dbe54c6bce2d86f1b9ce9b4b3234e70875041 100644 --- a/modules/core/locales/da/LC_MESSAGES/core.po +++ b/modules/core/locales/da/LC_MESSAGES/core.po @@ -188,8 +188,8 @@ msgstr "" "brugeren. SimpleSAMLphp vil fungere uden problemer med HTTP alene, men " "hvis du anvender systemet i produktionssystemer, anbefales det stærkt at " "benytte sikker kommunikation i form af HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">læs mere i dokumentet: SimpleSAMLphp maintenance</a> ] " +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">læs mere i dokumentet: SimpleSAMLphp maintenance</a> ] " msgid "{core:frontpage:federation}" msgstr "Føderation" @@ -388,8 +388,8 @@ msgstr "" "brugeren. SimpleSAMLphp vil fungere uden problemer med HTTP alene, men " "hvis du anvender systemet i produktionssystemer, anbefales det stærkt at " "benytte sikker kommunikation i form af HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">læs mere i dokumentet: SimpleSAMLphp maintenance</a> ] " +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">læs mere i dokumentet: SimpleSAMLphp maintenance</a> ] " msgid "Metadata" msgstr "Metadata" diff --git a/modules/core/locales/de/LC_MESSAGES/core.po b/modules/core/locales/de/LC_MESSAGES/core.po index 5aff6c3654100ae20734a5e0706d5b94c4bafffc..c6648ced42ba13a2c629d44045331a7dcd68f94d 100644 --- a/modules/core/locales/de/LC_MESSAGES/core.po +++ b/modules/core/locales/de/LC_MESSAGES/core.po @@ -184,8 +184,8 @@ msgstr "" "<strong>Sie benutzen keine HTTPS</strong> - verschlĂĽsselte Kommunikation " "mit dem Nutzer. SimpleSAMLphp funktioniert zum Testen auch mit HTTP " "problemlos, aber in einer Produktionsumgebung sollten Sie HTTPS benutzen." -" [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Lesen sie mehr ĂĽber die Verwaltung von SimpleSAMLphp</a> " +" [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Lesen sie mehr ĂĽber die Verwaltung von SimpleSAMLphp</a> " "]" msgid "{core:frontpage:federation}" @@ -393,8 +393,8 @@ msgstr "" "<strong>Sie benutzen keine HTTPS</strong> - verschlĂĽsselte Kommunikation " "mit dem Nutzer. SimpleSAMLphp funktioniert zum Testen auch mit HTTP " "problemlos, aber in einer Produktionsumgebung sollten Sie HTTPS benutzen." -" [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Lesen sie mehr ĂĽber die Verwaltung von SimpleSAMLphp</a> " +" [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Lesen sie mehr ĂĽber die Verwaltung von SimpleSAMLphp</a> " "]" msgid "Metadata" diff --git a/modules/core/locales/el/LC_MESSAGES/core.po b/modules/core/locales/el/LC_MESSAGES/core.po index f99d522c286dd0a4745cfdf745c020ff909c72c4..a2f7c1563303b807287a7828262619075a2bc061 100644 --- a/modules/core/locales/el/LC_MESSAGES/core.po +++ b/modules/core/locales/el/LC_MESSAGES/core.po @@ -206,8 +206,8 @@ msgstr "" "Δεν χĎηĎιμοποιείτε <strong>HTTPS</strong> για ÎşĎυπτογĎαφημÎνη επικοινωνία" " με τον χĎήĎτη. Το HTTP επαĎκεί για δοκιμαĎτικούς Ďκοπούς, ωĎĎ„ĎŚĎÎż Ďε " "πεĎιβάλλον παĎαγωγής θα Ď€ĎÎπει να χĎηĎιμοποιήĎετε HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">ΔιαβάĎτε πεĎÎąĎĎότεĎα...</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ΔιαβάĎτε πεĎÎąĎĎότεĎα...</a> ]" msgid "{core:frontpage:federation}" msgstr "ΟμοĎπονδία" @@ -427,8 +427,8 @@ msgstr "" "Δεν χĎηĎιμοποιείτε <strong>HTTPS</strong> για ÎşĎυπτογĎαφημÎνη επικοινωνία" " με τον χĎήĎτη. Το HTTP επαĎκεί για δοκιμαĎτικούς Ďκοπούς, ωĎĎ„ĎŚĎÎż Ďε " "πεĎιβάλλον παĎαγωγής θα Ď€ĎÎπει να χĎηĎιμοποιήĎετε HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">ΔιαβάĎτε πεĎÎąĎĎότεĎα...</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ΔιαβάĎτε πεĎÎąĎĎότεĎα...</a> ]" msgid "Metadata" msgstr "ΜεταδεδομÎνα" diff --git a/modules/core/locales/en/LC_MESSAGES/core.po b/modules/core/locales/en/LC_MESSAGES/core.po index 38593a5ecbbab02d56d6d70cac9726181e034681..470d08a3df25530f15743a4499ff3e4a06679917 100644 --- a/modules/core/locales/en/LC_MESSAGES/core.po +++ b/modules/core/locales/en/LC_MESSAGES/core.po @@ -166,6 +166,9 @@ msgstr "You are logged in as administrator" msgid "{core:frontpage:auth}" msgstr "Authentication" +msgid "{core:frontpage:logout}" +msgstr "Logout" + msgid "{core:no_metadata:suggestion_user_link}" msgstr "" "If you are an user who received this error after following a link on a " diff --git a/modules/core/locales/eu/LC_MESSAGES/core.po b/modules/core/locales/eu/LC_MESSAGES/core.po index 18d8bd793d6788186ca459916a727509e49ea24d..d979950a1de6dcc8101453a0318bd930b3df4647 100644 --- a/modules/core/locales/eu/LC_MESSAGES/core.po +++ b/modules/core/locales/eu/LC_MESSAGES/core.po @@ -185,8 +185,8 @@ msgstr "" "<strong>Ez zara erabiltzen ari HTTPSak</strong> - erabiltzailearekin " "zifratutako komunikazioak. HTTP zuzen ibiltzen da ebaluaketa ingurunetan," " baina ustiapenean erabili behar baduzu, HTTPS erabili beharko zenuke. [ " -"<a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Irakur ezazu gehiago SimpleSAMLphp-ren mantentze-lanei " +"<a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Irakur ezazu gehiago SimpleSAMLphp-ren mantentze-lanei " "buruz </a> ]" msgid "{core:frontpage:federation}" @@ -392,8 +392,8 @@ msgstr "" "<strong>Ez zara erabiltzen ari HTTPSak</strong> - erabiltzailearekin " "zifratutako komunikazioak. HTTP zuzen ibiltzen da ebaluaketa ingurunetan," " baina ustiapenean erabili behar baduzu, HTTPS erabili beharko zenuke. [ " -"<a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Irakur ezazu gehiago SimpleSAMLphp-ren mantentze-lanei " +"<a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Irakur ezazu gehiago SimpleSAMLphp-ren mantentze-lanei " "buruz </a> ]" msgid "Metadata" diff --git a/modules/core/locales/fr/LC_MESSAGES/core.po b/modules/core/locales/fr/LC_MESSAGES/core.po index c00c93ab2e3c0c3cee7c85dd89a166c8f4e9b15c..188d437f3ea0d032f0504322c347cc1951bd8aad 100644 --- a/modules/core/locales/fr/LC_MESSAGES/core.po +++ b/modules/core/locales/fr/LC_MESSAGES/core.po @@ -187,8 +187,8 @@ msgstr "" "avec l'utilisateur. Utiliser SimpleSAMLphp marchera parfaitement avec " "HTTP pour des tests, mais si vous voulez l'utiliser dans un environnement" " de production, vous devriez utiliser HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">En lire plus sur la maintenance de SimpleSAMLphp</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">En lire plus sur la maintenance de SimpleSAMLphp</a> ]" msgid "{core:frontpage:federation}" msgstr "FĂ©dĂ©ration" @@ -399,8 +399,8 @@ msgstr "" "avec l'utilisateur. Utiliser SimpleSAMLphp marchera parfaitement avec " "HTTP pour des tests, mais si vous voulez l'utiliser dans un environnement" " de production, vous devriez utiliser HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">En lire plus sur la maintenance de SimpleSAMLphp</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">En lire plus sur la maintenance de SimpleSAMLphp</a> ]" msgid "Metadata" msgstr "MĂ©tadonnĂ©es" diff --git a/modules/core/locales/he/LC_MESSAGES/core.po b/modules/core/locales/he/LC_MESSAGES/core.po index 167d0457e4476bcf91c599bec6d81ef2d58d0726..ea53dbbe1b247484ad4de84cfca8124722cb834d 100644 --- a/modules/core/locales/he/LC_MESSAGES/core.po +++ b/modules/core/locales/he/LC_MESSAGES/core.po @@ -174,8 +174,8 @@ msgid "{core:frontpage:warnings_https}" msgstr "" "<strong>×תה ×ś× ×ž×©×Ş×ž×© ב- HTTPS </strong> - התקשרות ×ž×•×¦×¤× ×Ş עם המשתמש. HTTP " "עובד בסדר למ×רות בדיקה, ×ולם למערכות ×מיתיות, כדי להשתמש ×” HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\"> ×§×¨× ×˘×•×“ על תחזוק SimpleSAMLphp </a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\"> ×§×¨× ×˘×•×“ על תחזוק SimpleSAMLphp </a> ]" msgid "{core:frontpage:federation}" msgstr "×יחוד" @@ -369,8 +369,8 @@ msgid "" msgstr "" "<strong>×תה ×ś× ×ž×©×Ş×ž×© ב- HTTPS </strong> - התקשרות ×ž×•×¦×¤× ×Ş עם המשתמש. HTTP " "עובד בסדר למ×רות בדיקה, ×ולם למערכות ×מיתיות, כדי להשתמש ×” HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\"> ×§×¨× ×˘×•×“ על תחזוק SimpleSAMLphp </a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\"> ×§×¨× ×˘×•×“ על תחזוק SimpleSAMLphp </a> ]" msgid "Metadata" msgstr "מ××-× ×Ş×•× ×™×ť" diff --git a/modules/core/locales/hr/LC_MESSAGES/core.po b/modules/core/locales/hr/LC_MESSAGES/core.po index 41bf6b81c1c1c194a7074592f9beb917c9d0696c..4e0311f3db3fe617ff3177d05b342761e15a33ea 100644 --- a/modules/core/locales/hr/LC_MESSAGES/core.po +++ b/modules/core/locales/hr/LC_MESSAGES/core.po @@ -192,8 +192,8 @@ msgstr "" "<strong>Ne koristite HTTPS</strong> - kriptiranu komunikaciju s " "korisnikom. HTTP se moĹľe koristiti za potrebe testiranja, ali u " "produkcijskom okruĹľenju trebali biste koristiti HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">ProÄŤitajte više o SimpleSAMLphp postavkama</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ProÄŤitajte više o SimpleSAMLphp postavkama</a> ]" msgid "{core:frontpage:federation}" msgstr "Federacija" @@ -411,8 +411,8 @@ msgstr "" "<strong>Ne koristite HTTPS</strong> - kriptiranu komunikaciju s " "korisnikom. HTTP se moĹľe koristiti za potrebe testiranja, ali u " "produkcijskom okruĹľenju trebali biste koristiti HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">ProÄŤitajte više o SimpleSAMLphp postavkama</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ProÄŤitajte više o SimpleSAMLphp postavkama</a> ]" msgid "Metadata" msgstr "Metapodaci" diff --git a/modules/core/locales/hu/LC_MESSAGES/core.po b/modules/core/locales/hu/LC_MESSAGES/core.po index 078427f461a1ed49bae5df3a54f2f3d95e842726..2304e086d459c8a2ede5de935fb6b58b6d7d5348 100644 --- a/modules/core/locales/hu/LC_MESSAGES/core.po +++ b/modules/core/locales/hu/LC_MESSAGES/core.po @@ -189,8 +189,8 @@ msgstr "" "<strong>Nem HTTPS protokollt használ</strong> - nem titkosĂtott a " "kommunikáciĂł! HTTP jĂł megoldás lehet teszt rendszerek esetĂ©ben, de az " "Ă©les rendszerben lehetĹ‘sĂ©g szerint használjon HTTPS-t! [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Többet olvashat a SimpleSAMLphp beállĂtásárĂłl</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Többet olvashat a SimpleSAMLphp beállĂtásárĂłl</a> ]" msgid "{core:frontpage:federation}" msgstr "FöderáciĂł" @@ -393,8 +393,8 @@ msgstr "" "<strong>Nem HTTPS protokollt használ</strong> - nem titkosĂtott a " "kommunikáciĂł! HTTP jĂł megoldás lehet teszt rendszerek esetĂ©ben, de az " "Ă©les rendszerben lehetĹ‘sĂ©g szerint használjon HTTPS-t! [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Többet olvashat a SimpleSAMLphp beállĂtásárĂłl</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Többet olvashat a SimpleSAMLphp beállĂtásárĂłl</a> ]" msgid "Metadata" msgstr "Metaadat" diff --git a/modules/core/locales/id/LC_MESSAGES/core.po b/modules/core/locales/id/LC_MESSAGES/core.po index 757ecc8d8fc7aabc036ba0d0ea369a97a7829371..75646d0a570c75863ca422da57c77de83b69ca91 100644 --- a/modules/core/locales/id/LC_MESSAGES/core.po +++ b/modules/core/locales/id/LC_MESSAGES/core.po @@ -185,8 +185,8 @@ msgstr "" "<strong>Anda tidak menggunakan HTTPS</strong> - komunikasi yang " "dienkripsi dengan user. HTTP bekerja baik-baik saja untuk tujuan " "pengetesan , tapi dalam lingkungan produksi, Anda sebaiknya menggunakan " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Baca lebih lanjut tentang proses pemeliraan " +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Baca lebih lanjut tentang proses pemeliraan " "SimpleSAMLphp.</a> ]" msgid "{core:frontpage:federation}" @@ -395,8 +395,8 @@ msgstr "" "<strong>Anda tidak menggunakan HTTPS</strong> - komunikasi yang " "dienkripsi dengan user. HTTP bekerja baik-baik saja untuk tujuan " "pengetesan , tapi dalam lingkungan produksi, Anda sebaiknya menggunakan " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Baca lebih lanjut tentang proses pemeliraan " +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Baca lebih lanjut tentang proses pemeliraan " "SimpleSAMLphp.</a> ]" msgid "Metadata" diff --git a/modules/core/locales/it/LC_MESSAGES/core.po b/modules/core/locales/it/LC_MESSAGES/core.po index 1333903f9a79ced5f29fb668897cbf47e4e4c72d..555f86a8e2b379ffd15042f3ec814dbf4470b3c4 100644 --- a/modules/core/locales/it/LC_MESSAGES/core.po +++ b/modules/core/locales/it/LC_MESSAGES/core.po @@ -190,8 +190,8 @@ msgstr "" "<strong>Non stai usando HTTPS</strong> - comunicazione cifrata con " "l'utente. HTTP può funzionare per i test, ma in un ambiente di " "produzione si dovrebbe usare HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Maggiori informazioni sulla manutenzione di " +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Maggiori informazioni sulla manutenzione di " "SimpleSAMLphp</a> ]" msgid "{core:frontpage:federation}" @@ -404,8 +404,8 @@ msgstr "" "<strong>Non stai usando HTTPS</strong> - comunicazione cifrata con " "l'utente. HTTP può funzionare per i test, ma in un ambiente di " "produzione si dovrebbe usare HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Maggiori informazioni sulla manutenzione di " +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Maggiori informazioni sulla manutenzione di " "SimpleSAMLphp</a> ]" msgid "Metadata" diff --git a/modules/core/locales/ja/LC_MESSAGES/core.po b/modules/core/locales/ja/LC_MESSAGES/core.po index 2e296fb0d9dfde9dc10cd88b4a5a3218b9a437fc..457a8cc931d9e778b50ecd4253383d8e288bcc32 100644 --- a/modules/core/locales/ja/LC_MESSAGES/core.po +++ b/modules/core/locales/ja/LC_MESSAGES/core.po @@ -166,8 +166,8 @@ msgstr "" msgid "{core:frontpage:warnings_https}" msgstr "" "<strong>ă‚ăŞăźăŻHTTPS(暗号化通信)を行ăŁă¦ă„ăľă›ă‚“。</strong>HTTPăŻă†ă‚ąăç’°ĺ˘ă§ă‚ă‚Śă°ćŁĺ¸¸ă«ĺ‹•ä˝śă—ăľă™ă€ă—ă‹ă—製ĺ“ç’°ĺ˘ă§ăŻHTTPSを使用ă™ă‚‹ăąăŤă§ă™ă€‚[" -" <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">č©łă—ăŹăŻ SimpleSAMLphp ăˇăłă†ăŠăłă‚ąć…ĺ ±ă‚’čŞă‚“ă§ăŹă ă•ă„。</a> ]" +" <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">č©łă—ăŹăŻ SimpleSAMLphp ăˇăłă†ăŠăłă‚ąć…ĺ ±ă‚’čŞă‚“ă§ăŹă ă•ă„。</a> ]" msgid "{core:frontpage:federation}" msgstr "連ćş" @@ -352,8 +352,8 @@ msgid "" "maintenance\">Read more about SimpleSAMLphp maintenance</a> ]" msgstr "" "<strong>ă‚ăŞăźăŻHTTPS(暗号化通信)を行ăŁă¦ă„ăľă›ă‚“。</strong>HTTPăŻă†ă‚ąăç’°ĺ˘ă§ă‚ă‚Śă°ćŁĺ¸¸ă«ĺ‹•ä˝śă—ăľă™ă€ă—ă‹ă—製ĺ“ç’°ĺ˘ă§ăŻHTTPSを使用ă™ă‚‹ăąăŤă§ă™ă€‚[" -" <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">č©łă—ăŹăŻ SimpleSAMLphp ăˇăłă†ăŠăłă‚ąć…ĺ ±ă‚’čŞă‚“ă§ăŹă ă•ă„。</a> ]" +" <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">č©łă—ăŹăŻ SimpleSAMLphp ăˇăłă†ăŠăłă‚ąć…ĺ ±ă‚’čŞă‚“ă§ăŹă ă•ă„。</a> ]" msgid "Metadata" msgstr "ăˇă‚żă‡ăĽă‚ż" diff --git a/modules/core/locales/lb/LC_MESSAGES/core.po b/modules/core/locales/lb/LC_MESSAGES/core.po index 5c30d24a4523063590a1c7f6f4ded16b58aa18a8..da87760a77048056f117e49d6349b6ed09f1d2ab 100644 --- a/modules/core/locales/lb/LC_MESSAGES/core.po +++ b/modules/core/locales/lb/LC_MESSAGES/core.po @@ -94,8 +94,8 @@ msgstr "" "<strong>Der benotzt ken HTTPS</strong> - verschlĂ«sselt Kommunikatioun mat" " dem Benotzer. SimpleSAMLphp funktionĂ©iert einwandfräi mat HTTP fir " "TestzwĂ©ecker mais an engem produktiven Emfeld sollt et besser mat HTTPS " -"lafen. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Liest mĂ©i iwert Maintenance vun SimpleSAMLphp</a> ]" +"lafen. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Liest mĂ©i iwert Maintenance vun SimpleSAMLphp</a> ]" msgid "{core:frontpage:required_radius}" msgstr "NĂ©ideg fir RADIUS" @@ -187,8 +187,8 @@ msgstr "" "<strong>Der benotzt ken HTTPS</strong> - verschlĂ«sselt Kommunikatioun mat" " dem Benotzer. SimpleSAMLphp funktionĂ©iert einwandfräi mat HTTP fir " "TestzwĂ©ecker mais an engem produktiven Emfeld sollt et besser mat HTTPS " -"lafen. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Liest mĂ©i iwert Maintenance vun SimpleSAMLphp</a> ]" +"lafen. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Liest mĂ©i iwert Maintenance vun SimpleSAMLphp</a> ]" msgid "Metadata" msgstr "Meta DonnĂ©es" diff --git a/modules/core/locales/lt/LC_MESSAGES/core.po b/modules/core/locales/lt/LC_MESSAGES/core.po index f9d0421e331fecb61d6df0abf20932c1cb63b403..aa83f7aaa0d6907754c2a90702d01d0b31bdf6fd 100644 --- a/modules/core/locales/lt/LC_MESSAGES/core.po +++ b/modules/core/locales/lt/LC_MESSAGES/core.po @@ -187,8 +187,8 @@ msgstr "" "<strong>JĹ«s nenaudojate HTTPS</strong> - šifruotos komunikacijos su " "vartotoju. HTTP puikiai tinka testavimo reikmÄ—ms, taÄŤiau realioje " "aplinkoje turÄ—tumÄ—te naudoti HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Skaityti daugiau apie SimpleSAMLphp prieĹľiĹ«rÄ…</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Skaityti daugiau apie SimpleSAMLphp prieĹľiĹ«rÄ…</a> ]" msgid "{core:frontpage:federation}" msgstr "Federacija" @@ -397,8 +397,8 @@ msgstr "" "<strong>JĹ«s nenaudojate HTTPS</strong> - šifruotos komunikacijos su " "vartotoju. HTTP puikiai tinka testavimo reikmÄ—ms, taÄŤiau realioje " "aplinkoje turÄ—tumÄ—te naudoti HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Skaityti daugiau apie SimpleSAMLphp prieĹľiĹ«rÄ…</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Skaityti daugiau apie SimpleSAMLphp prieĹľiĹ«rÄ…</a> ]" msgid "Metadata" msgstr "Metaduomenys" diff --git a/modules/core/locales/lv/LC_MESSAGES/core.po b/modules/core/locales/lv/LC_MESSAGES/core.po index 9a6df6db5338237d926c15c82eb56283f0b76812..61743892b824f10f948cc63b0f852577b5ceec8d 100644 --- a/modules/core/locales/lv/LC_MESSAGES/core.po +++ b/modules/core/locales/lv/LC_MESSAGES/core.po @@ -177,8 +177,8 @@ msgid "{core:frontpage:warnings_https}" msgstr "" "<strong>JĹ«s neizmantojat HTTPS</strong> - šifrÄ“tu komunikÄciju ar " "lietotÄju. HTTP ir labs testa nolĹ«kiem, bet raĹľošanÄ jÄizmanto HTTPS. [ " -"<a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Lasiet vairÄk par SimpleSAMLphp uzturēšanu</a> ]" +"<a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Lasiet vairÄk par SimpleSAMLphp uzturēšanu</a> ]" msgid "{core:frontpage:federation}" msgstr "FederÄcija" @@ -375,8 +375,8 @@ msgid "" msgstr "" "<strong>JĹ«s neizmantojat HTTPS</strong> - šifrÄ“tu komunikÄciju ar " "lietotÄju. HTTP ir labs testa nolĹ«kiem, bet raĹľošanÄ jÄizmanto HTTPS. [ " -"<a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Lasiet vairÄk par SimpleSAMLphp uzturēšanu</a> ]" +"<a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Lasiet vairÄk par SimpleSAMLphp uzturēšanu</a> ]" msgid "Metadata" msgstr "Metadati" diff --git a/modules/core/locales/nb/LC_MESSAGES/core.po b/modules/core/locales/nb/LC_MESSAGES/core.po index 60b841b6f4e0233fc5d3dafc009d283dc28604e3..c10d9d2e5ca974ac419976cad669912ef0699d32 100644 --- a/modules/core/locales/nb/LC_MESSAGES/core.po +++ b/modules/core/locales/nb/LC_MESSAGES/core.po @@ -185,8 +185,8 @@ msgstr "" "<strong>Du bruker ikke HTTPS</strong> - kryptert kommunikasjon med " "brukeren. HTTP fungerer utmerket til testformĂĄl, men i et " "produksjonsmiljø anbefales sterkt ĂĄ skru pĂĄ sikker kommunikasjon med " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Les mer i dokumentet: SimpleSAMLphp maintenance</a> ]" +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Les mer i dokumentet: SimpleSAMLphp maintenance</a> ]" msgid "{core:frontpage:federation}" msgstr "Føderasjon" @@ -389,8 +389,8 @@ msgstr "" "<strong>Du bruker ikke HTTPS</strong> - kryptert kommunikasjon med " "brukeren. HTTP fungerer utmerket til testformĂĄl, men i et " "produksjonsmiljø anbefales sterkt ĂĄ skru pĂĄ sikker kommunikasjon med " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Les mer i dokumentet: SimpleSAMLphp maintenance</a> ]" +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Les mer i dokumentet: SimpleSAMLphp maintenance</a> ]" msgid "Metadata" msgstr "Metadata" diff --git a/modules/core/locales/nl/LC_MESSAGES/core.po b/modules/core/locales/nl/LC_MESSAGES/core.po index 95f5aa885451c3ce9f05e0588d63c74cc4e2860d..d6404e871148310612fc4a7185ecf0a4ccd2b3b2 100644 --- a/modules/core/locales/nl/LC_MESSAGES/core.po +++ b/modules/core/locales/nl/LC_MESSAGES/core.po @@ -36,6 +36,9 @@ msgstr "Suggesties om dit probleem op te lossen:" msgid "{core:frontpage:login_as_admin}" msgstr "Login als beheerder" +msgid "{core:frontpage:logout}" +msgstr "Uitloggen" + msgid "{core:short_sso_interval:warning}" msgstr "" "We hebben waargenomen dat u slechts een paar seconden geleden al " diff --git a/modules/core/locales/nn/LC_MESSAGES/core.po b/modules/core/locales/nn/LC_MESSAGES/core.po index cdbfc5684ac973fcd2fd98ea0fae48f73690841e..368dd7e76b37c2525b2126bf239176d2c92514eb 100644 --- a/modules/core/locales/nn/LC_MESSAGES/core.po +++ b/modules/core/locales/nn/LC_MESSAGES/core.po @@ -182,8 +182,8 @@ msgstr "" "brukaren. Du kan bruka SimpleSAMLphp uten HTTPS til testformĂĄl, men " "dersom du skal bruka SimpleSAMLphp i eit produksjonsmiljø, vil vi sterkt " "tilrĂĄ ĂĄ skru pĂĄ sikker kommunikasjon med HTTPS. [ Les meir i dokumentet: " -"<a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">SimpleSAMLphp maintenance</a> ]" +"<a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">SimpleSAMLphp maintenance</a> ]" msgid "{core:frontpage:federation}" msgstr "Føderasjon" @@ -386,8 +386,8 @@ msgstr "" "brukaren. Du kan bruka SimpleSAMLphp uten HTTPS til testformĂĄl, men " "dersom du skal bruka SimpleSAMLphp i eit produksjonsmiljø, vil vi sterkt " "tilrĂĄ ĂĄ skru pĂĄ sikker kommunikasjon med HTTPS. [ Les meir i dokumentet: " -"<a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">SimpleSAMLphp maintenance</a> ]" +"<a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">SimpleSAMLphp maintenance</a> ]" msgid "Metadata" msgstr "Metadata" diff --git a/modules/core/locales/pt/LC_MESSAGES/core.po b/modules/core/locales/pt/LC_MESSAGES/core.po index c9aec1c5f23718477a8cc1864494b09c83242645..599cf95aac19d32fc5870fa66d3729c700f5b716 100644 --- a/modules/core/locales/pt/LC_MESSAGES/core.po +++ b/modules/core/locales/pt/LC_MESSAGES/core.po @@ -138,8 +138,8 @@ msgstr "" "<strong>NĂŁo está a ser usado HTTPS</strong> - comunicação cifrada com o " "utilizador. Para ambientes de teste, ligações HTTP sĂŁo suficientes, mas " "num ambiente de produção deve ser usado HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Ler mais sobre manutenção do SimpleSAMLphp</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Ler mais sobre manutenção do SimpleSAMLphp</a> ]" msgid "{core:frontpage:federation}" msgstr "Federação" @@ -296,8 +296,8 @@ msgstr "" "<strong>NĂŁo está a ser usado HTTPS</strong> - comunicação cifrada com o " "utilizador. Para ambientes de teste, ligações HTTP sĂŁo suficientes, mas " "num ambiente de produção deve ser usado HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Ler mais sobre manutenção do SimpleSAMLphp</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Ler mais sobre manutenção do SimpleSAMLphp</a> ]" msgid "Metadata" msgstr "Metadados" diff --git a/modules/core/locales/sl/LC_MESSAGES/core.po b/modules/core/locales/sl/LC_MESSAGES/core.po index eaf0bcf67c795d4f22cee633404c83bffa3774a5..802a6f38c92d9cbce6effef674e8c7e3ce553e7d 100644 --- a/modules/core/locales/sl/LC_MESSAGES/core.po +++ b/modules/core/locales/sl/LC_MESSAGES/core.po @@ -177,8 +177,8 @@ msgstr "" "<strong>Ne uporabljate HTTPS</strong>-šifrirane komunikacije. " "SimpleSAMLphp deluje brez teĹľav na HTTP, vendar le za testne namene, za " "uporabo SimpleSAMLphp v produkcijskem okolju uporabite HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Preberite veÄŤ o SimpleSAMLphp vzdrĹľevanju</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Preberite veÄŤ o SimpleSAMLphp vzdrĹľevanju</a> ]" msgid "{core:frontpage:federation}" msgstr "Federacija" @@ -380,8 +380,8 @@ msgstr "" "<strong>Ne uporabljate HTTPS</strong>-šifrirane komunikacije. " "SimpleSAMLphp deluje brez teĹľav na HTTP, vendar le za testne namene, za " "uporabo SimpleSAMLphp v produkcijskem okolju uporabite HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">Preberite veÄŤ o SimpleSAMLphp vzdrĹľevanju</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Preberite veÄŤ o SimpleSAMLphp vzdrĹľevanju</a> ]" msgid "Metadata" msgstr "Metapodatki" diff --git a/modules/core/locales/sr/LC_MESSAGES/core.po b/modules/core/locales/sr/LC_MESSAGES/core.po index f500a2c6f41960e2433f4893752837be934e7e21..9f7a9ea2083b377d1b3b038fa6fed1956cf1194f 100644 --- a/modules/core/locales/sr/LC_MESSAGES/core.po +++ b/modules/core/locales/sr/LC_MESSAGES/core.po @@ -194,8 +194,8 @@ msgstr "" "<strong>Ne koristite HTTPS</strong> - kriptovanu komunikaciju s " "korisnikom. HTTP se moĹľe koristiti za potrebe testiranja, ali u " "produkcionom okruĹľenju trebali biste koristiti HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">ProÄŤitajte više o SimpleSAMLphp podešavanjima</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ProÄŤitajte više o SimpleSAMLphp podešavanjima</a> ]" msgid "{core:frontpage:federation}" msgstr "Federacija" @@ -407,8 +407,8 @@ msgstr "" "<strong>Ne koristite HTTPS</strong> - kriptovanu komunikaciju s " "korisnikom. HTTP se moĹľe koristiti za potrebe testiranja, ali u " "produkcionom okruĹľenju trebali biste koristiti HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">ProÄŤitajte više o SimpleSAMLphp podešavanjima</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">ProÄŤitajte više o SimpleSAMLphp podešavanjima</a> ]" msgid "Metadata" msgstr "Medapodaci" diff --git a/modules/core/locales/sv/LC_MESSAGES/core.po b/modules/core/locales/sv/LC_MESSAGES/core.po index f3d8a2c06fd45875d07da6193c0107fd98721f13..6adaceec51b3eb397f156ce0456c5a8eec24f448 100644 --- a/modules/core/locales/sv/LC_MESSAGES/core.po +++ b/modules/core/locales/sv/LC_MESSAGES/core.po @@ -181,8 +181,8 @@ msgid "{core:frontpage:warnings_https}" msgstr "" "<strong>Du använder inte HTTPS</strong> - krypterad kommunikation med " "användaren. HTTP fungerar bra under test men i produktion ska du använda " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Läs mer i dokumentet SimpleSAMLphp maintenance</a> ]" +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Läs mer i dokumentet SimpleSAMLphp maintenance</a> ]" msgid "{core:frontpage:federation}" msgstr "Federation" @@ -384,8 +384,8 @@ msgid "" msgstr "" "<strong>Du använder inte HTTPS</strong> - krypterad kommunikation med " "användaren. HTTP fungerar bra under test men i produktion ska du använda " -"HTTPS. [ <a href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-" -"and-configuration\">Läs mer i dokumentet SimpleSAMLphp maintenance</a> ]" +"HTTPS. [ <a href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">Läs mer i dokumentet SimpleSAMLphp maintenance</a> ]" msgid "Metadata" msgstr "Metadata" diff --git a/modules/core/locales/zh/LC_MESSAGES/core.po b/modules/core/locales/zh/LC_MESSAGES/core.po index 4cd6c87ff307346ad212fb179ed62e349302993b..f883464c23da8b5a70db3b4816a382738e025155 100644 --- a/modules/core/locales/zh/LC_MESSAGES/core.po +++ b/modules/core/locales/zh/LC_MESSAGES/core.po @@ -162,8 +162,8 @@ msgstr "请求参数的长度被PHP Suhosin扩展é™ĺ¶äş†ďĽŚčŻ·ĺ˘žĺ¤§suhosin.ge msgid "{core:frontpage:warnings_https}" msgstr "" "<strong>ä˝ ć˛ˇćś‰ä˝żç”¨HTTPS</strong> - 和用ć·ĺŠ 密的通信。HTTP在测试目的下ĺľĺĄ˝,但生产环ĺ˘čŻ·ä˝żç”¨HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">获取更多SimpleSAMLphp维护的信ćŻ</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">获取更多SimpleSAMLphp维护的信ćŻ</a> ]" msgid "{core:frontpage:federation}" msgstr "č”盟" @@ -347,8 +347,8 @@ msgid "" "maintenance\">Read more about SimpleSAMLphp maintenance</a> ]" msgstr "" "<strong>ä˝ ć˛ˇćś‰ä˝żç”¨HTTPS</strong> - 和用ć·ĺŠ 密的通信。HTTP在测试目的下ĺľĺĄ˝,但生产环ĺ˘čŻ·ä˝żç”¨HTTPS. [ <a " -"href=\"http://rnd.feide.no/content/simplesamlphp-maintenance-and-" -"configuration\">获取更多SimpleSAMLphp维护的信ćŻ</a> ]" +"href=\"https://simplesamlphp.org/docs/stable/simplesamlphp-maintenance" +"\">获取更多SimpleSAMLphp维护的信ćŻ</a> ]" msgid "Metadata" msgstr "ĺ…信ćŻ" diff --git a/modules/core/templates/_frontpage_menu.twig b/modules/core/templates/_frontpage_menu.twig index 7b363ffaf4a9178c234fb6e87bff8476e8a101d2..3af633752872c47b9dfb17295676caccffe633dc 100644 --- a/modules/core/templates/_frontpage_menu.twig +++ b/modules/core/templates/_frontpage_menu.twig @@ -1,25 +1,31 @@ <div class="pure-g frontpage-menu"> - <div class="pure-u-2-3"> - <div class="pure-menu pure-menu-horizontal"> - <ul class="pure-menu-list"> - <li class="pure-menu-item {% if frontpage_section == "welcome" %} pure-menu-selected{% endif %}"> - <a href="frontpage_welcome.php" class="pure-menu-link">Welcome</a></li> - <li class="pure-menu-item {% if frontpage_section == "config" %} pure-menu-selected{% endif %}"> - <a href="frontpage_config.php" class="pure-menu-link">Configuration</a></li> - <li class="pure-menu-item {% if frontpage_section == "auth" %} pure-menu-selected{% endif %}"> - <a href="frontpage_auth.php" class="pure-menu-link">Authentication</a></li> - <li class="pure-menu-item {% if frontpage_section == "federation" %} pure-menu-selected{% endif %}"> - <a href="frontpage_federation.php" class="pure-menu-link">Federation</a></li> - </ul> + <div class="pure-u-2-3"> + <div class="pure-menu pure-menu-horizontal"> + <ul class="pure-menu-list"> + <li class="pure-menu-item{% if frontpage_section == "welcome" %} pure-menu-selected{% endif %}"> + <a href="frontpage_welcome.php" class="pure-menu-link">Welcome</a> + </li> + <li class="pure-menu-item{% if frontpage_section == "config" %} pure-menu-selected{% endif %}"> + <a href="frontpage_config.php" class="pure-menu-link">Configuration</a> + </li> + <li class="pure-menu-item{% if frontpage_section == "auth" %} pure-menu-selected{% endif %}"> + <a href="frontpage_auth.php" class="pure-menu-link">Authentication</a> + </li> + <li class="pure-menu-item{% if frontpage_section == "federation" %} pure-menu-selected{% endif %}"> + <a href="frontpage_federation.php" class="pure-menu-link">Federation</a> + </li> + </ul> + </div> </div> - </div> - <div class="pure-u-1-3"> + <div class="pure-u-1-3"> {% if isadmin %} - <p class="float-r youareadmin">{{ '{core:frontpage:loggedin_as_admin}'|trans }}</p> + <p class="float-r youareadmin">{{ '{core:frontpage:loggedin_as_admin}'|trans }} + <a href="{{ logouturl }}"><i class="fa fa-sign-out" title="{{ '{core:frontpage:logout}'|trans }}"></i></a> + </p> {% else %} - <p class="float-r youareadmin"> - <a href="{{ loginurl }}">{{ '{core:frontpage:login_as_admin}'|trans }}</a> - </p> + <p class="float-r youareadmin"> + <a href="{{ loginurl }}">{{ '{core:frontpage:login_as_admin}'|trans }}</a> + </p> {% endif %} - </div> + </div> </div> diff --git a/modules/core/templates/authsource_list.tpl.php b/modules/core/templates/authsource_list.tpl.php index db0a7cede05e88b30b82fdfbae85b4f616adfe82..20522518defa804e70e6e850a8f4ef9447c4b9d2 100644 --- a/modules/core/templates/authsource_list.tpl.php +++ b/modules/core/templates/authsource_list.tpl.php @@ -4,14 +4,13 @@ * */ $this->data['header'] = 'Test authentication sources'; - $this->includeAtTemplateBase('includes/header.php'); ?> <h1><?php echo $this->data['header']; ?></h1> <ul> <?php foreach ($this->data['sources'] as $id) { - echo '<li><a href="?as=' . htmlspecialchars(urlencode($id)) . '">' . htmlspecialchars($id) . '</a></li>'; + echo '<li><a href="?as='.htmlspecialchars(urlencode($id)).'">'.htmlspecialchars($id).'</a></li>'; } ?> </ul> diff --git a/modules/core/templates/authsource_list.twig b/modules/core/templates/authsource_list.twig index acf0d57fa51de28382b6bd9c6760723772cf1121..c966180b7fb54b8ef8b304f65034ba1f7dfd1457 100644 --- a/modules/core/templates/authsource_list.twig +++ b/modules/core/templates/authsource_list.twig @@ -5,7 +5,7 @@ <h1>{{ header }}</h1> <ul> {% for key, name in sources %} - <li><a href="?as={{ name|escape('url') }}">{{ name|escape('html') }}</a></li> + <li><a href="?as={{ name|escape('url') }}">{{ name|escape('html') }}</a></li> {% endfor %} </ul> {% endblock %} diff --git a/modules/core/templates/base.twig b/modules/core/templates/base.twig index 47a732abda4e6ae049b5111bf0bd442861dc78f3..96fcc07baeb873b82c4f94a4e6a17a002a40b500 100644 --- a/modules/core/templates/base.twig +++ b/modules/core/templates/base.twig @@ -2,23 +2,24 @@ {% block contentwrapper %} {% if tabname %} <div id="portalmenu" class="ui-tabs ui-widget ui-widget-content ui-corner-all"> -<ul class="tabset_tabs ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> -{% for name, link in links %} -{% if name == pageid %} -<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"> -<a href="#">{{ link.text|trans }}</a> -</li> -{% else %} -<li class="ui-state-default ui-corner-top"> -<a href="{{ link.href }}">{{ link.text|trans }}</a> -</li> -{% endif %} -{% endfor %} -</ul> -<div id="portalcontent" class="ui-tabs-panel ui-widget-content ui-corner-bottom"> + <ul class="tabset_tabs ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> + {% for name, link in links %} + {% if name == pageid %} + <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"> + <a href="#">{{ link.text|trans }}</a> + </li> + {% else %} + <li class="ui-state-default ui-corner-top"> + <a href="{{ link.href }}">{{ link.text|trans }}</a> + </li> + {% endif %} + {% endfor %} + </ul> + <div id="portalcontent" class="ui-tabs-panel ui-widget-content ui-corner-bottom"> {% endif %} {{ block('content') }} {% if tabname %} -</div></div> + </div> +</div> {% endif %} {% endblock %} diff --git a/modules/core/templates/cardinality_error.tpl.php b/modules/core/templates/cardinality_error.tpl.php index dc75c540afc9b7f71a167a5d397188eca3cb3e47..6dd78aa1b6168858a14063c815525b32fd2cba22 100644 --- a/modules/core/templates/cardinality_error.tpl.php +++ b/modules/core/templates/cardinality_error.tpl.php @@ -20,18 +20,17 @@ $this->includeAtTemplateBase('includes/header.php'); <p><?php echo $this->data['cardinality_text']; ?></p> <h3><?php echo $this->data['problematic_attributes']; ?></h3> <dl class="cardinalityErrorAttributes"> -<?php foreach ($this->data['cardinalityErrorAttributes'] as $attr => $v) { ?> - <dt><?php echo $attr ?></td> - <dd><?php echo $this->t('{core:cardinality:got_want}', array('%GOT%' => $v[0], '%WANT%' => htmlspecialchars($v[1]))) ?></dd> - </tr> -<?php } ?> -</dl> <?php +foreach ($this->data['cardinalityErrorAttributes'] as $attr => $v) { + echo '<dt>'.$attr.'</td><dd>'; + echo $this->t( + '{core:cardinality:got_want}', + ['%GOT%' => $v[0], '%WANT%' => htmlspecialchars($v[1])] + ); + echo '</dd></tr>'; +} +echo '</dl>'; if (isset($this->data['LogoutURL'])) { -?> -<p><a href="<?php echo htmlspecialchars($this->data['LogoutURL']); ?>"><?php echo $this->t('{status:logout}'); ?></a></p> -<?php + echo '<p><a href="'.htmlspecialchars($this->data['LogoutURL']).'>">'.$this->t('{status:logout}').'</a></p>'; } -?> -<?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/core/templates/frontpage_auth.tpl.php b/modules/core/templates/frontpage_auth.tpl.php index f0594948f1e2f19d7f067de38c526c2908108e0a..afb55b30d72452381c8e02b3f17f346d5ac046dc 100644 --- a/modules/core/templates/frontpage_auth.tpl.php +++ b/modules/core/templates/frontpage_auth.tpl.php @@ -1,34 +1,30 @@ -<?php +<?php $this->data['header'] = $this->t('{core:frontpage:page_title}'); -$this->includeAtTemplateBase('includes/header.php'); +$this->includeAtTemplateBase('includes/header.php'); ?> <?php if ($this->data['isadmin']) { - echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r youareadmin">'.$this->t('{core:frontpage:loggedin_as_admin}').'</p>'; } else { - echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r youareadmin"><a href="'.$this->data['loginurl'].'">'. + $this->t('{core:frontpage:login_as_admin}').'</a></p>'; } ?> - - -<!-- <h2><?php echo $this->t('{core:frontpage:useful_links_header}'); ?></h2> --> +<!-- <h2><?php echo $this->t('{core:frontpage:useful_links_header}'); ?></h2> --> <ul> <?php - foreach ($this->data['links_auth'] AS $link) { - echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a>'; - if (isset($link['deprecated']) && $link['deprecated']) { - echo ' <b>' . $this->t('{core:frontpage:deprecated}') . '</b>'; - } - echo '</li>'; - } +foreach ($this->data['links_auth'] as $link) { + echo '<li><a href="'.htmlspecialchars($link['href']).'">'.$this->t($link['text']).'</a>'; + if (isset($link['deprecated']) && $link['deprecated']) { + echo ' <b>'.$this->t('{core:frontpage:deprecated}').'</b>'; + } + echo '</li>'; +} ?> </ul> - - - <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/core/templates/frontpage_config.tpl.php b/modules/core/templates/frontpage_config.tpl.php index 3e4b52701732b1cc731bd0a0556a3ce1e49b9f45..10f7463cf305b6ceff462533f85f4c5140db68db 100644 --- a/modules/core/templates/frontpage_config.tpl.php +++ b/modules/core/templates/frontpage_config.tpl.php @@ -5,93 +5,74 @@ $this->includeAtTemplateBase('includes/header.php'); ?> - <!-- <div id="tabdiv"> <ul> - <li><a href="#welcome"><?php echo $this->t('{core:frontpage:welcome}'); ?></a></li> - <li><a href="#configuration"><?php echo $this->t('{core:frontpage:configuration}'); ?></a></li> - <li><a href="#metadata"><?php echo $this->t('{core:frontpage:metadata}'); ?></a></li> + <li><a href="#welcome"><?php echo $this->t('{core:frontpage:welcome}'); ?></a></li> + <li><a href="#configuration"><?php echo $this->t('{core:frontpage:configuration}'); ?></a></li> + <li><a href="#metadata"><?php echo $this->t('{core:frontpage:metadata}'); ?></a></li> </ul> --> <?php if ($this->data['isadmin']) { - echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r youareadmin">'.$this->t('{core:frontpage:loggedin_as_admin}').'</p>'; } else { - echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r youareadmin"><a href="'.$this->data['loginurl'].'">'. + $this->t('{core:frontpage:login_as_admin}').'</a></p>'; } ?> - - - <div style="margin-top: 1em;"> - <code style="background: white; background: #f5f5f5; border: 1px dotted #bbb; padding: 1em; color: #555" ><?php - echo $this->data['directory'] . ' (' . $this->data['version'] . ')'; - ?></code> + <code style="background: white; background: #f5f5f5; border: 1px dotted #bbb; padding: 1em; color: #555" ><?php + echo $this->data['directory'].' ('.$this->data['version'].')'; + ?></code> </div> - - <div style="clear: both" class="enablebox mini"> - <table> - - <?php - $icon_enabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="enabled" />'; - $icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="disabled" />'; - ?> - - <tr class="<?php echo $this->data['enablematrix']['saml20idp'] ? 'enabled' : 'disabled'; ?>"><td>SAML 2.0 IdP</td> - <td><?php echo $this->data['enablematrix']['saml20idp'] ? $icon_enabled : $icon_disabled; ?></td></tr> - - <tr class="<?php echo $this->data['enablematrix']['shib13idp'] ? 'enabled' : 'disabled'; ?>"><td>Shib 1.3 IdP</td> - <td><?php echo $this->data['enablematrix']['shib13idp'] ? $icon_enabled : $icon_disabled; ?></td></tr> - - </table> -</div> + <table> + <?php + $icon_enabled = '<img src="/'.$this->data['baseurlpath'].'resources/icons/silk/accept.png" alt="enabled" />'; + $icon_disabled = '<img src="/'.$this->data['baseurlpath'].'resources/icons/silk/delete.png" alt="disabled" />'; + echo '<tr class="'.($this->data['enablematrix']['saml20idp'] ? 'enabled' : 'disabled').'"><td>SAML 2.0 IdP</td>'; + echo '<td>'.($this->data['enablematrix']['saml20idp'] ? $icon_enabled : $icon_disabled).'</td></tr>'; + echo '<tr class="'.($this->data['enablematrix']['shib13idp'] ? 'enabled' : 'disabled').'"><td>Shib 1.3 IdP</td>'; + echo '<td>'.($this->data['enablematrix']['shib13idp'] ? $icon_enabled : $icon_disabled).'</td></tr>'; + ?> + + </table> +</div> <h2><?php echo $this->t('{core:frontpage:configuration}'); ?></h2> <ul> <?php - foreach ($this->data['links_config'] AS $link) { - echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>'; - } +foreach ($this->data['links_config'] as $link) { + echo '<li><a href="'.htmlspecialchars($link['href']).'">'.$this->t($link['text']).'</a></li>'; +} ?> </ul> - <?php - if (array_key_exists('warnings', $this->data) && is_array($this->data['warnings']) && !empty($this->data['warnings'])) { - - echo '<h2>' . $this->t('{core:frontpage:warnings}') . '</h2>'; +if (array_key_exists('warnings', $this->data) && is_array($this->data['warnings']) && !empty($this->data['warnings'])) { + echo '<h2>'.$this->t('{core:frontpage:warnings}').'</h2>'; + foreach ($this->data['warnings'] as $warning) { + echo '<div class="caution">'.$warning.'</div>'; + } +} - foreach($this->data['warnings'] AS $warning) { - echo '<div class="caution">'.$warning.'</div>'; - } - } -?> -<?php if ($this->data['isadmin']) { - - echo '<h2>'. $this->t('{core:frontpage:checkphp}') . '</h2>'; - echo '<div class="enablebox"><table>'; - - - $icon_enabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="enabled" />'; - $icon_disabled = '<img src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="disabled" />'; - - - foreach ($this->data['funcmatrix'] AS $func) { - echo '<tr class="' . ($func['enabled'] ? 'enabled' : 'disabled') . '"><td>' . ($func['enabled'] ? $icon_enabled : $icon_disabled) . '</td>'; - echo '<td>' . $this->t($this->data['requiredmap'][$func['required']]) . '</td><td>' . $func['descr'] . '</td></tr>'; - } - echo('</table></div>'); + echo '<h2>'.$this->t('{core:frontpage:checkphp}').'</h2>'; + echo '<div class="enablebox"><table>'; + + $icon_enabled = '<img src="/'.$this->data['baseurlpath'].'resources/icons/silk/accept.png" alt="enabled" />'; + $icon_disabled = '<img src="/'.$this->data['baseurlpath'].'resources/icons/silk/delete.png" alt="disabled" />'; + + foreach ($this->data['funcmatrix'] as $func) { + echo '<tr class="'.($func['enabled'] ? 'enabled' : 'disabled').'"><td>'. + ($func['enabled'] ? $icon_enabled : $icon_disabled).'</td>'; + echo '<td>'.$this->t($this->data['requiredmap'][$func['required']]).'</td><td>'.$func['descr'].'</td></tr>'; + } + echo '</table></div>'; } -?> - - - - -<?php $this->includeAtTemplateBase('includes/footer.php'); +$this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/core/templates/frontpage_config.twig b/modules/core/templates/frontpage_config.twig index 20802aebb37ec7188b70184c00edad050a0b5a0c..c0fb87b95d4002e18b6337e46aafaddd1ccc7126 100644 --- a/modules/core/templates/frontpage_config.twig +++ b/modules/core/templates/frontpage_config.twig @@ -9,8 +9,8 @@ <code class="simplesaml_version">{{ directory }} ({{ version }})</code> </div> - {% set icon_enabled = '<img src="/' ~ baseurlpath ~ 'resources/icons/silk/accept.png" alt="enabled" />' %} - {% set icon_disabled = '<img src="/' ~ baseurlpath ~ 'resources/icons/silk/delete.png" alt="disabled" />' %} + {% set icon_enabled = '<i class="fa fa-check"></i>' %} + {% set icon_disabled = '<i class="fa fa-ban"></i>' %} <div class="enablebox mini"> <table> diff --git a/modules/core/templates/frontpage_federation.tpl.php b/modules/core/templates/frontpage_federation.tpl.php index f6e1596c560a6e76e12f3e109bedcdaf0e51265d..6bdce021115624cd0b38451de208c217e64dc1a3 100644 --- a/modules/core/templates/frontpage_federation.tpl.php +++ b/modules/core/templates/frontpage_federation.tpl.php @@ -43,7 +43,6 @@ if (is_array($this->data['metaentries']['hosted']) && count($this->data['metaent if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { $now = time(); foreach ($this->data['metaentries']['remote'] as $setkey => $set) { - echo '<fieldset class="fancyfieldset"><legend>'.$this->t($this->data['mtype'][$setkey]).' (Trusted)</legend>'; echo '<ul>'; foreach ($set as $entry) { @@ -52,7 +51,7 @@ if (is_array($this->data['metaentries']['remote']) && count($this->data['metaent htmlspecialchars( SimpleSAML\Module::getModuleURL( 'core/show_metadata.php', - array('entityid' => $entry['entityid'], 'set' => $setkey) + ['entityid' => $entry['entityid'], 'set' => $setkey] ) ).'">'); if (!empty($entry['name'])) { @@ -81,26 +80,26 @@ if (is_array($this->data['metaentries']['remote']) && count($this->data['metaent echo '</fieldset>'; } } + +echo '<h2>'.$this->t('{core:frontpage:tools}').'</h2>'; +echo '<ul>'; +foreach ($this->data['links_federation'] as $link) { + echo '<li><a href="'.htmlspecialchars($link['href']).'">'.$this->t($link['text']).'</a></li>'; +} +echo '</ul>'; +if ($this->data['isadmin']) { ?> - <h2><?php echo $this->t('{core:frontpage:tools}'); ?></h2> - <ul><?php - foreach ($this->data['links_federation'] as $link) { - echo '<li><a href="'.htmlspecialchars($link['href']).'">'.$this->t($link['text']).'</a></li>'; - } -?> - </ul> -<?php - if ($this->data['isadmin']) { ?> <fieldset class="fancyfieldset"> <legend>Lookup metadata</legend> <form action="<?php echo SimpleSAML\Module::getModuleURL('core/show_metadata.php'); ?>" method="get"> <p style="margin: 1em 2em ">Look up metadata for entity: - <select name="set"><?php - if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { - foreach ($this->data['metaentries']['remote'] as $setkey => $set) { - echo '<option value="'.htmlspecialchars($setkey).'">'.$this->t($this->data['mtype'][$setkey]).'</option>'; - } - } + <select name="set"> +<?php + if (is_array($this->data['metaentries']['remote']) && count($this->data['metaentries']['remote']) > 0) { + foreach ($this->data['metaentries']['remote'] as $setkey => $set) { + echo '<option value="'.htmlspecialchars($setkey).'">'.$this->t($this->data['mtype'][$setkey]).'</option>'; + } + } ?> </select> <input type="text" name="entityid" /> @@ -109,5 +108,5 @@ if (is_array($this->data['metaentries']['remote']) && count($this->data['metaent </form> </fieldset> <?php - } +} $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/core/templates/frontpage_welcome.tpl.php b/modules/core/templates/frontpage_welcome.tpl.php index 33d5ff25113874dd9ded7b920b7d94a7d5c8209d..da5c2e5297df57f79fd9fac751a7f0832cb3cebc 100644 --- a/modules/core/templates/frontpage_welcome.tpl.php +++ b/modules/core/templates/frontpage_welcome.tpl.php @@ -1,36 +1,23 @@ -<?php - +<?php $this->data['header'] = $this->t('{core:frontpage:page_title}'); -$this->includeAtTemplateBase('includes/header.php'); - -?> - +$this->includeAtTemplateBase('includes/header.php'); -<?php if ($this->data['isadmin']) { - echo '<p class="float-r youareadmin">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r youareadmin">'.$this->t('{core:frontpage:loggedin_as_admin}').'</p>'; } else { - echo '<p class="float-r youareadmin"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r youareadmin"><a href="'.$this->data['loginurl'].'">'. + $this->t('{core:frontpage:login_as_admin}').'</a></p>'; } ?> <p><?php echo $this->t('{core:frontpage:intro}'); ?></p> - <ul> <?php - foreach ($this->data['links_welcome'] AS $link) { - echo '<li><a href="' . htmlspecialchars($link['href']) . '">' . $this->t($link['text']) . '</a></li>'; - } +foreach ($this->data['links_welcome'] as $link) { + echo '<li><a href="'. htmlspecialchars($link['href']).'">'.$this->t($link['text']).'</a></li>'; +} ?> </ul> - - - - <h2><?php echo $this->t('{core:frontpage:about_header}'); ?></h2> - <p><?php echo $this->t('{core:frontpage:about_text}'); ?></p> - - - <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/core/templates/frontpage_welcome.twig b/modules/core/templates/frontpage_welcome.twig index de2f3757ca2897b077d688bdceb14e86ab0cd5ed..653c549352d21e8cdcd9ad4cc05bca15cfc34c2a 100644 --- a/modules/core/templates/frontpage_welcome.twig +++ b/modules/core/templates/frontpage_welcome.twig @@ -12,6 +12,4 @@ {% endfor %} </ul> - <h2>{{ '{core:frontpage:about_header}'|trans }}</h2> - <p>{{ '{core:frontpage:about_text}'|trans|raw }}</p> {% endblock %} diff --git a/modules/core/templates/login.twig b/modules/core/templates/login.twig index adf3f8426029a838847c170c28d8c70946067a9d..e1b342cc0a9ba9e71324930c7ff732f2e69f860e 100644 --- a/modules/core/templates/login.twig +++ b/modules/core/templates/login.twig @@ -2,7 +2,7 @@ {% extends "@core/base.twig" %} {% block content %} -<h1>{{ pagetitle|trans }}</h1> + <h1>{{ pagetitle|trans }}</h1> <p>Please choose one of the following authentication methods: </p> {% if sources is empty -%} @@ -17,4 +17,4 @@ </ul> </div> {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/modules/core/templates/loginuserpass.php b/modules/core/templates/loginuserpass.php index 61b16608836684e80f3589483fbefe20d30ea8f5..9e0fc646a1829f9fc93ac02f9cb43ea78200f744 100644 --- a/modules/core/templates/loginuserpass.php +++ b/modules/core/templates/loginuserpass.php @@ -8,26 +8,37 @@ if (strlen($this->data['username']) > 0) { } $this->includeAtTemplateBase('includes/header.php'); -?> - -<?php if ($this->data['errorcode'] !== null) { - ?> +?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l erroricon" style="margin: 15px" alt=""/> <h2><?php echo $this->t('{login:error_header}'); ?></h2> - <p><strong><?php - echo htmlspecialchars($this->t($this->data['errorcodes']['title'][$this->data['errorcode']], $this->data['errorparams'])); ?></strong></p> - - <p><?php - echo htmlspecialchars($this->t($this->data['errorcodes']['descr'][$this->data['errorcode']], $this->data['errorparams'])); ?></p> + <p><strong> + <?php + echo htmlspecialchars( + $this->t( + $this->data['errorcodes']['title'][$this->data['errorcode']], + $this->data['errorparams'] + ) + ); + ?> + </strong></p> + <p> + <?php + echo htmlspecialchars( + $this->t( + $this->data['errorcodes']['descr'][$this->data['errorcode']], + $this->data['errorparams'] + ) + ); + ?> + </p> </div> <?php } - ?> <h2 style="break: both"><?php echo $this->t('{login:user_pass_header}'); ?></h2> @@ -38,15 +49,14 @@ if ($this->data['errorcode'] !== null) { <tr> <td rowspan="2" class="loginicon"> <img alt="" - src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-authentication.48x48.png" /> + src="/<?php echo $this->data['baseurlpath']; ?> + resources/icons/experience/gtk-dialog-authentication.48x48.png" /> </td> <td><label for="username"><?php echo $this->t('{login:username}'); ?></label></td> <td> <input id="username" <?php echo ($this->data['forceUsername']) ? 'disabled="disabled"' : ''; ?> - type="text" name="username" -<?php if (!$this->data['forceUsername']) { - echo 'tabindex="1"'; -} ?> value="<?php echo htmlspecialchars($this->data['username']); ?>"/> + type="text" name="username"<?php echo $this->data['forceUsername'] ? '' : 'tabindex="1"'; ?> + value="<?php echo htmlspecialchars($this->data['username']); ?>" /> </td> <?php if ($this->data['rememberUsernameEnabled'] && !$this->data['forceUsername']) { @@ -55,7 +65,7 @@ if ($this->data['errorcode'] !== null) { <td id="regular_remember_username"> <input type="checkbox" id="remember_username" tabindex="4" <?php echo ($this->data['rememberUsernameChecked']) ? 'checked="checked"' : ''; ?> - name="remember_username" value="Yes"/> + name="remember_username" value="Yes" /> <small><?php echo $this->t('{login:remember_username}'); ?></small> </td> <?php @@ -65,24 +75,22 @@ if ($this->data['errorcode'] !== null) { <?php if ($this->data['rememberUsernameEnabled'] && !$this->data['forceUsername']) { // display the "remember my username" checkbox - ?> + ?> <tr id="mobile_remember_username"> <td> </td> <td> <input type="checkbox" id="remember_username" tabindex="4" <?php echo ($this->data['rememberUsernameChecked']) ? 'checked="checked"' : ''; ?> - name="remember_username" value="Yes"/> + name="remember_username" value="Yes" /> <small><?php echo $this->t('{login:remember_username}'); ?></small> </td> </tr> - <?php + <?php } ?> <tr> <td><label for="password"><?php echo $this->t('{login:password}'); ?></label></td> - <td> - <input id="password" type="password" tabindex="2" name="password"/> - </td> + <td><input id="password" type="password" tabindex="2" name="password" /></td> <?php if ($this->data['rememberMeEnabled']) { // display the remember me checkbox (keep me logged in) @@ -90,7 +98,7 @@ if ($this->data['errorcode'] !== null) { <td id="regular_remember_me"> <input type="checkbox" id="remember_me" tabindex="5" <?php echo ($this->data['rememberMeChecked']) ? 'checked="checked"' : ''; ?> - name="remember_me" value="Yes"/> + name="remember_me" value="Yes" /> <small><?php echo $this->t('{login:remember_me}'); ?></small> </td> <?php @@ -106,7 +114,7 @@ if ($this->data['errorcode'] !== null) { <td id="mobile_remember_me"> <input type="checkbox" id="remember_me" tabindex="5" <?php echo ($this->data['rememberMeChecked']) ? 'checked="checked"' : ''; ?> - name="remember_me" value="Yes"/> + name="remember_me" value="Yes" /> <small><?php echo $this->t('{login:remember_me}'); ?></small> </td> </tr> @@ -115,61 +123,62 @@ if ($this->data['errorcode'] !== null) { ?> <?php if (array_key_exists('organizations', $this->data)) { - ?> + ?> <tr> <td></td> <td><label for="organization"><?php echo $this->t('{login:organization}'); ?></label></td> <td><select name="organization" tabindex="3"> - <?php - if (array_key_exists('selectedOrg', $this->data)) { - $selectedOrg = $this->data['selectedOrg']; - } else { - $selectedOrg = null; - } - - foreach ($this->data['organizations'] as $orgId => $orgDesc) { - if (is_array($orgDesc)) { - $orgDesc = $this->t($orgDesc); - } + <?php + if (array_key_exists('selectedOrg', $this->data)) { + $selectedOrg = $this->data['selectedOrg']; + } else { + $selectedOrg = null; + } - if ($orgId === $selectedOrg) { - $selected = 'selected="selected" '; - } else { - $selected = ''; - } + foreach ($this->data['organizations'] as $orgId => $orgDesc) { + if (is_array($orgDesc)) { + $orgDesc = $this->t($orgDesc); + } - echo '<option '.$selected.'value="'.htmlspecialchars($orgId).'">'.htmlspecialchars($orgDesc).'</option>'; + if ($orgId === $selectedOrg) { + $selected = 'selected="selected" '; + } else { + $selected = ''; } - ?> + + echo '<option '.$selected.'value="'.htmlspecialchars($orgId).'">'. + htmlspecialchars($orgDesc).'</option>'; + } + ?> </select></td> <td style="padding: .4em;"> <?php if ($this->data['rememberOrganizationEnabled']) { echo str_repeat("\t", 4); - echo '<input type="checkbox" id="remember_organization" tabindex="5" name="remember_organization" value="Yes" '; - echo ($this->data['rememberOrganizationChecked'] ? 'checked="Yes" /> ' : '/> '); - echo $this->t('{login:remember_organization}'); + echo '<input type="checkbox" id="remember_organization" tabindex="5"'. + ' name="remember_organization" value="Yes" '. + ($this->data['rememberOrganizationChecked'] ? 'checked="Yes" /> ' : '/> '). + $this->t('{login:remember_organization}'); } ?> </td> </tr> - <?php + <?php } ?> <tr id="submit"> <td class="loginicon"></td><td></td> <td> - <button class="btn" - onclick="this.value='<?php echo $this->t('{login:processing}'); ?>'; - this.disabled=true; this.form.submit(); return true;" tabindex="6"> + <button id="submit_button" class="btn" tabindex="6"> <?php echo $this->t('{login:login_button}'); ?> </button> </td> </tr> </table> + <input type="hidden" id="processing_trans" value="<?php echo $this->t('{login:processing}'); ?>" /> <?php foreach ($this->data['stateparams'] as $name => $value) { - echo('<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'); + echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; } ?> </form> @@ -181,7 +190,7 @@ if (!empty($this->data['links'])) { } echo '</ul>'; } -echo('<h2 class="logintext">'.$this->t('{login:help_header}').'</h2>'); -echo('<p class="logintext">'.$this->t('{login:help_text}').'</p>'); +echo '<h2 class="logintext">'.$this->t('{login:help_header}').'</h2>'; +echo '<p class="logintext">'.$this->t('{login:help_text}').'</p>'; $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/core/templates/loginuserpass.twig b/modules/core/templates/loginuserpass.twig index 7f27bc186072f50cb616145daf0d596c4b12d79d..f474a339cfe0b82ec00bdbf8eeafbd7a18de1e0b 100644 --- a/modules/core/templates/loginuserpass.twig +++ b/modules/core/templates/loginuserpass.twig @@ -2,6 +2,10 @@ {% extends "@core/base.twig" %} +{% block postload %} + <script src="/{{baseurlpath}}module.php/core/assets/js/loginuserpass.js"></script> +{% endblock %} + {% block content %} {% if errorcode -%} <div class="pure-g"> @@ -99,10 +103,10 @@ </div> <!-- form-align--> <br><br> - <button class="pure-button pure-button-red pure-input-1-2 pure-input-sm-1-1 right" type="submit" onclick="this.value='{{ 'Processing...'|trans }}';" tabindex="6"> + <button class="pure-button pure-button-red pure-input-1-2 pure-input-sm-1-1 right" id="submit_button" type="submit" tabindex="6"> {{ 'Login'|trans }} </button> - + <input type='hidden' id="processing_trans" value="{{ 'Processing...'|trans }}" /> {% for name, value in stateparams -%} <input type="hidden" name="{{ name }}" value="{{ value }}" /> {%- endfor %} diff --git a/modules/core/templates/logout-iframe.php b/modules/core/templates/logout-iframe.php index 634ed122da80247efe7fd85625758848c3338e7c..54ca2c1829d135cef464a64a055d7aa965443f67 100644 --- a/modules/core/templates/logout-iframe.php +++ b/modules/core/templates/logout-iframe.php @@ -5,24 +5,24 @@ $type = $this->data['type']; $from = $this->data['from']; $SPs = $this->data['SPs']; -$stateImage = array( +$stateImage = [ 'unsupported' => '/'.$this->data['baseurlpath'].'resources/icons/silk/delete.png', 'completed' => '/'.$this->data['baseurlpath'].'resources/icons/silk/accept.png', 'onhold' => '/'.$this->data['baseurlpath'].'resources/icons/bullet16_grey.png', 'inprogress' => '/'.$this->data['baseurlpath'].'resources/progress.gif', 'failed' => '/'.$this->data['baseurlpath'].'resources/icons/silk/exclamation.png', -); +]; -$stateText = array( +$stateText = [ 'unsupported' => '', 'completed' => $this->t('{logout:completed}'), 'onhold' => '', 'inprogress' => $this->t('{logout:progress}'), 'failed' => $this->t('{logout:failed}'), -); +]; -$spStatus = array(); -$spTimeout = array(); +$spStatus = []; +$spTimeout = []; $nFailed = 0; $nProgress = 0; foreach ($SPs as $assocId => $sp) { @@ -71,14 +71,14 @@ if ($type === 'embed') { $this->includeAtTemplateBase('includes/header.php'); } ?> - <div id="wrap"> - <div id="content"> +<div id="wrap"> + <div id="content"> <?php if ($from !== null) { echo '<div><img style="float: left; margin-right: 12px" src="/'.$this->data['baseurlpath']. 'resources/icons/checkmark.48x48.png" alt="Successful logout" />'; echo '<p style="padding-top: 16px; ">'. - $this->t('{logout:loggedoutfrom}', array('%SP%' => '<strong>'.htmlspecialchars($from).'</strong>')).'</p>'; + $this->t('{logout:loggedoutfrom}', ['%SP%' => '<strong>'.htmlspecialchars($from).'</strong>']).'</p>'; echo '<p style="height: 0px; clear: left;"></p></div>'; } @@ -90,9 +90,9 @@ if ($type === 'init') { } else { echo $this->t('{logout:logging_out_from}'); } -echo('</p>'); ?> - <table id="slostatustable"> + </p> + <table id="slostatustable"> <?php foreach ($SPs as $assocId => $sp) { if (isset($sp['core:Logout-IFrame:Name'])) { @@ -117,30 +117,32 @@ foreach ($SPs as $assocId => $sp) { } if (isset($from)) { - $logoutCancelText = $this->t('{logout:logout_only}', array('%SP%' => htmlspecialchars($from))); + $logoutCancelText = $this->t('{logout:logout_only}', ['%SP%' => htmlspecialchars($from)]); } else { $logoutCancelText = $this->t('{logout:no}'); } ?> - </table> - </div> + </table> +</div> <?php if ($type === 'init') { ?> - <div id="confirmation" style="margin-top: 1em"> - <p><?php echo $this->t('{logout:logout_all_question}'); ?> <br/></p> - <form id="startform" method="get" style="display:inline;" action="logout-iframe.php"> - <input type="hidden" name="id" value="<?php echo $id; ?>"/> - <input type="hidden" id="logout-type-selector" name="type" value="nojs"/> - <button type="submit" id="logout-all" name="ok" class="btn"><?php echo $this->t('{logout:logout_all}'); ?></button> - </form> - <form method="get" style="display:inline;" action="logout-iframe-done.php"> - <input type="hidden" name="id" value="<?php echo $id; ?>"/> - <button type="submit" name="cancel" class="btn"><?php echo $logoutCancelText; ?></button> - </form> - </div> +<div id="confirmation" style="margin-top: 1em"> + <p><?php echo $this->t('{logout:logout_all_question}'); ?> <br/></p> + <form id="startform" method="get" style="display:inline;" action="logout-iframe.php"> + <input type="hidden" name="id" value="<?php echo $id; ?>"/> + <input type="hidden" id="logout-type-selector" name="type" value="nojs"/> + <button type="submit" id="logout-all" name="ok" class="btn"> + <?php echo $this->t('{logout:logout_all}'); ?> + </button> + </form> + <form method="get" style="display:inline;" action="logout-iframe-done.php"> + <input type="hidden" name="id" value="<?php echo $id; ?>"/> + <button type="submit" name="cancel" class="btn"><?php echo $logoutCancelText; ?></button> + </form> +</div> <?php } else { if ($nFailed > 0) { @@ -150,7 +152,8 @@ if ($type === 'init') { } echo '<div id="logout-failed-message" style="margin-top: 1em; border: 1px solid #ccc; padding: 1em; '. 'background: #eaeaea;'.$displayStyle.'">'; - echo '<img src="/'.$this->data['baseurlpath'].'resources/icons/experience/gtk-dialog-warning.48x48.png" alt="" '. + echo '<img src="/'.$this->data['baseurlpath']. + 'resources/icons/experience/gtk-dialog-warning.48x48.png" alt="" '. 'style="float: left; margin-right: 5px;" />'; echo '<p>'.$this->t('{logout:failedsps}').'</p>'; echo '<form method="post" action="logout-iframe-done.php" id="failed-form" target="_top">'; @@ -166,11 +169,11 @@ if ($type === 'init') { } echo '<p>'.$this->t('{logout:success}').'</p>'; ?> - <form method="post" action="logout-iframe-done.php" id="done-form" target="_top"> - <input type="hidden" name="id" value="<?php echo $id; ?>"/> - <button type="submit" name="continue" class="btn"><?php echo $this->t('{logout:return}'); ?></button> - </form> - </div> + <form method="post" action="logout-iframe-done.php" id="done-form" target="_top"> + <input type="hidden" name="id" value="<?php echo $id; ?>"/> + <button type="submit" name="continue" class="btn"><?php echo $this->t('{logout:return}'); ?></button> + </form> +</div> <?php if ($type === 'js') { foreach ($SPs as $assocId => $sp) { @@ -185,8 +188,8 @@ if ($type === 'init') { } } ?> - </div><!-- #content --> - </div><!-- #wrap --> + </div><!-- #content --> + </div><!-- #wrap --> <?php if ($type === 'embed') { $this->includeAtTemplateBase('includes/footer-embed.php'); diff --git a/modules/core/templates/no_metadata.tpl.php b/modules/core/templates/no_metadata.tpl.php index d3b638b22542158ff7c6042c6433947291cb612c..a00f3ce911bd2bf97f7ab11dc6200e4a109dd015 100644 --- a/modules/core/templates/no_metadata.tpl.php +++ b/modules/core/templates/no_metadata.tpl.php @@ -1,9 +1,8 @@ <?php -echo('<p>' . $this->t('{core:no_metadata:config_problem}') . '</p>'); - -echo('<ul>'); -echo('<li>' . $this->t('{core:no_metadata:suggestion_user_link}') . '</li>'); -echo('<li>' . $this->t('{core:no_metadata:suggestion_developer}') . '</li>'); -echo('</ul>'); +echo '<p>'.$this->t('{core:no_metadata:config_problem}').'</p>'; +echo '<ul>'; +echo '<li>'.$this->t('{core:no_metadata:suggestion_user_link}').'</li>'; +echo '<li>'.$this->t('{core:no_metadata:suggestion_developer}').'</li>'; +echo '</ul>'; diff --git a/modules/core/templates/no_metadata.twig b/modules/core/templates/no_metadata.twig index 818c08a8ca46d0a222f8f64c87b00f588ecbc23e..0f534fcdab94a9dbb9982ac1bfae1304c1c8e05c 100644 --- a/modules/core/templates/no_metadata.twig +++ b/modules/core/templates/no_metadata.twig @@ -1,7 +1,7 @@ -<p>{{ '{core:no_metadata:config_problem}' | trans }}</p> +<p>{{ '{core:no_metadata:config_problem}'|trans }}</p> <ul> - <li>{{ '{core:no_metadata:suggestion_user_link}' | trans }}</li> - <li>{{ '{core:no_metadata:suggestion_developer}' | trans }}</li> + <li>{{ '{core:no_metadata:suggestion_user_link}'|trans }}</li> + <li>{{ '{core:no_metadata:suggestion_developer}'|trans }}</li> </ul> diff --git a/modules/core/templates/no_state.tpl.php b/modules/core/templates/no_state.tpl.php index f86e346e0e8fdebe1360e384c0f941a7dee8a639..01ea6db789e94678cd97d8c384909037c5afdf71 100644 --- a/modules/core/templates/no_state.tpl.php +++ b/modules/core/templates/no_state.tpl.php @@ -1,15 +1,14 @@ <?php -echo('<h3>' . $this->t('{core:no_state:suggestions}') . '</h3>'); -echo('<ul>'); -echo('<li>' . $this->t('{core:no_state:suggestion_goback}') . '</li>'); -echo('<li>' . $this->t('{core:no_state:suggestion_closebrowser}') . '</li>'); -echo('</ul>'); - -echo('<h3>' . $this->t('{core:no_state:causes}') . '</h3>'); -echo('<ul>'); -echo('<li>' . $this->t('{core:no_state:cause_backforward}') . '</li>'); -echo('<li>' . $this->t('{core:no_state:cause_openbrowser}') . '</li>'); -echo('<li>' . $this->t('{core:no_state:cause_nocookie}') . '</li>'); -echo('</ul>'); +echo '<h3>'.$this->t('{core:no_state:suggestions}').'</h3>'; +echo '<ul>'; +echo '<li>'.$this->t('{core:no_state:suggestion_goback}').'</li>'; +echo '<li>'.$this->t('{core:no_state:suggestion_closebrowser}').'</li>'; +echo '</ul>'; +echo '<h3>'.$this->t('{core:no_state:causes}').'</h3>'; +echo '<ul>'; +echo '<li>'.$this->t('{core:no_state:cause_backforward}').'</li>'; +echo '<li>'.$this->t('{core:no_state:cause_openbrowser}').'</li>'; +echo '<li>'.$this->t('{core:no_state:cause_nocookie}').'</li>'; +echo '</ul>'; diff --git a/modules/core/templates/no_state.twig b/modules/core/templates/no_state.twig index 9ae61fb5dcbc9316dfab58a2286b69698e6ec2d4..b811c102506c386e15a3606a3e796dc56bea93f9 100644 --- a/modules/core/templates/no_state.twig +++ b/modules/core/templates/no_state.twig @@ -1,12 +1,12 @@ -<h3>{{ '{core:no_state:suggestions}' | trans }}</h3> +<h3>{{ '{core:no_state:suggestions}'|trans }}</h3> <ul> - <li>{{ '{core:no_state:suggestion_goback}' | trans }}</li> - <li>{{ '{core:no_state:suggestion_closebrowser}' | trans }}</li> + <li>{{ '{core:no_state:suggestion_goback}'|trans }}</li> + <li>{{ '{core:no_state:suggestion_closebrowser}'|trans }}</li> </ul> -<h3>{{ '{core:no_state:causes}' | trans }}</h3> +<h3>{{ '{core:no_state:causes}'|trans }}</h3> <ul> - <li>{{ '{core:no_state:cause_backforward}' | trans }}</li> - <li>{{ '{core:no_state:cause_openbrowser}' | trans }}</li> - <li>{{ '{core:no_state:cause_nocookie}' | trans }}</li> + <li>{{ '{core:no_state:cause_backforward}'|trans }}</li> + <li>{{ '{core:no_state:cause_openbrowser}'|trans }}</li> + <li>{{ '{core:no_state:cause_nocookie}'|trans }}</li> </ul> diff --git a/modules/core/templates/short_sso_interval.php b/modules/core/templates/short_sso_interval.php index ac334a6c0d8ca6f47f9f5b9c37a8bd28dd16840d..2e305c2b9ddf1ac3a6a190c36a7fc626e3665040 100644 --- a/modules/core/templates/short_sso_interval.php +++ b/modules/core/templates/short_sso_interval.php @@ -14,15 +14,17 @@ $this->data['header'] = $this->t('{core:short_sso_interval:warning_header}'); $this->data['autofocus'] = 'contbutton'; $this->includeAtTemplateBase('includes/header.php'); +$target = htmlspecialchars($this->data['target']); +$contButton = htmlspecialchars($this->t('{core:short_sso_interval:retry}')); ?> <h1><?php echo $this->data['header']; ?></h1> -<form style="display: inline; margin: 0px; padding: 0px" action="<?php echo htmlspecialchars($this->data['target']); ?>"> +<form style="display: inline; margin: 0px; padding: 0px" action="<?php echo $target; ?>"> <?php - // Embed hidden fields... - foreach ($this->data['params'] as $name => $value) { - echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; - } +// Embed hidden fields... +foreach ($this->data['params'] as $name => $value) { + echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; +} ?> <p><?php echo $this->t('{core:short_sso_interval:warning}'); ?></p> <div class="trackidtext"><p> @@ -31,7 +33,7 @@ $this->includeAtTemplateBase('includes/header.php'); </p> </div> - <input type="submit" name="continue" id="contbutton" value="<?php echo htmlspecialchars($this->t('{core:short_sso_interval:retry}')) ?>" /> + <input type="submit" name="continue" id="contbutton" value="<?php echo $contButton; ?>" /> </form> diff --git a/modules/core/templates/short_sso_interval.twig b/modules/core/templates/short_sso_interval.twig index 91288cd9f7d5cfe94ca5b20de621dcb4c51262ac..542e174c0a9315e54c873bafe4895e17dd5473f6 100644 --- a/modules/core/templates/short_sso_interval.twig +++ b/modules/core/templates/short_sso_interval.twig @@ -5,12 +5,12 @@ <h1>{{ header }}</h1> <form style="display: inline; margin: 0px; padding: 0px" action="{{ target|escape('html') }}"> {% for name, value in params %} - <input type="hidden" name="{{ name|escape('html') }}" value="{{ value|escape('html') }}" /> + <input type="hidden" name="{{ name|escape('html') }}" value="{{ value|escape('html') }}"> {% endfor %} <p>{{ '{core:short_sso_interval:warning}'|trans }}</p> <div class="trackidtext"> <p>{{ '{errors:report_trackid}'|trans }}<span class="trackid">{{ trackId }}</span></p> </div> - <input type="submit" name="continue" id="contbutton" value="'{core:short_sso_interval:retry}'|trans|escape('html') }}" /> + <input type="submit" name="continue" id="contbutton" value="'{core:short_sso_interval:retry}'|trans|escape('html') }}" autofocus> </form> {% endblock %} diff --git a/modules/core/www/as_login.php b/modules/core/www/as_login.php index 14d8b1dc9f5dd7db009607bf417b78517fde0181..d73fa8ca0badc83638f3c4e887ff669536bd9ff0 100644 --- a/modules/core/www/as_login.php +++ b/modules/core/www/as_login.php @@ -17,9 +17,9 @@ if (!isset($_REQUEST['AuthId'])) { /* * Setting up the options for the requireAuth() call later.. */ -$options = array( +$options = [ 'ReturnTo' => \SimpleSAML\Utils\HTTP::checkURLAllowed($_REQUEST['ReturnTo']), -); +]; /* * Allows a saml:idp query string parameter specify the IdP entity ID to be used diff --git a/modules/core/www/assets/js/loginuserpass.js b/modules/core/www/assets/js/loginuserpass.js new file mode 100644 index 0000000000000000000000000000000000000000..e475e8ca6ec6a497dc7159695c82e2806d463906 --- /dev/null +++ b/modules/core/www/assets/js/loginuserpass.js @@ -0,0 +1,15 @@ +document.addEventListener( + 'DOMContentLoaded', + function () { + var button = document.getElementById("submit_button"); + button.addEventListener( + 'click', + function () { + var translation = document.getElementById("processing_trans"); + this.disabled = true; + this.innerHTML = translation.value; + return true; + } + ); + } +); diff --git a/modules/core/www/authenticate.php b/modules/core/www/authenticate.php index df978a8f1eea7955153cfd41a4c067c92debc3f3..e1484e1fed26af74e45614a8650e3c7ff56b032c 100644 --- a/modules/core/www/authenticate.php +++ b/modules/core/www/authenticate.php @@ -28,11 +28,11 @@ if (array_key_exists(\SimpleSAML\Auth\State::EXCEPTION_PARAM, $_REQUEST)) { } if (!$as->isAuthenticated()) { - $url = \SimpleSAML\Module::getModuleURL('core/authenticate.php', array('as' => $asId)); - $params = array( + $url = \SimpleSAML\Module::getModuleURL('core/authenticate.php', ['as' => $asId]); + $params = [ 'ErrorURL' => $url, 'ReturnTo' => $url, - ); + ]; $as->login($params); } diff --git a/modules/core/www/cardinality_error.php b/modules/core/www/cardinality_error.php index c73a4fee6da9746252c3a3b6b749c60ad6cef971..b3a3e5b99c17fb4b5a446319cd719b570ac18265 100644 --- a/modules/core/www/cardinality_error.php +++ b/modules/core/www/cardinality_error.php @@ -20,7 +20,10 @@ $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:cardinality_error.tpl.php'); $t->data['cardinalityErrorAttributes'] = $state['core:cardinality:errorAttributes']; if (isset($state['Source']['auth'])) { - $t->data['LogoutURL'] = \SimpleSAML\Module::getModuleURL('core/authenticate.php', array('as' => $state['Source']['auth']))."&logout"; + $t->data['LogoutURL'] = \SimpleSAML\Module::getModuleURL( + 'core/authenticate.php', + ['as' => $state['Source']['auth']] + )."&logout"; } header('HTTP/1.0 403 Forbidden'); $t->show(); diff --git a/modules/core/www/cleardiscochoices.php b/modules/core/www/cleardiscochoices.php index 8d134f7d758d1af750f14d844dbdf6f36b598cfb..f997f1607fd7fc080c9caa1797f80220ae784bf3 100644 --- a/modules/core/www/cleardiscochoices.php +++ b/modules/core/www/cleardiscochoices.php @@ -20,7 +20,7 @@ foreach ($_COOKIE as $cookieName => $value) { /* Delete the cookie. We delete it once without the secure flag and once with the secure flag. This * ensures that the cookie will be deleted in any case. */ - \SimpleSAML\Utils\HTTP::setCookie($cookieName, null, array('path' => $cookiePath, 'httponly' => false), false); + \SimpleSAML\Utils\HTTP::setCookie($cookieName, null, ['path' => $cookiePath, 'httponly' => false], false); } // Find where we should go now. @@ -33,4 +33,3 @@ if (array_key_exists('ReturnTo', $_REQUEST)) { // Redirect to destination. \SimpleSAML\Utils\HTTP::redirectTrustedURL($returnTo); - diff --git a/modules/core/www/frontpage_auth.php b/modules/core/www/frontpage_auth.php index 0c9fb078777bb0e2b2c8645147e3f3eb755cec3e..081151788e230f0fccedf24d7e9f1cbb0b51b9a4 100644 --- a/modules/core/www/frontpage_auth.php +++ b/modules/core/www/frontpage_auth.php @@ -10,31 +10,33 @@ if ($config->getBoolean('admin.protectindexpage', false)) { } $loginurl = \SimpleSAML\Utils\Auth::getAdminLoginURL(); $isadmin = \SimpleSAML\Utils\Auth::isAdmin(); +$logouturl = \SimpleSAML\Utils\Auth::getAdminLogoutURL(); -$links = array(); -$links_welcome = array(); -$links_config = array(); -$links_auth = array(); -$links_federation = array(); +$links = []; +$links_welcome = []; +$links_config = []; +$links_auth = []; +$links_federation = []; -$links_auth[] = array( +$links_auth[] = [ 'href' => 'login.php', 'text' => '{core:frontpage:authtest}', -); +]; -$allLinks = array( +$allLinks = [ 'links' => &$links, 'welcome' => &$links_welcome, 'config' => &$links_config, 'auth' => &$links_auth, 'federation' => &$links_federation, -); +]; \SimpleSAML\Module::callHooks('frontpage', $allLinks); $t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_auth.tpl.php'); $t->data['pageid'] = 'frontpage_auth'; $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; +$t->data['logouturl'] = $logouturl; $t->data['header'] = $t->getTranslator()->t('{core:frontpage:page_title}'); $t->data['links'] = $links; @@ -44,5 +46,3 @@ $t->data['links_auth'] = $links_auth; $t->data['links_federation'] = $links_federation; $t->show(); - - diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index dc595db4739fe9c6ef5c2d6747539fd85cf89eb5..dbd9a87b97ad91346b080c83fa7ff11b9370fcdc 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -10,9 +10,9 @@ if ($config->getBoolean('admin.protectindexpage', false)) { } $loginurl = \SimpleSAML\Utils\Auth::getAdminLoginURL(); $isadmin = \SimpleSAML\Utils\Auth::isAdmin(); +$logouturl = \SimpleSAML\Utils\Auth::getAdminLogoutURL(); - -$warnings = array(); +$warnings = []; if (!\SimpleSAML\Utils\HTTP::isHTTPS()) { $warnings[] = '{core:frontpage:warnings_https}'; @@ -29,29 +29,29 @@ if (extension_loaded('suhosin')) { } } -$links = array(); -$links_welcome = array(); -$links_config = array(); -$links_auth = array(); -$links_federation = array(); +$links = []; +$links_welcome = []; +$links_config = []; +$links_auth = []; +$links_federation = []; -$links_config[] = array( +$links_config[] = [ 'href' => \SimpleSAML\Utils\HTTP::getBaseURL().'admin/hostnames.php', 'text' => '{core:frontpage:link_diagnostics}' -); +]; -$links_config[] = array( +$links_config[] = [ 'href' => \SimpleSAML\Utils\HTTP::getBaseURL().'admin/phpinfo.php', 'text' => '{core:frontpage:link_phpinfo}' -); +]; -$allLinks = array( +$allLinks = [ 'links' => &$links, 'welcome' => &$links_welcome, 'config' => &$links_config, 'auth' => &$links_auth, 'federation' => &$links_federation, -); +]; \SimpleSAML\Module::callHooks('frontpage', $allLinks); // Check for updates. Store the remote result in the session so we @@ -82,85 +82,85 @@ if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master') if ($latest && version_compare($current, ltrim($latest['tag_name'], 'v'), 'lt')) { $outdated = true; - $warnings[] = array( + $warnings[] = [ '{core:frontpage:warnings_outdated}', - array('%LATEST_URL%' => $latest['html_url']) - ); + ['%LATEST_URL%' => $latest['html_url']] + ]; } } } -$enablematrix = array( +$enablematrix = [ 'saml20idp' => $config->getBoolean('enable.saml20-idp', false), 'shib13idp' => $config->getBoolean('enable.shib13-idp', false), -); - - -$functionchecks = array( - 'time' => array('required', 'Date/Time Extension'), - 'hash' => array('required', 'Hashing function'), - 'gzinflate' => array('required', 'ZLib'), - 'openssl_sign' => array('required', 'OpenSSL'), - 'dom_import_simplexml' => array('required', 'XML DOM'), - 'preg_match' => array('required', 'RegEx support'), - 'json_decode' => array('required', 'JSON support'), - 'class_implements' => array('required', 'Standard PHP Library (SPL)'), - 'mb_strlen' => array('required', 'Multibyte String Extension'), - 'curl_init' => array('optional', 'cURL (required if automatic version checks are used, also by some modules.'), - 'session_start' => array('optional', 'Session Extension (required if PHP sessions are used)'), - 'pdo_drivers' => array('optional', 'PDO Extension (required if a database backend is used)'), -); +]; + + +$functionchecks = [ + 'time' => ['required', 'Date/Time Extension'], + 'hash' => ['required', 'Hashing function'], + 'gzinflate' => ['required', 'ZLib'], + 'openssl_sign' => ['required', 'OpenSSL'], + 'dom_import_simplexml' => ['required', 'XML DOM'], + 'preg_match' => ['required', 'RegEx support'], + 'json_decode' => ['required', 'JSON support'], + 'class_implements' => ['required', 'Standard PHP Library (SPL)'], + 'mb_strlen' => ['required', 'Multibyte String Extension'], + 'curl_init' => ['optional', 'cURL (required if automatic version checks are used, also by some modules.'], + 'session_start' => ['optional', 'Session Extension (required if PHP sessions are used)'], + 'pdo_drivers' => ['optional', 'PDO Extension (required if a database backend is used)'], +]; if (\SimpleSAML\Module::isModuleEnabled('ldap')) { - $functionchecks['ldap_bind'] = array('optional', 'LDAP Extension (required if an LDAP backend is used)'); + $functionchecks['ldap_bind'] = ['optional', 'LDAP Extension (required if an LDAP backend is used)']; } if (\SimpleSAML\Module::isModuleEnabled('radius')) { - $functionchecks['radius_auth_open'] = array('optional', 'Radius Extension (required if a Radius backend is used)'); + $functionchecks['radius_auth_open'] = ['optional', 'Radius Extension (required if a Radius backend is used)']; } -$funcmatrix = array(); -$funcmatrix[] = array( - 'required' => 'required', +$funcmatrix = []; +$funcmatrix[] = [ + 'required' => 'required', 'descr' => 'PHP Version >= 5.4. You run: '.phpversion(), 'enabled' => version_compare(phpversion(), '5.4', '>=') -); +]; foreach ($functionchecks as $func => $descr) { - $funcmatrix[] = array('descr' => $descr[1], 'required' => $descr[0], 'enabled' => function_exists($func)); + $funcmatrix[] = ['descr' => $descr[1], 'required' => $descr[0], 'enabled' => function_exists($func)]; } -$funcmatrix[] = array( +$funcmatrix[] = [ 'required' => 'optional', 'descr' => 'predis/predis (required if the redis data store is used)', 'enabled' => class_exists('\Predis\Client'), -); +]; -$funcmatrix[] = array( +$funcmatrix[] = [ 'required' => 'optional', 'descr' => 'Memcache or Memcached Extension (required if a Memcached backend is used)', 'enabled' => class_exists('Memcache') || class_exists('Memcached'), -); +]; -/* Some basic configuration checks */ +// Some basic configuration checks if ($config->getString('technicalcontact_email', 'na@example.org') === 'na@example.org') { $mail_ok = false; } else { $mail_ok = true; } -$funcmatrix[] = array( +$funcmatrix[] = [ 'required' => 'recommended', 'descr' => 'technicalcontact_email option set', 'enabled' => $mail_ok -); +]; if ($config->getString('auth.adminpassword', '123') === '123') { $password_ok = false; } else { $password_ok = true; } -$funcmatrix[] = array( +$funcmatrix[] = [ 'required' => 'required', 'descr' => 'auth.adminpassword option set', 'enabled' => $password_ok -); +]; $t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_config.tpl.php'); $translator = $t->getTranslator(); @@ -168,6 +168,7 @@ $t->data['pageid'] = 'frontpage_config'; $t->data['header'] = $translator->t('{core:frontpage:page_title}'); $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; +$t->data['logouturl'] = $logouturl; foreach ($warnings as &$warning) { if (is_array($warning)) { @@ -188,11 +189,11 @@ $t->data['links_federation'] = $links_federation; $t->data['enablematrix'] = $enablematrix; $t->data['funcmatrix'] = $funcmatrix; -$t->data['requiredmap'] = array( +$t->data['requiredmap'] = [ 'recommended' => $translator->noop('{core:frontpage:recommended}'), 'required' => $translator->noop('{core:frontpage:required}'), 'optional' => $translator->noop('{core:frontpage:optional}'), -); +]; $t->data['version'] = $config->getVersion(); $t->data['directory'] = dirname(dirname(dirname(dirname(__FILE__)))); diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index ec0132ac8d00c3c6a9f3c8e0d95de609f4242c8a..1d00be38e7873e5702d2331965dad4fb20bb1b28 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -8,45 +8,46 @@ $session = \SimpleSAML\Session::getSessionFromRequest(); if ($config->getBoolean('admin.protectindexpage', false)) { \SimpleSAML\Utils\Auth::requireAdmin(); } +$logouturl = \SimpleSAML\Utils\Auth::getAdminLogoutURL(); $loginurl = \SimpleSAML\Utils\Auth::getAdminLoginURL(); $isadmin = \SimpleSAML\Utils\Auth::isAdmin(); -$links = array(); -$links_welcome = array(); -$links_config = array(); -$links_auth = array(); -$links_federation = array(); +$links = []; +$links_welcome = []; +$links_config = []; +$links_auth = []; +$links_federation = []; if ($config->getBoolean('idpdisco.enableremember', false)) { - $links_federation[] = array( + $links_federation[] = [ 'href' => 'cleardiscochoices.php', 'text' => '{core:frontpage:link_cleardiscochoices}', - ); + ]; } -$links_federation[] = array( +$links_federation[] = [ 'href' => \SimpleSAML\Utils\HTTP::getBaseURL().'admin/metadata-converter.php', 'text' => '{core:frontpage:link_xmlconvert}', -); +]; -$allLinks = array( +$allLinks = [ 'links' => &$links, 'welcome' => &$links_welcome, 'config' => &$links_config, 'auth' => &$links_auth, 'federation' => &$links_federation, -); +]; \SimpleSAML\Module::callHooks('frontpage', $allLinks); -$metadataHosted = array(); +$metadataHosted = []; \SimpleSAML\Module::callHooks('metadata_hosted', $metadataHosted); $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); -$metaentries = array('hosted' => $metadataHosted, 'remote' => array()); +$metaentries = ['hosted' => $metadataHosted, 'remote' => []]; if ($isadmin) { @@ -83,7 +84,7 @@ if ($config->getBoolean('enable.adfs-idp', false) === true) { $metaentries['hosted']['adfs-idp'] = $metadata->getMetaDataCurrent('adfs-idp-hosted'); $metaentries['hosted']['adfs-idp']['metadata-url'] = \SimpleSAML\Module::getModuleURL( 'adfs/idp/metadata.php', - array('output' => 'xhtml') + ['output' => 'xhtml'] ); if ($isadmin) { $metaentries['remote']['adfs-sp-remote'] = $metadata->getList('adfs-sp-remote'); @@ -103,13 +104,14 @@ $t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_federation.tpl.php' $translator = $t->getTranslator(); $language = $translator->getLanguage()->getLanguage(); -$defaultLanguage = $config->getString('language.default', 'en'); +$fallbackLanguage = 'en'; +$defaultLanguage = $config->getString('language.default', $fallbackLanguage); -$translators = array( +$translators = [ 'name' => 'name_translated', 'descr' => 'descr_translated', 'OrganizationDisplayName' => 'organizationdisplayname_translated', -); +]; foreach ($metaentries['hosted'] as $index => $entity) { foreach ($translators as $old => $new) { @@ -117,9 +119,9 @@ foreach ($metaentries['hosted'] as $index => $entity) { $metaentries['hosted'][$index][$new] = $entity[$old][$language]; } elseif (isset($entity[$old][$defaultLanguage])) { $metaentries['hosted'][$index][$new] = $entity[$old][$defaultLanguage]; - } elseif (isset($metaentries['hosted'][$index][$old])) { - $metaentries['hosted'][$index][$new] = $metaentries['hosted'][$index][$old]; - } + } elseif (isset($entity[$old][$fallbackLanguage])) { + $metaentries['hosted'][$index][$new] = $entity[$old][$fallbackLanguage]; + } } } foreach ($metaentries['remote'] as $key => $set) { @@ -129,6 +131,8 @@ foreach ($metaentries['remote'] as $key => $set) { $metaentries['remote'][$key][$entityid][$new] = $entity[$old][$language]; } elseif (isset($entity[$old][$defaultLanguage])) { $metaentries['remote'][$key][$entityid][$new] = $entity[$old][$defaultLanguage]; + } elseif (isset($entity[$old][$fallbackLanguage])) { + $metaentries['remote'][$key][$entityid][$new] = $entity[$old][$fallbackLanguage]; } elseif (isset($metaentries['remote'][$key][$entityid][$old])) { $metaentries['remote'][$key][$entityid][$new] = $metaentries['remote'][$key][$entityid][$old]; } @@ -137,7 +141,7 @@ foreach ($metaentries['remote'] as $key => $set) { } # look up translated string -$mtype = array( +$mtype = [ 'saml20-sp-remote' => $translator->noop('{admin:metadata_saml20-sp}'), 'saml20-sp-hosted' => $translator->noop('{admin:metadata_saml20-sp}'), 'saml20-idp-remote' => $translator->noop('{admin:metadata_saml20-idp}'), @@ -150,12 +154,12 @@ $mtype = array( 'adfs-sp-hosted' => $translator->noop('{admin:metadata_adfs-sp}'), 'adfs-idp-remote' => $translator->noop('{admin:metadata_adfs-idp}'), 'adfs-idp-hosted' => $translator->noop('{admin:metadata_adfs-idp}'), -); +]; $t->data['pageid'] = 'frontpage_federation'; $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; - +$t->data['logouturl'] = $logouturl; $t->data['links'] = $links; $t->data['links_welcome'] = $links_welcome; @@ -169,4 +173,3 @@ $t->data['metaentries'] = $metaentries; $t->data['mtype'] = $mtype; $t->show(); - diff --git a/modules/core/www/frontpage_welcome.php b/modules/core/www/frontpage_welcome.php index 46a3c0bc5c923336af3df32b4e84d185ec823984..4dfb4fef195ac8fb0f803e6c2bb2e8e0e4229f81 100644 --- a/modules/core/www/frontpage_welcome.php +++ b/modules/core/www/frontpage_welcome.php @@ -8,27 +8,28 @@ $session = \SimpleSAML\Session::getSessionFromRequest(); if ($config->getBoolean('admin.protectindexpage', false)) { SimpleSAML\Utils\Auth::requireAdmin(); } +$logouturl = \SimpleSAML\Utils\Auth::getAdminLogoutURL(); $loginurl = \SimpleSAML\Utils\Auth::getAdminLoginURL(); $isadmin = \SimpleSAML\Utils\Auth::isAdmin(); -$links = array(); -$links_welcome = array(); -$links_config = array(); -$links_auth = array(); -$links_federation = array(); +$links = []; +$links_welcome = []; +$links_config = []; +$links_auth = []; +$links_federation = []; -$allLinks = array( +$allLinks = [ 'links' => &$links, 'welcome' => &$links_welcome, 'config' => &$links_config, 'auth' => &$links_auth, 'federation' => &$links_federation, -); +]; -$links_welcome[] = array( +$links_welcome[] = [ 'href' => 'https://simplesamlphp.org/docs/stable/', 'text' => '{core:frontpage:doc_header}', -); +]; \SimpleSAML\Module::callHooks('frontpage', $allLinks); @@ -36,6 +37,7 @@ $t = new \SimpleSAML\XHTML\Template($config, 'core:frontpage_welcome.tpl.php'); $t->data['pageid'] = 'frontpage_welcome'; $t->data['isadmin'] = $isadmin; $t->data['loginurl'] = $loginurl; +$t->data['logouturl'] = $logouturl; $t->data['links'] = $links; $t->data['links_welcome'] = $links_welcome; diff --git a/modules/core/www/idp/logout-iframe-done.php b/modules/core/www/idp/logout-iframe-done.php index a01665a646fe8b83f3185aceaac5654454031c91..7725754e48b0e10d2b3e468274b640a42ed41a93 100644 --- a/modules/core/www/idp/logout-iframe-done.php +++ b/modules/core/www/idp/logout-iframe-done.php @@ -10,13 +10,13 @@ $associations = $idp->getAssociations(); if (!isset($_REQUEST['cancel'])) { \SimpleSAML\Logger::stats('slo-iframe done'); - \SimpleSAML\Stats::log('core:idp:logout-iframe:page', array('type' => 'done')); + \SimpleSAML\Stats::log('core:idp:logout-iframe:page', ['type' => 'done']); $SPs = $state['core:Logout-IFrame:Associations']; } else { // user skipped global logout \SimpleSAML\Logger::stats('slo-iframe skip'); - \SimpleSAML\Stats::log('core:idp:logout-iframe:page', array('type' => 'skip')); - $SPs = array(); // no SPs should have been logged out + \SimpleSAML\Stats::log('core:idp:logout-iframe:page', ['type' => 'skip']); + $SPs = []; // no SPs should have been logged out $state['core:Failed'] = true; // mark as partial logout } @@ -49,7 +49,7 @@ foreach ($SPs as $assocId => $sp) { $spId = $assocId; } \SimpleSAML\Logger::stats('slo-iframe-fail '.$spId); - \SimpleSAML\Stats::log('core:idp:logout-iframe:spfail', array('sp' => $spId)); + \SimpleSAML\Stats::log('core:idp:logout-iframe:spfail', ['sp' => $spId]); $state['core:Failed'] = true; } } diff --git a/modules/core/www/idp/logout-iframe-post.php b/modules/core/www/idp/logout-iframe-post.php index 603cb1fb5c33cf630572c7fc4cd14cd15878e360..2081dfe26d69fb87b55b54c814d3bd1d8fe7911d 100644 --- a/modules/core/www/idp/logout-iframe-post.php +++ b/modules/core/www/idp/logout-iframe-post.php @@ -44,12 +44,12 @@ if ($encryptNameId) { $lr->encryptNameId(\SimpleSAML\Module\saml\Message::getEncryptionKey($spMetadata)); } -\SimpleSAML\Stats::log('saml:idp:LogoutRequest:sent', array( +\SimpleSAML\Stats::log('saml:idp:LogoutRequest:sent', [ 'spEntityID' => $association['saml:entityID'], 'idpEntityID' => $idpMetadata->getString('entityid'), -)); +]); -$bindings = array(\SAML2\Constants::BINDING_HTTP_POST); +$bindings = [\SAML2\Constants::BINDING_HTTP_POST]; $dst = $spMetadata->getDefaultEndpoint('SingleLogoutService', $bindings); $binding = \SAML2\Binding::getBinding($dst['Binding']); diff --git a/modules/core/www/idp/logout-iframe.js b/modules/core/www/idp/logout-iframe.js index 6fc401070571c41ec845234551588333276da539..921c23cdfebd5acbd42369e5f571f509fcd0ab74 100644 --- a/modules/core/www/idp/logout-iframe.js +++ b/modules/core/www/idp/logout-iframe.js @@ -1,8 +1,8 @@ /** * This function updates the global logout status. */ -function updateStatus() { - +function updateStatus() +{ var nFailed = 0; var nProgress = 0; for (sp in window.spStatus) { @@ -33,7 +33,8 @@ function updateStatus() { * @param status The new status. * @param reason The reason for the status change. */ -function updateSPStatus(spId, status, reason) { +function updateSPStatus(spId, status, reason) +{ if (window.spStatus[spId] === status) { // unchanged return; @@ -63,7 +64,8 @@ function updateSPStatus(spId, status, reason) { * * @param spId The SP that completed logout successfully. */ -function logoutCompleted(spId) { +function logoutCompleted(spId) +{ updateSPStatus(spId, 'completed', ''); } @@ -75,7 +77,8 @@ function logoutCompleted(spId) { * @param spId The SP that failed to complete logout. * @param reason The reason why logout failed. */ -function logoutFailed(spId, reason) { +function logoutFailed(spId, reason) +{ updateSPStatus(spId, 'failed', reason); } @@ -84,7 +87,8 @@ function logoutFailed(spId, reason) { * * If an SP didn't reply by the timeout, we'll mark it as failed. */ -function timeoutSPs() { +function timeoutSPs() +{ var cTime = ((new Date()).getTime() - window.startTime) / 1000; for (var sp in window.spStatus) { if (window.spTimeout[sp] <= cTime && window.spStatus[sp] === 'inprogress') { diff --git a/modules/core/www/idp/logout-iframe.php b/modules/core/www/idp/logout-iframe.php index 4af3da1cdbd711fe79d12efeae787ae779903fb0..27195af6b83b40fc2d7e6be4baee1cf8bbfa64af 100644 --- a/modules/core/www/idp/logout-iframe.php +++ b/modules/core/www/idp/logout-iframe.php @@ -6,7 +6,7 @@ if (!isset($_REQUEST['id'])) { if (isset($_REQUEST['type'])) { $type = (string) $_REQUEST['type']; - if (!in_array($type, array('init', 'js', 'nojs', 'embed'), true)) { + if (!in_array($type, ['init', 'js', 'nojs', 'embed'], true)) { throw new \SimpleSAML\Error\BadRequest('Invalid value for type.'); } } else { @@ -15,7 +15,7 @@ if (isset($_REQUEST['type'])) { if ($type !== 'embed') { \SimpleSAML\Logger::stats('slo-iframe '.$type); - \SimpleSAML\Stats::log('core:idp:logout-iframe:page', array('type' => $type)); + \SimpleSAML\Stats::log('core:idp:logout-iframe:page', ['type' => $type]); } $state = \SimpleSAML\Auth\State::loadState($_REQUEST['id'], 'core:Logout-IFrame'); @@ -55,7 +55,7 @@ if ($type !== 'init') { if (!isset($sp['core:Logout-IFrame:Timeout'])) { if (method_exists($sp['Handler'], 'getAssociationConfig')) { $assocIdP = \SimpleSAML\IdP::getByState($sp); - $assocConfig = call_user_func(array($sp['Handler'], 'getAssociationConfig'), $assocIdP, $sp); + $assocConfig = call_user_func([$sp['Handler'], 'getAssociationConfig'], $assocIdP, $sp); $sp['core:Logout-IFrame:Timeout'] = $assocConfig->getInteger('core:logout-timeout', 5) + time(); } else { $sp['core:Logout-IFrame:Timeout'] = time() + 5; @@ -73,7 +73,7 @@ foreach ($state['core:Logout-IFrame:Associations'] as $assocId => &$sp) { try { $assocIdP = \SimpleSAML\IdP::getByState($sp); - $url = call_user_func(array($sp['Handler'], 'getLogoutURL'), $assocIdP, $sp, null); + $url = call_user_func([$sp['Handler'], 'getLogoutURL'], $assocIdP, $sp, null); $sp['core:Logout-IFrame:URL'] = $url; } catch (\Exception $e) { $sp['core:Logout-IFrame:State'] = 'failed'; @@ -91,7 +91,7 @@ if ($state['core:TerminatedAssocId'] !== null) { } // build an array with information about all services currently logged in -$remaining = array(); +$remaining = []; foreach ($state['core:Logout-IFrame:Associations'] as $association) { $key = sha1($association['id']); $mdset = 'saml20-sp-remote'; @@ -99,7 +99,7 @@ foreach ($state['core:Logout-IFrame:Associations'] as $association) { $mdset = 'adfs-sp-remote'; } - $remaining[$key] = array( + $remaining[$key] = [ 'id' => $association['id'], 'expires_on' => $association['Expires'], 'entityID' => $association['saml:entityID'], @@ -107,28 +107,27 @@ foreach ($state['core:Logout-IFrame:Associations'] as $association) { 'status' => $association['core:Logout-IFrame:State'], 'logoutURL' => $association['core:Logout-IFrame:URL'], 'metadata' => $mdh->getMetaDataConfig($association['saml:entityID'], $mdset)->toArray(), - ); + ]; if (isset($association['core:Logout-IFrame:Timeout'])) { $remaining[$key]['timeout'] = $association['core:Logout-IFrame:Timeout']; } } -$id = \SimpleSAML\Auth\State::saveState($state, 'core:Logout-IFrame'); $globalConfig = \SimpleSAML\Configuration::getInstance(); - -$template_id = 'core:logout-iframe.php'; if ($type === 'nojs') { - $template_id = 'core:logout-iframe-wrapper.php'; + $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:logout-iframe-wrapper.php'); +} else { + $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:logout-iframe.php'); } -$t = new \SimpleSAML\XHTML\Template($globalConfig, $template_id); -$t->data['auth_state'] = $id; -$t->data['header'] = $t->getTranslator()->t('{logout:progress}'); - /** * @deprecated The "id" variable will be removed. Please use "auth_state" instead. */ +$id = \SimpleSAML\Auth\State::saveState($state, 'core:Logout-IFrame'); $t->data['id'] = $id; +$t->data['auth_state'] = $id; + +$t->data['header'] = $t->getTranslator()->t('{logout:progress}'); $t->data['type'] = $type; $t->data['terminated_service'] = $terminated; $t->data['remaining_services'] = $remaining; @@ -141,7 +140,7 @@ $t->data['SPs'] = $state['core:Logout-IFrame:Associations']; if ($type !== 'nojs') { /** @deprecated The "jquery" array will be removed in 2.0 */ - $t->data['jquery'] = array('core' => true, 'ui' => false, 'css' => false); + $t->data['jquery'] = ['core' => true, 'ui' => false, 'css' => false]; } $t->show(); diff --git a/modules/core/www/login-admin.php b/modules/core/www/login-admin.php index 01ea86c93d41978b6503bafb5e8651602f9ebbe1..59246f6731c6db0c7cbc2bff6dba5f1e5a4e065e 100644 --- a/modules/core/www/login-admin.php +++ b/modules/core/www/login-admin.php @@ -10,4 +10,3 @@ if (!array_key_exists('ReturnTo', $_REQUEST)) { \SimpleSAML\Utils\Auth::requireAdmin(); \SimpleSAML\Utils\HTTP::redirectUntrustedURL($_REQUEST['ReturnTo']); - diff --git a/modules/core/www/login.php b/modules/core/www/login.php index 342787873046d143778606ee7272e6950cf29507..53d57ca44976bbc805c2df889255182449eabe98 100644 --- a/modules/core/www/login.php +++ b/modules/core/www/login.php @@ -40,11 +40,11 @@ if (array_key_exists(\SimpleSAML\Auth\State::EXCEPTION_PARAM, $_REQUEST)) { } if (!$as->isAuthenticated()) { - $url = \SimpleSAML\Module::getModuleURL('core/login.php', array('as' => $asId)); - $params = array( + $url = \SimpleSAML\Module::getModuleURL('core/login.php', ['as' => $asId]); + $params = [ 'ErrorURL' => $url, 'ReturnTo' => $url, - ); + ]; $as->login($params); } diff --git a/modules/core/www/loginuserpass.php b/modules/core/www/loginuserpass.php index f5211bb7fb808255bd6d66dd698af46efe65a62f..747506f898d1e969212cd17a2c5acca85e6ffcd9 100644 --- a/modules/core/www/loginuserpass.php +++ b/modules/core/www/loginuserpass.php @@ -18,7 +18,9 @@ $state = \SimpleSAML\Auth\State::loadState($authStateId, \SimpleSAML\Module\core $source = \SimpleSAML\Auth\Source::getById($state[\SimpleSAML\Module\core\Auth\UserPassBase::AUTHID]); if ($source === null) { - throw new \Exception('Could not find authentication source with id '.$state[\SimpleSAML\Module\core\Auth\UserPassBase::AUTHID]); + throw new \Exception( + 'Could not find authentication source with id '.$state[\SimpleSAML\Module\core\Auth\UserPassBase::AUTHID] + ); } @@ -40,12 +42,12 @@ if (array_key_exists('password', $_REQUEST)) { $errorCode = null; $errorParams = null; -$queryParams = array(); +$queryParams = []; if (isset($state['error'])) { $errorCode = $state['error']['code']; $errorParams = $state['error']['params']; - $queryParams = array('AuthState' => $authStateId); + $queryParams = ['AuthState' => $authStateId]; } if (!empty($_REQUEST['username']) || !empty($password)) { @@ -58,15 +60,22 @@ if (!empty($_REQUEST['username']) || !empty($password)) { if ($source->getRememberUsernameEnabled()) { $sessionHandler = \SimpleSAML\SessionHandler::getSessionHandler(); $params = $sessionHandler->getCookieParams(); - $params['expire'] = time(); - $params['expire'] += (isset($_REQUEST['remember_username']) && $_REQUEST['remember_username'] == 'Yes' ? 31536000 : -300); + + if (isset($_REQUEST['remember_username']) && $_REQUEST['remember_username'] == 'Yes') { + $params['expire'] = time() + 31536000; + } else { + $params['expire'] = time() - 300; + } \SimpleSAML\Utils\HTTP::setCookie($source->getAuthId().'-username', $username, $params, false); } if ($source->isRememberMeEnabled()) { if (array_key_exists('remember_me', $_REQUEST) && $_REQUEST['remember_me'] === 'Yes') { $state['RememberMe'] = true; - $authStateId = \SimpleSAML\Auth\State::saveState($state, \SimpleSAML\Module\core\Auth\UserPassBase::STAGEID); + $authStateId = \SimpleSAML\Auth\State::saveState( + $state, + \SimpleSAML\Module\core\Auth\UserPassBase::STAGEID + ); } } @@ -76,12 +85,12 @@ if (!empty($_REQUEST['username']) || !empty($password)) { // Login failed. Extract error code and parameters, to display the error $errorCode = $e->getErrorCode(); $errorParams = $e->getParameters(); - $state['error'] = array( + $state['error'] = [ 'code' => $errorCode, 'params' => $errorParams - ); + ]; $authStateId = \SimpleSAML\Auth\State::saveState($state, \SimpleSAML\Module\core\Auth\UserPassBase::STAGEID); - $queryParams = array('AuthState' => $authStateId); + $queryParams = ['AuthState' => $authStateId]; } if (isset($state['error'])) { unset($state['error']); @@ -90,7 +99,7 @@ if (!empty($_REQUEST['username']) || !empty($password)) { $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:loginuserpass.php'); -$t->data['stateparams'] = array('AuthState' => $authStateId); +$t->data['stateparams'] = ['AuthState' => $authStateId]; if (array_key_exists('forcedUsername', $state)) { $t->data['username'] = $state['forcedUsername']; $t->data['forceUsername'] = true; diff --git a/modules/core/www/loginuserpassorg.php b/modules/core/www/loginuserpassorg.php index 4b293e2dc09fd40a82e6de39edcc113bc8109893..2b9ec4dba32a09252629180f31d82f4ce349c30d 100644 --- a/modules/core/www/loginuserpassorg.php +++ b/modules/core/www/loginuserpassorg.php @@ -18,7 +18,9 @@ $state = \SimpleSAML\Auth\State::loadState($authStateId, \SimpleSAML\Module\core $source = \SimpleSAML\Auth\Source::getById($state[\SimpleSAML\Module\core\Auth\UserPassOrgBase::AUTHID]); if ($source === null) { - throw new \Exception('Could not find authentication source with id '.$state[\SimpleSAML\Module\core\Auth\UserPassOrgBase::AUTHID]); + throw new \Exception( + 'Could not find authentication source with id '.$state[\SimpleSAML\Module\core\Auth\UserPassOrgBase::AUTHID] + ); } $organizations = \SimpleSAML\Module\core\Auth\UserPassOrgBase::listOrganizations($authStateId); @@ -41,7 +43,9 @@ if (array_key_exists('password', $_REQUEST)) { if (array_key_exists('organization', $_REQUEST)) { $organization = $_REQUEST['organization']; -} elseif ($source->getRememberOrganizationEnabled() && array_key_exists($source->getAuthId().'-organization', $_COOKIE)) { +} elseif ($source->getRememberOrganizationEnabled() && + array_key_exists($source->getAuthId().'-organization', $_COOKIE) + ) { $organization = $_COOKIE[$source->getAuthId().'-organization']; } elseif (isset($state['core:organization'])) { $organization = (string) $state['core:organization']; @@ -51,45 +55,67 @@ if (array_key_exists('organization', $_REQUEST)) { $errorCode = null; $errorParams = null; -$queryParams = array(); +$queryParams = []; if (isset($state['error'])) { $errorCode = $state['error']['code']; $errorParams = $state['error']['params']; - $queryParams = array('AuthState' => $authStateId); + $queryParams = ['AuthState' => $authStateId]; } if ($organizations === null || !empty($organization)) { if (!empty($username) || !empty($password)) { - if ($source->getRememberUsernameEnabled()) { $sessionHandler = \SimpleSAML\SessionHandler::getSessionHandler(); $params = $sessionHandler->getCookieParams(); - $params['expire'] = time(); - $params['expire'] += (isset($_REQUEST['remember_username']) && $_REQUEST['remember_username'] == 'Yes' ? 31536000 : -300); + if (isset($_REQUEST['remember_username']) && $_REQUEST['remember_username'] == 'Yes') { + $params['expire'] = time() + 3153600; + } else { + $params['expire'] = time() - 300; + } + \SimpleSAML\Utils\HTTP::setCookie($source->getAuthId().'-username', $username, $params, false); } if ($source->getRememberOrganizationEnabled()) { $sessionHandler = \SimpleSAML\SessionHandler::getSessionHandler(); $params = $sessionHandler->getCookieParams(); - $params['expire'] = time(); - $params['expire'] += (isset($_REQUEST['remember_organization']) && $_REQUEST['remember_organization'] == 'Yes' ? 31536000 : -300); - setcookie($source->getAuthId().'-organization', $organization, $params['expire'], $params['path'], $params['domain'], $params['secure'], $params['httponly']); + if (isset($_REQUEST['remember_organization']) && $_REQUEST['remember_organization'] == 'Yes') { + $params['expire'] = time() + 3153600; + } else { + $params['expire'] = time() - 300; + } + setcookie( + $source->getAuthId().'-organization', + $organization, + $params['expire'], + $params['path'], + $params['domain'], + $params['secure'], + $params['httponly'] + ); } try { - \SimpleSAML\Module\core\Auth\UserPassOrgBase::handleLogin($authStateId, $username, $password, $organization); + \SimpleSAML\Module\core\Auth\UserPassOrgBase::handleLogin( + $authStateId, + $username, + $password, + $organization + ); } catch (\SimpleSAML\Error\Error $e) { // Login failed. Extract error code and parameters, to display the error $errorCode = $e->getErrorCode(); $errorParams = $e->getParameters(); - $state['error'] = array( + $state['error'] = [ 'code' => $errorCode, 'params' => $errorParams + ]; + $authStateId = \SimpleSAML\Auth\State::saveState( + $state, + \SimpleSAML\Module\core\Auth\UserPassOrgBase::STAGEID ); - $authStateId = \SimpleSAML\Auth\State::saveState($state, \SimpleSAML\Module\core\Auth\UserPassOrgBase::STAGEID); - $queryParams = array('AuthState' => $authStateId); + $queryParams = ['AuthState' => $authStateId]; } if (isset($state['error'])) { unset($state['error']); @@ -99,7 +125,7 @@ if ($organizations === null || !empty($organization)) { $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:loginuserpass.php'); -$t->data['stateparams'] = array('AuthState' => $authStateId); +$t->data['stateparams'] = ['AuthState' => $authStateId]; $t->data['username'] = $username; $t->data['forceUsername'] = false; $t->data['rememberUsernameEnabled'] = $source->getRememberUsernameEnabled(); @@ -135,4 +161,3 @@ if (isset($state['SPMetadata'])) { $t->show(); exit(); - diff --git a/modules/core/www/short_sso_interval.php b/modules/core/www/short_sso_interval.php index 9844e9c5f3c8b4e0aa29beaf73b4ca4deb515c0d..5a937c66c15c4f48a85d0d107dceeb81edabdbfa 100644 --- a/modules/core/www/short_sso_interval.php +++ b/modules/core/www/short_sso_interval.php @@ -22,7 +22,7 @@ if (array_key_exists('continue', $_REQUEST)) { $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'core:short_sso_interval.php'); $t->data['target'] = \SimpleSAML\Module::getModuleURL('core/short_sso_interval.php'); -$t->data['params'] = array('StateId' => $id); +$t->data['params'] = ['StateId' => $id]; $t->data['trackId'] = $session->getTrackID(); $this->data['header'] = $this->t('{core:short_sso_interval:warning_header}'); $this->data['autofocus'] = 'contbutton'; diff --git a/modules/core/www/show_metadata.php b/modules/core/www/show_metadata.php index 389d12a3309d5818a154b8ced1a79b6ca357f5e2..e8f3bf223e91b45cad24bda780d99983a0e9ef75 100644 --- a/modules/core/www/show_metadata.php +++ b/modules/core/www/show_metadata.php @@ -14,7 +14,7 @@ if (!array_key_exists('set', $_REQUEST)) { } if (!in_array( $_REQUEST['set'], - array('saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote'), + ['saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote'], true )) { throw new Exception('Invalid set'); @@ -22,7 +22,7 @@ if (!in_array( $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); -$m = $metadata->getMetadata($_REQUEST['entityid'], $_REQUEST['set']); +$m = $metadata->getMetaData($_REQUEST['entityid'], $_REQUEST['set']); $t = new \SimpleSAML\XHTML\Template($config, 'core:show_metadata.tpl.php'); $t->data['clipboard.js'] = true; diff --git a/modules/cron/config-templates/module_cron.php b/modules/cron/config-templates/module_cron.php index abee18711383baa95d93f6c712f857b0d1ee8783..29a35d9e9c535cb80e19c1fea2aea89e6ec7ae9f 100644 --- a/modules/cron/config-templates/module_cron.php +++ b/modules/cron/config-templates/module_cron.php @@ -1,11 +1,11 @@ <?php -/* +/* * Configuration for the Cron module. */ -$config = array( +$config = [ 'key' => 'secret', - 'allowed_tags' => array('daily', 'hourly', 'frequent'), + 'allowed_tags' => ['daily', 'hourly', 'frequent'], 'debug_message' => true, 'sendemail' => true, -); +]; diff --git a/modules/cron/hooks/hook_frontpage.php b/modules/cron/hooks/hook_frontpage.php index 46a7ab954d1c1bac4e9a4100923848b67ee38836..c9e2eb2dcb25e88141556375de42d44841a32a35 100644 --- a/modules/cron/hooks/hook_frontpage.php +++ b/modules/cron/hooks/hook_frontpage.php @@ -10,8 +10,8 @@ function cron_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['config'][] = array( + $links['config'][] = [ 'href' => SimpleSAML\Module::getModuleURL('cron/croninfo.php'), 'text' => '{core:frontpage:link_cron}', - ); + ]; } diff --git a/modules/cron/lib/Cron.php b/modules/cron/lib/Cron.php index 169d248beee8718a5bbbde2a1f945106af2ba0dd..f8bda653b8b23b4dc6061668160c453e8044ba13 100644 --- a/modules/cron/lib/Cron.php +++ b/modules/cron/lib/Cron.php @@ -38,11 +38,11 @@ class Cron throw new \Exception("Invalid cron tag '$tag''"); } - $summary = array(); - $croninfo = array( + $summary = []; + $croninfo = [ 'summary' => &$summary, 'tag' => $tag, - ); + ]; \SimpleSAML\Module::callHooks('cron', $croninfo); diff --git a/modules/cron/templates/croninfo-result.php b/modules/cron/templates/croninfo-result.php index fecd11cdb19d6f183fd3236bee5e43cb73a8323a..e4f0dc1695a06d856d5eba5a01732e0810641ca2 100644 --- a/modules/cron/templates/croninfo-result.php +++ b/modules/cron/templates/croninfo-result.php @@ -8,12 +8,11 @@ $this->includeAtTemplateBase('includes/header.php'); <?php echo ' <h1>'.$this->t('cron_report_title').'</h1><p>'.$this->t('ran_text'). - ' '.$this->data['time'].'</p>'.'<p>URL: <tt>'.$this->data['url'].'</tt></p>'. + ' '.$this->data['time'].'</p>'.'<p>URL: <code>'.$this->data['url'].'</code></p>'. '<p>Tag: '.$this->data['tag']."</p>\n\n". '<ul><li>'.join('</li><li>', $this->data['summary']).'</li></ul>'; ?> - </code> - </pre> + </code></pre> </div> <?php diff --git a/modules/cron/templates/croninfo.tpl.php b/modules/cron/templates/croninfo.tpl.php index f6181f6cf3a4eb6dcaeec18e2ae4e928b4a3f16f..50efe15a1ec53e6ef527448cc4b3e72cb5aa13b8 100644 --- a/modules/cron/templates/croninfo.tpl.php +++ b/modules/cron/templates/croninfo.tpl.php @@ -11,7 +11,7 @@ $run_text = $this->t('run_text'); <p><?php echo $this->t('cron_suggestion') ?></p> <pre style="font-size: x-small; color: #444; padding: 1em; border: 1px solid #eee; margin: .4em "><code> <?php -foreach ($this->data['urls'] as $url ) { +foreach ($this->data['urls'] as $url) { echo "# ".$run_text. ' ['.$url['tag'].']'."\n"; echo $url['int']." curl --silent \"".$url['href']."\" > /dev/null 2>&1\n"; } @@ -22,7 +22,7 @@ foreach ($this->data['urls'] as $url ) { <p><?php echo $this->t('cron_execution') ?></p> <ul> <?php -foreach ($this->data['urls'] as $url ) { +foreach ($this->data['urls'] as $url) { echo ' <li><a href="'.$url['href'].'&output=xhtml">'.$run_text.' ['.$url['tag'].']'.'</a></li>'; } ?> diff --git a/modules/cron/templates/croninfo.twig b/modules/cron/templates/croninfo.twig index a4deaaa7716c8e0412f5a2c9142eddd18f344129..b00b8905b8ab2107cb0c9d1980dc0a7fea539ea4 100644 --- a/modules/cron/templates/croninfo.twig +++ b/modules/cron/templates/croninfo.twig @@ -1,16 +1,20 @@ {% set pagetitle = 'Cron result page'|trans %} {% extends "base.twig" %} +{% block preload %} +<link rel="stylesheet" type="text/css" href="{{ baseurlpath }}assets/css/cron.css"> +{% endblock %} + {% block content %} <h2>{{ 'Cron result page'|trans }}</h2> <p>{{ 'Cron is a way to run things regularly on unix systems.'|trans }}<br /><br /></p> <p>{{ 'Here is a suggestion for a crontab file:'|trans }}<br /><br /></p> <div class="code-box code-box-content"> - <code> + <code id="cronlist"> {% for url in urls %} - # {{ 'Run cron:'|trans }} [{{ url.tag }}]<br /> - {{ url.int }} curl --silent "{{ url.href }}" > /dev/null 2>&1<br /> + # {{ 'Run cron:'|trans }} [{{ url.tag }}]<br /> + {{ url.int }} curl --silent "{{ url.href }}" > /dev/null 2>&1<br /> {% endfor %} </code></div><br /> diff --git a/modules/cron/www/assets/css/cron.css b/modules/cron/www/assets/css/cron.css new file mode 100644 index 0000000000000000000000000000000000000000..459178ed6c2c31566f70bc580c763c100a3e3462 --- /dev/null +++ b/modules/cron/www/assets/css/cron.css @@ -0,0 +1,3 @@ +code#cronlist { + font-size: 0.8vw; +} diff --git a/modules/cron/www/cron.php b/modules/cron/www/cron.php index 4a2ec9ab9ad38faa42d01f986366b35ee1287960..fb930592812ce20bf6370618cdb708677d63cb81 100644 --- a/modules/cron/www/cron.php +++ b/modules/cron/www/cron.php @@ -24,7 +24,7 @@ $summary = $croninfo['summary']; if ($cronconfig->getValue('sendemail', true) && count($summary) > 0) { $message = '<h1>Cron report</h1><p>Cron ran at '.$time.'</p>'. - '<p>URL: <tt>'.$url.'</tt></p>'. + '<p>URL: <code>'.$url.'</code></p>'. '<p>Tag: '.$croninfo['tag']."</p>\n\n". '<ul><li>'.join('</li><li>', $summary).'</li></ul>'; diff --git a/modules/cron/www/croninfo.php b/modules/cron/www/croninfo.php index 8479de13f62472946fea76e52243c93ca012406c..8a0aac4d52a90de827a0344822163813ce15cfc4 100644 --- a/modules/cron/www/croninfo.php +++ b/modules/cron/www/croninfo.php @@ -18,20 +18,20 @@ $cronconfig = \SimpleSAML\Configuration::getConfig('module_cron.php'); $key = $cronconfig->getValue('key', ''); $tags = $cronconfig->getValue('allowed_tags'); -$def = array( +$def = [ 'weekly' => "22 0 * * 0", 'daily' => "02 0 * * *", 'hourly' => "01 * * * *", 'default' => "XXXXXXXXXX", -); +]; -$urls = array(); +$urls = []; foreach ($tags as $tag) { - $urls[] = array( - 'href' => \SimpleSAML\Module::getModuleURL('cron/cron.php', array('key' => $key, 'tag' => $tag)), + $urls[] = [ + 'href' => \SimpleSAML\Module::getModuleURL('cron/cron.php', ['key' => $key, 'tag' => $tag]), 'tag' => $tag, 'int' => (array_key_exists($tag, $def) ? $def[$tag] : $def['default']), - ); + ]; } $t = new \SimpleSAML\XHTML\Template($config, 'cron:croninfo.tpl.php', 'cron:cron'); diff --git a/modules/discopower/config-templates/module_discopower.php b/modules/discopower/config-templates/module_discopower.php index 4579f9d101fa2c2ceace1cd34582f7c98015c917..498cadad83962445faa726abed4e8da675561189 100644 --- a/modules/discopower/config-templates/module_discopower.php +++ b/modules/discopower/config-templates/module_discopower.php @@ -1,9 +1,9 @@ <?php -/* +/* * Configuration for the DiscoPower module. */ -$config = array( +$config = [ // Which tab should be set as default. 0 is the first tab 'defaulttab' => 0, @@ -11,7 +11,7 @@ $config = array( * List a set of tags (Tabs) that should be listed in a specific order. * All other available tabs will be listed after the ones specified below. */ - 'taborder' => array('norway'), + 'taborder' => ['norway'], /* * the 'tab' parameter allows you to limit the tabs to a specific list. (excluding unlisted tags) @@ -21,9 +21,9 @@ $config = array( /* * If you want to change the scoring algorithm to a more google suggest like one - * (filters by start of words) uncomment this ... + * (filters by start of words) uncomment this ... * - * 'score' => 'suggest', + * 'score' => 'suggest', */ /* @@ -42,4 +42,4 @@ $config = array( * Example: 'cdc.lifetime' => 180*24*60*60, // 180 days */ 'cdc.lifetime' => null, -); +]; diff --git a/modules/discopower/dictionaries/tabs.translation.json b/modules/discopower/dictionaries/tabs.translation.json index 558d2d572f6b39496373e63d7a2c82965bc581b1..709544a2733baad7e09239c6be3c16c868979c3b 100644 --- a/modules/discopower/dictionaries/tabs.translation.json +++ b/modules/discopower/dictionaries/tabs.translation.json @@ -70,7 +70,6 @@ }, "greece": { "es": "Grecia", - "ru": "\u0413\u0440\u0435\u0446\u0438\u044f", "nl": "Griekenland", "gl": "Grecia", "ru": "\u0413\u0440\u0435\u0446\u0438\u044f", diff --git a/modules/discopower/lib/PowerIdPDisco.php b/modules/discopower/lib/PowerIdPDisco.php index 52ded4331b991bff8d2f2260ede635f53f79c730..a0955cb32d320448ab03a89f55a7dd0252d8dfee 100644 --- a/modules/discopower/lib/PowerIdPDisco.php +++ b/modules/discopower/lib/PowerIdPDisco.php @@ -110,19 +110,19 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco */ protected function idplistStructured($list) { - $slist = array(); + $slist = []; $order = $this->discoconfig->getValue('taborder'); if (is_array($order)) { foreach ($order as $oe) { - $slist[$oe] = array(); + $slist[$oe] = []; } } $enableTabs = $this->discoconfig->getValue('tabs', null); foreach ($list as $key => $val) { - $tags = array('misc'); + $tags = ['misc']; if (array_key_exists('tags', $val)) { $tags = $val['tags']; } @@ -135,7 +135,7 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco } foreach ($slist as $tab => $tbslist) { - uasort($slist[$tab], array('\SimpleSAML\Module\discopower\PowerIdPDisco', 'mcmp')); + uasort($slist[$tab], ['\SimpleSAML\Module\discopower\PowerIdPDisco', 'mcmp']); } return $slist; @@ -203,27 +203,26 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco $filter = $spmd['discopower.filter']; if (!array_key_exists('entities.include', $filter)) { - $filter['entities.include'] = array(); + $filter['entities.include'] = []; } if (!array_key_exists('entities.exclude', $filter)) { - $filter['entities.exclude'] = array(); + $filter['entities.exclude'] = []; } if (!array_key_exists('tags.include', $filter)) { - $filter['tags.include'] = array(); + $filter['tags.include'] = []; } if (!array_key_exists('tags.exclude', $filter)) { - $filter['tags.exclude'] = array(); + $filter['tags.exclude'] = []; } $defaultrule = true; if (array_key_exists('entities.include', $spmd['discopower.filter']) || array_key_exists('tags.include', $spmd['discopower.filter']) ) { - $defaultrule = false; } - $returnlist = array(); + $returnlist = []; foreach ($list as $key => $entry) { if ($this->processFilter($filter, $entry, $defaultrule)) { $returnlist[$key] = $entry; @@ -248,7 +247,7 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco $preferredIdP = $this->getRecommendedIdP(); $t = new \SimpleSAML\XHTML\Template($this->config, 'discopower:disco.tpl.php', 'disco'); - $discoPowerTabs = array( + $discoPowerTabs = [ 'denmark' => \SimpleSAML\Locale\Translate::noop('{discopower:tabs:denmark}'), 'edugain' => \SimpleSAML\Locale\Translate::noop('{discopower:tabs:edugain}'), 'finland' => \SimpleSAML\Locale\Translate::noop('{discopower:tabs:finland}'), @@ -262,7 +261,7 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco 'sweden' => \SimpleSAML\Locale\Translate::noop('{discopower:tabs:sweden}'), 'switzerland' => \SimpleSAML\Locale\Translate::noop('{discopower:tabs:switzerland}'), 'ukacessfederation' => \SimpleSAML\Locale\Translate::noop('{discopower:tabs:ukacessfederation}'), - ); + ]; $t->data['return'] = $this->returnURL; $t->data['returnIDParam'] = $this->returnIdParam; @@ -300,7 +299,7 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco $t->data['urlpattern'] = htmlspecialchars(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery()); $t->data['rememberenabled'] = $this->config->getBoolean('idpdisco.enableremember', false); $t->data['rememberchecked'] = $this->config->getBoolean('idpdisco.rememberchecked', false); - $t->data['jquery'] = array('core' => true, 'ui' => true); + $t->data['jquery'] = ['core' => true, 'ui' => true]; $t->show(); } @@ -326,7 +325,7 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco $translation = $t->getTranslator()->getPreferredTranslation($displayName); } } - + if (($translation === false) && array_key_exists('name', $entity)) { if (is_array($entity['name'])) { $translation = $t->getTranslator()->getPreferredTranslation($entity['name']); @@ -342,14 +341,17 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco // HTML output if ($entity['entityid'] === $favourite) { - $html = '<a class="metaentry favourite" href="'.$basequerystring.urlencode($entity['entityid']).'">'; + $html = '<a class="metaentry favourite" href="'. + $basequerystring.urlencode($entity['entityid']).'">'; } else { - $html = '<a class="metaentry" href="'.$basequerystring.urlencode($entity['entityid']).'">'; + $html = '<a class="metaentry" href="'. + $basequerystring.urlencode($entity['entityid']).'">'; } $html .= $entity['translated']; if (array_key_exists('icon', $entity) && $entity['icon'] !== null) { $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($entity['icon']); - $html .= '<img alt="Icon for identity provider" class="entryicon" src="'.htmlspecialchars($iconUrl).'" />'; + $html .= '<img alt="Icon for identity provider" class="entryicon" src="'. + htmlspecialchars($iconUrl).'" />'; } $html .= '</a>'; $entity['html'] = $html; @@ -369,7 +371,7 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco private function getCDC() { if (!isset($_COOKIE['_saml_idp'])) { - return array(); + return []; } $ret = (string) $_COOKIE['_saml_idp']; @@ -378,7 +380,7 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco $idp = base64_decode($idp); if ($idp === false) { // not properly base64 encoded - return array(); + return []; } } @@ -425,12 +427,12 @@ class PowerIdPDisco extends \SimpleSAML\XHTML\IdPDisco $newCookie = $tmp[1]; } - $params = array( + $params = [ 'lifetime' => $this->cdcLifetime, 'domain' => $this->cdcDomain, 'secure' => true, 'httponly' => false, - ); + ]; \SimpleSAML\Utils\HTTP::setCookie('_saml_idp', $newCookie, $params, false); } diff --git a/modules/discopower/templates/disco.tpl.php b/modules/discopower/templates/disco.tpl.php index 1ae62cabdf4ea088f853057a4ed52ce161cda85d..4174ace4ca80724f08a5d54bcf02688c1dd19aae 100644 --- a/modules/discopower/templates/disco.tpl.php +++ b/modules/discopower/templates/disco.tpl.php @@ -1,172 +1,141 @@ <?php $this->data['header'] = $this->t('selectidp'); -$this->data['jquery'] = array('core' => TRUE, 'ui' => TRUE, 'css' => TRUE); +$this->data['jquery'] = ['core' => true, 'ui' => true, 'css' => true]; -$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . SimpleSAML\Module::getModuleUrl('discopower/style.css') . '" />'; +$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="'. + SimpleSAML\Module::getModuleURL('discopower/assets/css/style.css').'" />'; -$this->data['post'] = '<script type="text/javascript" src="' . SimpleSAML\Module::getModuleUrl('discopower/js/jquery.livesearch.js') . '"></script>'; -$this->data['post'] .= '<script type="text/javascript" src="' . SimpleSAML\Module::getModuleUrl('discopower/js/quicksilver.js') . '"></script>'; +$this->data['post'] = '<script type="text/javascript" src="'. + SimpleSAML\Module::getModuleURL('discopower/assets/js/jquery.livesearch.js').'"></script>'; +$this->data['post'] .= '<script type="text/javascript" src="'. + SimpleSAML\Module::getModuleURL('discopower/assets/js/quicksilver.js').'"></script>'; - - - -if (!empty($this->data['faventry'])) $this->data['autofocus'] = 'favouritesubmit'; - -$this->includeAtTemplateBase('includes/header.php'); - -function showEntry($t, $metadata, $favourite = FALSE) { - - $basequerystring = '?' . - 'entityID=' . urlencode($t->data['entityID']) . '&' . - 'return=' . urlencode($t->data['return']) . '&' . - 'returnIDParam=' . urlencode($t->data['returnIDParam']) . '&idpentityid='; - - $extra = ($favourite ? ' favourite' : ''); - $html = '<a class="metaentry' . $extra . '" href="' . $basequerystring . urlencode($metadata['entityid']) . '">'; - - $html .= '' . htmlspecialchars(getTranslatedName($t, $metadata)) . ''; - - if(array_key_exists('icon', $metadata) && $metadata['icon'] !== NULL) { - $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($metadata['icon']); - $html .= '<img alt="Icon for identity provider" class="entryicon" src="' . htmlspecialchars($iconUrl) . '" />'; - } - - $html .= '</a>'; - - return $html; +if (!empty($this->data['faventry'])) { + $this->data['autofocus'] = 'favouritesubmit'; } -?> +$this->includeAtTemplateBase('includes/header.php'); +function showEntry($t, $metadata, $favourite = false) +{ + $basequerystring = '?'. + 'entityID='.urlencode($t->data['entityID']).'&'. + 'return='.urlencode($t->data['return']).'&'. + 'returnIDParam='.urlencode($t->data['returnIDParam']).'&idpentityid='; + $extra = ($favourite ? ' favourite' : ''); + $html = '<a class="metaentry'.$extra.'" href="'.$basequerystring.urlencode($metadata['entityid']).'">'; + $html .= htmlspecialchars(getTranslatedName($t, $metadata)).''; -<?php + if (array_key_exists('icon', $metadata) && $metadata['icon'] !== null) { + $iconUrl = \SimpleSAML\Utils\HTTP::resolveURL($metadata['icon']); + $html .= '<img alt="Icon for identity provider" class="entryicon" src="'.htmlspecialchars($iconUrl).'" />'; + } -function getTranslatedName($t, $metadata) { - if (isset($metadata['UIInfo']['DisplayName'])) { - $displayName = $metadata['UIInfo']['DisplayName']; - assert(is_array($displayName)); // Should always be an array of language code -> translation - if (!empty($displayName)) { - return $t->getTranslator()->getPreferredTranslation($displayName); - } - } - - if (array_key_exists('name', $metadata)) { - if (is_array($metadata['name'])) { - return $t->getTranslator()->getPreferredTranslation($metadata['name']); - } else { - return $metadata['name']; - } - } - return $metadata['entityid']; + $html .= '</a>'; + return $html; } - - +function getTranslatedName($t, $metadata) +{ + if (isset($metadata['UIInfo']['DisplayName'])) { + $displayName = $metadata['UIInfo']['DisplayName']; + assert(is_array($displayName)); // Should always be an array of language code -> translation + if (!empty($displayName)) { + return $t->getTranslator()->getPreferredTranslation($displayName); + } + } + + if (array_key_exists('name', $metadata)) { + if (is_array($metadata['name'])) { + return $t->getTranslator()->getPreferredTranslation($metadata['name']); + } else { + return $metadata['name']; + } + } + return $metadata['entityid']; +} if (!empty($this->data['faventry'])) { - - - echo('<div class="favourite">'); - echo($this->t('previous_auth')); - echo(' <strong>' . htmlspecialchars(getTranslatedName($this, $this->data['faventry'])) . '</strong>'); - echo(' - <form id="idpselectform" method="get" action="' . $this->data['urlpattern'] . '"> - <input type="hidden" name="entityID" value="' . htmlspecialchars($this->data['entityID']) . '" /> - <input type="hidden" name="return" value="' . htmlspecialchars($this->data['return']) . '" /> - <input type="hidden" name="returnIDParam" value="' . htmlspecialchars($this->data['returnIDParam']) . '" /> - <input type="hidden" name="idpentityid" value="' . htmlspecialchars($this->data['faventry']['entityid']) . '" /> - - <input type="submit" name="formsubmit" id="favouritesubmit" value="' . $this->t('login_at') . ' ' . htmlspecialchars(getTranslatedName($this, $this->data['faventry'])) . '" /> - </form>'); - - echo('</div>'); + echo '<div class="favourite">' ; + echo $this->t('previous_auth'); + echo ' <strong>'.htmlspecialchars(getTranslatedName($this, $this->data['faventry'])).'</strong>'; + echo '<form id="idpselectform" method="get" action="'.$this->data['urlpattern']. + '"><input type="hidden" name="entityID" value="'.htmlspecialchars($this->data['entityID']). + '" /><input type="hidden" name="return" value="'.htmlspecialchars($this->data['return']). + '" /><input type="hidden" name="returnIDParam" value="'.htmlspecialchars($this->data['returnIDParam']). + '" /><input type="hidden" name="idpentityid" value="'.htmlspecialchars($this->data['faventry']['entityid']). + '" /><input type="submit" name="formsubmit" id="favouritesubmit" value="'.$this->t('login_at').' '. + htmlspecialchars(getTranslatedName($this, $this->data['faventry'])).'" /></form>'; + echo '</div>'; } - - ?> - - - - - <div id="tabdiv"> - <ul class="tabset_tabs"> - <?php - - $tabs = array_keys( $this->data['idplist']); - $i = 1; - foreach ($tabs AS $tab) { - if(!empty($this->data['idplist'][$tab])) { - if ($i === 1) { - echo '<li class="tab-link current" data-tab="'.$tab.'"><a href="#' . $tab . '"><span>' . $this->t($this->data['tabNames'][$tab]) . '</span></a></li>'; - } else { - echo '<li class="tab-link" data-tab="'.$tab.'"><a href="#' . $tab . '"><span>' . $this->t($this->data['tabNames'][$tab]) . '</span></a></li> '; - } - $i++; - } - } - - ?> + <?php + $tabs = array_keys($this->data['idplist']); + $i = 1; + foreach ($tabs as $tab) { + if (!empty($this->data['idplist'][$tab])) { + if ($i === 1) { + echo '<li class="tab-link current" data-tab="'.$tab.'"><a href="#'.$tab. + '"><span>'.$this->t($this->data['tabNames'][$tab]).'</span></a></li>'; + } else { + echo '<li class="tab-link" data-tab="'.$tab.'"><a href="#'.$tab. + '"><span>'.$this->t($this->data['tabNames'][$tab]).'</span></a></li> '; + } + $i++; + } + } + ?> </ul> - <?php - - - -foreach( $this->data['idplist'] AS $tab => $slist) { - $first = array_keys($this->data['idplist']); - if ($first[0] === $tab) { - echo '<div id="' . $tab . '" class="tabset_content current">'; - } else { - echo '<div id="' . $tab . '" class="tabset_content">'; - } - if (!empty($slist)) { - - echo(' <div class="inlinesearch">'); - echo(' <p>Incremental search...</p>'); - echo(' <form id="idpselectform" action="?" method="get"><input class="inlinesearch" type="text" value="" name="query_' . $tab . '" id="query_' . $tab . '" /></form>'); - echo(' </div>'); - - echo(' <div class="metalist" id="list_' . $tab . '">'); - if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist)) { - $idpentry = $slist[$this->data['preferredidp']]; - echo (showEntry($this, $idpentry, TRUE)); - } - - foreach ($slist AS $idpentry) { - if ($idpentry['entityid'] != $this->data['preferredidp']) { - echo (showEntry($this, $idpentry)); - } - } - echo(' </div>'); - } - echo '</div>'; - +foreach ($this->data['idplist'] as $tab => $slist) { + $first = array_keys($this->data['idplist']); + if ($first[0] === $tab) { + echo '<div id="'.$tab.'" class="tabset_content current">'; + } else { + echo '<div id="'.$tab.'" class="tabset_content">'; + } + if (!empty($slist)) { + echo '<div class="inlinesearch">'; + echo '<p>Incremental search...</p>'; + echo '<form id="idpselectform" action="?" method="get">'; + echo '<input class="inlinesearch" type="text" value="" name="query_'.$tab.'" id="query_'.$tab.'" /></form>'; + echo '</div>'; + + echo '<div class="metalist" id="list_'.$tab .'">'; + if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist)) { + $idpentry = $slist[$this->data['preferredidp']]; + echo showEntry($this, $idpentry, true); + } + + foreach ($slist as $idpentry) { + if ($idpentry['entityid'] != $this->data['preferredidp']) { + echo showEntry($this, $idpentry); + } + } + echo '</div>'; + } + echo '</div>'; } - -?> - +?> </div> <script type="text/javascript"> -$(document).ready(function() { +$(document).ready(function () { <?php $i = 0; -foreach ($this->data['idplist'] AS $tab => $slist) { - echo "\n" . '$("#query_' . $tab . '").liveUpdate("#list_' . $tab . '")' . - (($i++ == 0) && (empty($this->data['faventry'])) ? '.focus()' : '') . - ';'; - - +foreach ($this->data['idplist'] as $tab => $slist) { + echo "\n".'$("#query_'.$tab.'").liveUpdate("#list_'.$tab.'")'. + (($i++ == 0) && (empty($this->data['faventry'])) ? '.focus()' : '').';'; } ?> }); @@ -174,5 +143,6 @@ foreach ($this->data['idplist'] AS $tab => $slist) { </script> <?php -$this->data['post'] .= '<script type="text/javascript" src="' . SimpleSAML\Module::getModuleUrl('discopower/js/javascript.js') . '"></script>'; +$this->data['post'] .= '<script type="text/javascript" src="'. + SimpleSAML\Module::getModuleURL('discopower/js/javascript.js').'"></script>'; $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/discopower/templates/disco.twig b/modules/discopower/templates/disco.twig index 3645cdb169a6b53dc3b78446236430b7b425ec87..8e7082304c16f598e75ada0fc0fb0274ef95ee15 100644 --- a/modules/discopower/templates/disco.twig +++ b/modules/discopower/templates/disco.twig @@ -26,28 +26,16 @@ <div id="tabdiv"> <ul class="tabset_tabs"> - {% set i = 1 %} {% for tab, idps in idplist %} {% if idps is not empty %} - {% if i == 1 %} - <li class="tab-link current" data-tab="{{ tab }}"><a href="#{{ tab }}"><span>{{ tabNames[tab]|trans }}</span></a></li> - {% set i = 2 %} - {% else %} - <li class="tab-link" data-tab="{{ tab }}"><a href="#{{ tab }}"><span>{{ tabNames[tab]|trans }}</span></a></li> - {% endif %} + <li class="tab-link{% if loop.first %}current{% endif %}" data-tab="{{ tab }}"><a href="#{{ tab }}"><span>{{ tabNames[tab]|trans }}</span></a></li> {% endif %} {% endfor %} </ul> - {% set i = 1 %} {% for tab, idps in idplist %} {% if idps is not empty %} - {% if i == 1 %} - <div id="{{ tab }}" class="tabset_content current"> - {% set i = 2 %} - {% else %} - <div id="{{ tab }}" class="tabset_content"> - {% endif %} + <div id="{{ tab }}" class="tabset_content{% if loop.first %} current{% endif %}"> <div class="inlinesearch"> <p>Incremental search...</p> <form id="idpselectform" method="get"> diff --git a/modules/discopower/www/style.css b/modules/discopower/www/assets/css/disco.css similarity index 95% rename from modules/discopower/www/style.css rename to modules/discopower/www/assets/css/disco.css index dddb03c2221ba40ca07a1783f20b0f1b345ed233..c270798321da61b199164d62918d58d3e952f184 100644 --- a/modules/discopower/www/style.css +++ b/modules/discopower/www/assets/css/disco.css @@ -15,7 +15,7 @@ margin: 0px 2px 0px 0px; } .inlinesearch * { - margin: 0px; + margin: 0px; padding: 0px; } div.metalist { @@ -51,10 +51,10 @@ a.metaentry:hover img.entryicon { display: inline; top: 0px; bottom: 0px; - clear: both; - float: right; - margin: 1em; - padding: 3px; + clear: both; + float: right; + margin: 1em; + padding: 3px; border: 1px solid #999; } diff --git a/modules/discopower/www/assets/js/jquery.livesearch.js b/modules/discopower/www/assets/js/jquery.livesearch.js new file mode 100644 index 0000000000000000000000000000000000000000..2b125ff951350ae8c49fd0de49442da48a7bc3f2 --- /dev/null +++ b/modules/discopower/www/assets/js/jquery.livesearch.js @@ -0,0 +1,43 @@ +jQuery.fn.liveUpdate = function (list) { + list = jQuery(list); + + if (list.length) { + var rows = list.children('a'), + cache = rows.map(function () { + return jQuery(this).text().toLowerCase(); + }); + + this.keyup(filter).keyup().parents('form').submit(function () { + return false; + }); + } + + return this; + + function filter() + { + var term = jQuery.trim(jQuery(this).val().toLowerCase()), scores = []; + + if (!term) { + rows.show(); + } else { + rows.hide(); + + cache.each(function (i) { + var score = this.score(term); + if (score > 0) { + scores.push([score, i]); + } + }); + + jQuery.each( + scores.sort(function (a, b) { + return b[0] - a[0]; + }), + function () { + jQuery(rows[ this[1] ]).show(); + } + ); + } + } +}; diff --git a/modules/discopower/www/assets/js/quicksilver.js b/modules/discopower/www/assets/js/quicksilver.js new file mode 100644 index 0000000000000000000000000000000000000000..079ea87d5c2c03ec140396014394dbed08ad4dad --- /dev/null +++ b/modules/discopower/www/assets/js/quicksilver.js @@ -0,0 +1,102 @@ +// qs_score - Quicksilver Score +// +// A port of the Quicksilver string ranking algorithm +// +// "hello world".score("axl") //=> 0.0 +// "hello world".score("ow") //=> 0.6 +// "hello world".score("hello world") //=> 1.0 +// +// Tested in Firefox 2 and Safari 3 +// +// The Quicksilver code is available here +// http://code.google.com/p/blacktree-alchemy/ +// http://blacktree-alchemy.googlecode.com/svn/trunk/Crucible/Code/NSString+BLTRRanking.m +// +// The MIT License +// +// Copyright (c) 2008 Lachie Cox +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +String.prototype.score = function (abbreviation,offset) { + offset = offset || 0 // TODO: I think this is unused... remove + + if (abbreviation.length == 0) { + return 0.9 + } + if (abbreviation.length > this.length) { + return 0.0 + } + + for (var i = abbreviation.length; i > 0; i--) { + var sub_abbreviation = abbreviation.substring(0,i) + var index = this.indexOf(sub_abbreviation) + + + if (index < 0) { + continue; + } + if (index + abbreviation.length > this.length + offset) { + continue; + } + + var next_string = this.substring(index+sub_abbreviation.length) + var next_abbreviation = null + + if (i >= abbreviation.length) { + next_abbreviation = '' + } else { + next_abbreviation = abbreviation.substring(i) + } + + var remaining_score = next_string.score(next_abbreviation,offset + index) + + if (remaining_score > 0) { + var score = this.length - next_string.length; + + if (index != 0) { + var j = 0; + var c = this.charCodeAt(index - 1) + if ( c==32 || c == 9) { + for (var j=(index-2); j >= 0; j--) { + c = this.charCodeAt(j) + score -= ((c == 32 || c == 9) ? 1 : 0.15) + } + // XXX maybe not port this heuristic + // + // } else if ([[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:[self characterAtIndex:matchedRange.location]]) { + // for (j = matchedRange.location-1; j >= (int) searchRange.location; j--) { + // if ([[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:[self characterAtIndex:j]]) + // score--; + // else + // score -= 0.15; + // } + } else { + score -= index + } + } + + score += remaining_score * next_string.length + score /= this.length; + return score + } + } + return 0.0 +} diff --git a/modules/discopower/www/assets/js/suggest.js b/modules/discopower/www/assets/js/suggest.js new file mode 100644 index 0000000000000000000000000000000000000000..b404edd0a0509dad13cab4d2d6fab86feaa0c85b --- /dev/null +++ b/modules/discopower/www/assets/js/suggest.js @@ -0,0 +1,25 @@ +var suggest_cache = new Array; + +String.prototype.score = function (abbreviation,offset) { + if (suggest_cache['abv'] != abbreviation) { + suggest_cache['abv'] = abbreviation; + var words = abbreviation.split(/\s/); + suggest_cache['len'] = words.length; + suggest_cache.re = new Array; + + //words.each(); + for (var i = 0; i < suggest_cache['len']; ++i) { + suggest_cache['re'][i] = new Array(); + // /\b<x>/ doesn't work when <x> i a non-ascii - oddly enough \s does ... + suggest_cache['re'][i]['initialword'] = new RegExp("^"+words[i], "i"); + suggest_cache['re'][i]['word'] = new RegExp("[\\s-()_]"+words[i], "i"); + } + } + + for (var i = 0; i < suggest_cache['len']; ++i) { + if (!(this.match(suggest_cache['re'][i]['initialword']) || this.match(suggest_cache['re'][i]['word']))) { + return 0; + } + } + return 1; +} diff --git a/modules/discopower/www/disco.php b/modules/discopower/www/disco.php index 29d4343f6d54aaec29939496c3b6e50631e609b8..6a074787153d2076ba1dc7d872f2ad0cfadc50a5 100644 --- a/modules/discopower/www/disco.php +++ b/modules/discopower/www/disco.php @@ -1,7 +1,10 @@ <?php try { - $discoHandler = new \SimpleSAML\Module\discopower\PowerIdPDisco(array('saml20-idp-remote', 'shib13-idp-remote'), 'poweridpdisco'); + $discoHandler = new \SimpleSAML\Module\discopower\PowerIdPDisco( + ['saml20-idp-remote', 'shib13-idp-remote'], + 'poweridpdisco' + ); } catch (\Exception $exception) { // An error here should be caused by invalid query parameters throw new \SimpleSAML\Error\Error('DISCOPARAMS', $exception); diff --git a/modules/discopower/www/js/jquery.livesearch.js b/modules/discopower/www/js/jquery.livesearch.js deleted file mode 100644 index 06c30437371ed145f78c5d27b085fae6c825a47c..0000000000000000000000000000000000000000 --- a/modules/discopower/www/js/jquery.livesearch.js +++ /dev/null @@ -1,37 +0,0 @@ -jQuery.fn.liveUpdate = function(list){ - list = jQuery(list); - - if ( list.length ) { - var rows = list.children('a'), - cache = rows.map(function(){ - return jQuery(this).text().toLowerCase(); - }); - - this - .keyup(filter).keyup() - .parents('form').submit(function(){ - return false; - }); - } - - return this; - - function filter(){ - var term = jQuery.trim( jQuery(this).val().toLowerCase() ), scores = []; - - if ( !term ) { - rows.show(); - } else { - rows.hide(); - - cache.each(function(i){ - var score = this.score(term); - if (score > 0) { scores.push([score, i]); } - }); - - jQuery.each(scores.sort(function(a, b){return b[0] - a[0];}), function(){ - jQuery(rows[ this[1] ]).show(); - }); - } - } -}; diff --git a/modules/discopower/www/js/quicksilver.js b/modules/discopower/www/js/quicksilver.js deleted file mode 100644 index af29f732b48a5609bb09c6beb3c04f99610f2534..0000000000000000000000000000000000000000 --- a/modules/discopower/www/js/quicksilver.js +++ /dev/null @@ -1,95 +0,0 @@ -// qs_score - Quicksilver Score -// -// A port of the Quicksilver string ranking algorithm -// -// "hello world".score("axl") //=> 0.0 -// "hello world".score("ow") //=> 0.6 -// "hello world".score("hello world") //=> 1.0 -// -// Tested in Firefox 2 and Safari 3 -// -// The Quicksilver code is available here -// http://code.google.com/p/blacktree-alchemy/ -// http://blacktree-alchemy.googlecode.com/svn/trunk/Crucible/Code/NSString+BLTRRanking.m -// -// The MIT License -// -// Copyright (c) 2008 Lachie Cox -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - - -String.prototype.score = function(abbreviation,offset) { - offset = offset || 0 // TODO: I think this is unused... remove - - if(abbreviation.length == 0) return 0.9 - if(abbreviation.length > this.length) return 0.0 - - for (var i = abbreviation.length; i > 0; i--) { - var sub_abbreviation = abbreviation.substring(0,i) - var index = this.indexOf(sub_abbreviation) - - - if(index < 0) continue; - if(index + abbreviation.length > this.length + offset) continue; - - var next_string = this.substring(index+sub_abbreviation.length) - var next_abbreviation = null - - if(i >= abbreviation.length) - next_abbreviation = '' - else - next_abbreviation = abbreviation.substring(i) - - var remaining_score = next_string.score(next_abbreviation,offset+index) - - if (remaining_score > 0) { - var score = this.length-next_string.length; - - if(index != 0) { - var j = 0; - - var c = this.charCodeAt(index-1) - if(c==32 || c == 9) { - for(var j=(index-2); j >= 0; j--) { - c = this.charCodeAt(j) - score -= ((c == 32 || c == 9) ? 1 : 0.15) - } - - // XXX maybe not port this heuristic - // - // } else if ([[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:[self characterAtIndex:matchedRange.location]]) { - // for (j = matchedRange.location-1; j >= (int) searchRange.location; j--) { - // if ([[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:[self characterAtIndex:j]]) - // score--; - // else - // score -= 0.15; - // } - } else { - score -= index - } - } - - score += remaining_score * next_string.length - score /= this.length; - return score - } - } - return 0.0 -} \ No newline at end of file diff --git a/modules/discopower/www/js/suggest.js b/modules/discopower/www/js/suggest.js deleted file mode 100644 index 667b35ac944d2aead91124e72542bba5409e00e6..0000000000000000000000000000000000000000 --- a/modules/discopower/www/js/suggest.js +++ /dev/null @@ -1,23 +0,0 @@ -var suggest_cache = new Array; - -String.prototype.score = function(abbreviation,offset) { - if (suggest_cache['abv'] != abbreviation) { - suggest_cache['abv'] = abbreviation; - var words = abbreviation.split(/\s/); - suggest_cache['len'] = words.length; - suggest_cache.re = new Array; - - //words.each(); - for ( var i=0; i<suggest_cache['len']; ++i ){ - suggest_cache['re'][i] = new Array(); - // /\b<x>/ doesn't work when <x> i a non-ascii - oddly enough \s does ... - suggest_cache['re'][i]['initialword'] = new RegExp("^"+words[i], "i"); - suggest_cache['re'][i]['word'] = new RegExp("[\\s-()_]"+words[i], "i"); - } - } - - for ( var i=0; i<suggest_cache['len']; ++i ){ - if (!(this.match(suggest_cache['re'][i]['initialword']) || this.match(suggest_cache['re'][i]['word']))) return 0; - } - return 1; -} diff --git a/modules/exampleattributeserver/www/attributeserver.php b/modules/exampleattributeserver/www/attributeserver.php index 1de9e54b06186977707846db08eea286222365ce..5664e415c640326369489746774d8fde36c44504 100644 --- a/modules/exampleattributeserver/www/attributeserver.php +++ b/modules/exampleattributeserver/www/attributeserver.php @@ -16,17 +16,17 @@ if ($spEntityId === null) { throw new \SimpleSAML\Error\BadRequest('Missing <saml:Issuer> in <samlp:AttributeQuery>.'); } -$idpMetadata = $metadata->getMetadataConfig($idpEntityId, 'saml20-idp-hosted'); +$idpMetadata = $metadata->getMetaDataConfig($idpEntityId, 'saml20-idp-hosted'); $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'saml20-sp-remote'); // The endpoint we should deliver the message to $endpoint = $spMetadata->getString('testAttributeEndpoint'); // The attributes we will return -$attributes = array( - 'name' => array('value1', 'value2', 'value3'), - 'test' => array('test'), -); +$attributes = [ + 'name' => ['value1', 'value2', 'value3'], + 'test' => ['test'], +]; // The name format of the attributes $attributeNameFormat = \SAML2\Constants::NAMEFORMAT_UNSPECIFIED; @@ -38,7 +38,7 @@ if (count($returnAttributes) === 0) { $returnAttributes = $attributes; } elseif ($query->getAttributeNameFormat() !== $attributeNameFormat) { SimpleSAML\Logger::debug('Requested attributes with wrong NameFormat - no attributes returned.'); - $returnAttributes = array(); + $returnAttributes = []; } else { foreach ($returnAttributes as $name => $values) { if (!array_key_exists($name, $attributes)) { @@ -63,7 +63,7 @@ $assertion->setIssuer($idpEntityId); $assertion->setNameId($query->getNameId()); $assertion->setNotBefore(time()); $assertion->setNotOnOrAfter(time() + 300); // 60*5 = 5min -$assertion->setValidAudiences(array($spEntityId)); +$assertion->setValidAudiences([$spEntityId]); $assertion->setAttributes($returnAttributes); $assertion->setAttributeNameFormat($attributeNameFormat); @@ -73,7 +73,7 @@ $sc->SubjectConfirmationData = new \SAML2\XML\saml\SubjectConfirmationData(); $sc->SubjectConfirmationData->NotOnOrAfter = time() + 300; // 60*5 = 5min $sc->SubjectConfirmationData->Recipient = $endpoint; $sc->SubjectConfirmationData->InResponseTo = $query->getId(); -$assertion->setSubjectConfirmation(array($sc)); +$assertion->setSubjectConfirmation([$sc]); \SimpleSAML\Module\saml\Message::addSign($idpMetadata, $spMetadata, $assertion); @@ -82,7 +82,7 @@ $response->setRelayState($query->getRelayState()); $response->setDestination($endpoint); $response->setIssuer($idpEntityId); $response->setInResponseTo($query->getId()); -$response->setAssertions(array($assertion)); +$response->setAssertions([$assertion]); \SimpleSAML\Module\saml\Message::addSign($idpMetadata, $spMetadata, $response); $binding = new \SAML2\HTTPPost(); diff --git a/modules/exampleauth/lib/Auth/Process/RedirectTest.php b/modules/exampleauth/lib/Auth/Process/RedirectTest.php index 4e8d3b7781dc0d87e762ca5e653ed11164878cb6..13ff82dbd2e92a09d64943c2b2d938a09f7f3537 100644 --- a/modules/exampleauth/lib/Auth/Process/RedirectTest.php +++ b/modules/exampleauth/lib/Auth/Process/RedirectTest.php @@ -20,11 +20,11 @@ class RedirectTest extends \SimpleSAML\Auth\ProcessingFilter assert(array_key_exists('Attributes', $state)); // To check whether the state is saved correctly - $state['Attributes']['RedirectTest1'] = array('OK'); + $state['Attributes']['RedirectTest1'] = ['OK']; // Save state and redirect $id = \SimpleSAML\Auth\State::saveState($state, 'exampleauth:redirectfilter-test'); $url = \SimpleSAML\Module::getModuleURL('exampleauth/redirecttest.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } } diff --git a/modules/exampleauth/lib/Auth/Source/External.php b/modules/exampleauth/lib/Auth/Source/External.php index c349ba1556851ed47feab2c89cd47ab8d930f74d..fef113edb9ed6a4fe6375a8baf614ea072bb1162 100644 --- a/modules/exampleauth/lib/Auth/Source/External.php +++ b/modules/exampleauth/lib/Auth/Source/External.php @@ -76,17 +76,17 @@ class External extends \SimpleSAML\Auth\Source * to store them as arrays. */ - $attributes = array( - 'uid' => array($_SESSION['uid']), - 'displayName' => array($_SESSION['name']), - 'mail' => array($_SESSION['mail']), - ); + $attributes = [ + 'uid' => [$_SESSION['uid']], + 'displayName' => [$_SESSION['name']], + 'mail' => [$_SESSION['mail']], + ]; // Here we generate a multivalued attribute based on the account type - $attributes['eduPersonAffiliation'] = array( + $attributes['eduPersonAffiliation'] = [ $_SESSION['type'], /* In this example, either 'student' or 'employee'. */ 'member', - ); + ]; return $attributes; } @@ -143,9 +143,9 @@ class External extends \SimpleSAML\Auth\Source * We assume that whatever authentication page we send the user to has an * option to return the user to a specific page afterwards. */ - $returnTo = \SimpleSAML\Module::getModuleURL('exampleauth/resume.php', array( + $returnTo = \SimpleSAML\Module::getModuleURL('exampleauth/resume.php', [ 'State' => $stateId, - )); + ]); /* * Get the URL of the authentication page. @@ -162,9 +162,9 @@ class External extends \SimpleSAML\Auth\Source * Note the 'ReturnTo' parameter. This must most likely be replaced with * the real name of the parameter for the login page. */ - \SimpleSAML\Utils\HTTP::redirectTrustedURL($authPage, array( + \SimpleSAML\Utils\HTTP::redirectTrustedURL($authPage, [ 'ReturnTo' => $returnTo, - )); + ]); /* * The redirect function never returns, so we never get this far. diff --git a/modules/exampleauth/lib/Auth/Source/UserPass.php b/modules/exampleauth/lib/Auth/Source/UserPass.php index f1d6fcb042e6e9b1967b8c1aee0622c76ac877ca..19da260bbdfa201c7bb86907da5a806e5002801b 100644 --- a/modules/exampleauth/lib/Auth/Source/UserPass.php +++ b/modules/exampleauth/lib/Auth/Source/UserPass.php @@ -34,17 +34,21 @@ class UserPass extends \SimpleSAML\Module\core\Auth\UserPassBase // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $this->users = array(); + $this->users = []; // Validate and parse our configuration foreach ($config as $userpass => $attributes) { if (!is_string($userpass)) { - throw new \Exception('Invalid <username>:<password> for authentication source '.$this->authId.': '.$userpass); + throw new \Exception( + 'Invalid <username>:<password> for authentication source '.$this->authId.': '.$userpass + ); } $userpass = explode(':', $userpass, 2); if (count($userpass) !== 2) { - throw new \Exception('Invalid <username>:<password> for authentication source '.$this->authId.': '.$userpass[0]); + throw new \Exception( + 'Invalid <username>:<password> for authentication source '.$this->authId.': '.$userpass[0] + ); } $username = $userpass[0]; $password = $userpass[1]; diff --git a/modules/exampleauth/www/authpage.php b/modules/exampleauth/www/authpage.php index f4fc5339d45e0dd253d04d508eb493d2c146bcab..6c34995ec79627eb8e458e5aba5fe6eb858b8910 100644 --- a/modules/exampleauth/www/authpage.php +++ b/modules/exampleauth/www/authpage.php @@ -39,22 +39,22 @@ if (!preg_match('@State=(.*)@', $returnTo, $matches)) { /* * Our list of users. */ -$users = array( - 'student' => array( +$users = [ + 'student' => [ 'password' => 'student', 'uid' => 'student', 'name' => 'Student Name', 'mail' => 'somestudent@example.org', 'type' => 'student', - ), - 'admin' => array( + ], + 'admin' => [ 'password' => 'admin', 'uid' => 'admin', 'name' => 'Admin Name', 'mail' => 'someadmin@example.org', 'type' => 'employee', - ), -); + ], +]; /* * Time to handle login responses. @@ -96,7 +96,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { </head> <body> <h1>exampleauth login page</h1> -<p>In this example you can log in with two accounts: <code>student</code> and <code>admin</code>. In both cases, the password is the same as the username.</p> +<p> +In this example you can log in with two accounts: <code>student</code> and <code>admin</code>. +In both cases, the password is the same as the username. +</p> <?php if ($badUserPass) { ?> <p>Bad username or password.</p> <?php } ?> diff --git a/modules/exampleauth/www/redirecttest.php b/modules/exampleauth/www/redirecttest.php index 103d262af775f8ff590b6e10233185e51402fc45..9d605277d31a7f2c05508d1d01aa5e4bbf596d67 100644 --- a/modules/exampleauth/www/redirecttest.php +++ b/modules/exampleauth/www/redirecttest.php @@ -12,6 +12,6 @@ if (!array_key_exists('StateId', $_REQUEST)) { } $state = \SimpleSAML\Auth\State::loadState($_REQUEST['StateId'], 'exampleauth:redirectfilter-test'); -$state['Attributes']['RedirectTest2'] = array('OK'); +$state['Attributes']['RedirectTest2'] = ['OK']; \SimpleSAML\Auth\ProcessingChain::resumeProcessing($state); diff --git a/modules/expirycheck/lib/Auth/Process/ExpiryDate.php b/modules/expirycheck/lib/Auth/Process/ExpiryDate.php index c41178c84023a3c8f31475260d66675fd23b3a1b..ddd5befc1548c290914a389771a26f632087c33d 100644 --- a/modules/expirycheck/lib/Auth/Process/ExpiryDate.php +++ b/modules/expirycheck/lib/Auth/Process/ExpiryDate.php @@ -52,14 +52,18 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter if (array_key_exists('netid_attr', $config)) { $this->netid_attr = $config['netid_attr']; if (!is_string($this->netid_attr)) { - throw new \Exception('Invalid attribute name given as eduPersonPrincipalName to expirycheck::ExpiryDate filter.'); + throw new \Exception( + 'Invalid attribute name given as eduPersonPrincipalName to expirycheck::ExpiryDate filter.' + ); } } if (array_key_exists('expirydate_attr', $config)) { $this->expirydate_attr = $config['expirydate_attr']; if (!is_string($this->expirydate_attr)) { - throw new \Exception('Invalid attribute name given as schacExpiryDate to expirycheck::ExpiryDate filter.'); + throw new \Exception( + 'Invalid attribute name given as schacExpiryDate to expirycheck::ExpiryDate filter.' + ); } } @@ -138,7 +142,7 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter $state['netId'] = $netId; $id = \SimpleSAML\Auth\State::saveState($state, 'expirywarning:about2expire'); $url = \SimpleSAML\Module::getModuleURL('expirycheck/about2expire.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } if (!$this->checkDate($expireOnDate)) { @@ -150,7 +154,7 @@ class ExpiryDate extends \SimpleSAML\Auth\ProcessingFilter $state['netId'] = $netId; $id = \SimpleSAML\Auth\State::saveState($state, 'expirywarning:expired'); $url = \SimpleSAML\Module::getModuleURL('expirycheck/expired.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } } } diff --git a/modules/expirycheck/templates/about2expire.php b/modules/expirycheck/templates/about2expire.php index b3c538b2c843e0caeed35ae37369834c5d560c85..6b135f807f5eb1e5332e136dda9280efa50f8bbd 100644 --- a/modules/expirycheck/templates/about2expire.php +++ b/modules/expirycheck/templates/about2expire.php @@ -17,24 +17,21 @@ */ $this->data['autofocus'] = 'yesbutton'; - $this->includeAtTemplateBase('includes/header.php'); -?> - -<form style="display: inline; margin: 0px; padding: 0px" action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>"> +$yesTarget = htmlspecialchars($this->data['yesTarget']); +$buttonContinue = htmlspecialchars($this->t('{expirycheck:expwarning:btn_continue}')); - <?php - // Embed hidden fields... - foreach ($this->data['yesData'] as $name => $value) { - echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; - } - ?> - <h3><?php echo $warning; ?></h3> - <p><?php echo $this->t('{expirycheck:expwarning:expiry_date_text}')." ".$this->data['expireOnDate']; ?></p> - - <input type="submit" name="yes" id="yesbutton" value="<?php echo htmlspecialchars($this->t('{expirycheck:expwarning:btn_continue}')) ?>" /> +echo '<form style="display: inline; margin: 0px; padding: 0px" action="'.$yesTarget.'">'; +// Embed hidden fields... +foreach ($this->data['yesData'] as $name => $value) { + echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; +} +?> +<h3><?php echo $warning; ?></h3> +<p><?php echo $this->t('{expirycheck:expwarning:expiry_date_text}')." ".$this->data['expireOnDate']; ?></p> +<input type="submit" name="yes" id="yesbutton" value="<?php echo $buttonContinue; ?>" /> </form> <?php diff --git a/modules/expirycheck/templates/about2expire.twig b/modules/expirycheck/templates/about2expire.twig index c60788051a4a8339aeb5f86a986062dfb80b4360..1e1d5d427323c00833c54872611c890ee309f485 100644 --- a/modules/expirycheck/templates/about2expire.twig +++ b/modules/expirycheck/templates/about2expire.twig @@ -4,10 +4,10 @@ {% block content %} <form style="display: inline; margin: 0px; padding: 0px" action="{{ yesTarget|escape('html') }}"> {% for name, value in yesData %} - <input type="hidden" name="{{ name|escape('html') }}" value="{{ value|escape('html') }}" /> + <input type="hidden" name="{{ name|escape('html') }}" value="{{ value|escape('html') }}"> {% endfor %} <h3>{{ warning }}</h3> <p>{{ '{expirycheck:expwarning:expiry_date_text}'|trans }} {{ expireOnDate }}</p> - <input type="submit" name="yes" id="yesbutton" value="{{ '{expirycheck:expwarning:btn_continue}'|trans }}" /> + <input type="submit" name="yes" id="yesbutton" value="{{ '{expirycheck:expwarning:btn_continue}'|trans }}" autofocus> </form> {% endblock %} diff --git a/modules/expirycheck/templates/expired.php b/modules/expirycheck/templates/expired.php index dc4f54718acc90a3adef7e94d4fccf369db3acc0..2e0e660201ee09c97dcd1a40ff75f2d5012b2f6f 100644 --- a/modules/expirycheck/templates/expired.php +++ b/modules/expirycheck/templates/expired.php @@ -3,8 +3,18 @@ $this->data['header'] = $this->t('{expirycheck:expwarning:access_denied}'); $this->includeAtTemplateBase('includes/header.php'); ?> <h2><?php echo $this->t('{expirycheck:expwarning:access_denied}'); ?></h2> - <p><?php echo $this->t('{expirycheck:expwarning:no_access_to}', array('%NETID%' => htmlspecialchars($this->data['netId']))); ?></p> - <p><?php echo $this->t('{expirycheck:expwarning:expiry_date_text}'); ?> <b><?php echo htmlspecialchars($this->data['expireOnDate']); ?></b></p> + <p> + <?php + echo $this->t( + '{expirycheck:expwarning:no_access_to}', + ['%NETID%' => htmlspecialchars($this->data['netId'])] + ); + ?> + </p> + <p> + <?php echo $this->t('{expirycheck:expwarning:expiry_date_text}'); ?> + <b><?php echo htmlspecialchars($this->data['expireOnDate']); ?></b> + </p> <p><?php echo $this->t('{expirycheck:expwarning:contact_home}'); ?></p> <?php $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/expirycheck/www/about2expire.php b/modules/expirycheck/www/about2expire.php index fa502121e5699db9df40972157ea2d3cb91a307f..1f1766c7e7ad14dbb10c8a8f3c2aebf02149e348 100644 --- a/modules/expirycheck/www/about2expire.php +++ b/modules/expirycheck/www/about2expire.php @@ -26,44 +26,44 @@ $daysleft = $state['daysleft']; $t = new \SimpleSAML\XHTML\Template($globalConfig, 'expirycheck:about2expire.php'); $t->data['autofocus'] = 'yesbutton'; $t->data['yesTarget'] = \SimpleSAML\Module::getModuleURL('expirycheck/about2expire.php'); -$t->data['yesData'] = array('StateId' => $id); +$t->data['yesData'] = ['StateId' => $id]; $t->data['warning'] = $warning; $t->data['expireOnDate'] = $state['expireOnDate']; $t->data['netId'] = $state['netId']; if ($daysleft == 0) { # netid will expire today - $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header_today}', array( + $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header_today}', [ '%NETID%' => htmlspecialchars($this->data['netId']) - )); - $this->data['warning'] = $this->t('{expirycheck:expwarning:warning_today}', array( + ]); + $this->data['warning'] = $this->t('{expirycheck:expwarning:warning_today}', [ '%NETID%' => htmlspecialchars($this->data['netId']) - )); + ]); } elseif ($daysleft == 1) { # netid will expire in one day - $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', array( + $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', [ '%NETID%' => htmlspecialchars($this->data['netId']), '%DAYS%' => $this->t('{expirycheck:expwarning:day}'), '%DAYSLEFT%' => htmlspecialchars($daysleft), - )); - $this->data['warning'] = $this->t('{expirycheck:expwarning:warning}', array( + ]); + $this->data['warning'] = $this->t('{expirycheck:expwarning:warning}', [ '%NETID%' => htmlspecialchars($this->data['netId']), '%DAYS%' => $this->t('{expirycheck:expwarning:day}'), '%DAYSLEFT%' => htmlspecialchars($daysleft), - )); + ]); } else { # netid will expire in next <daysleft> days - $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', array( + $this->data['header'] = $this->t('{expirycheck:expwarning:warning_header}', [ '%NETID%' => htmlspecialchars($this->data['netId']), '%DAYS%' => $this->t('{expirycheck:expwarning:days}'), '%DAYSLEFT%' => htmlspecialchars($daysleft), - )); - $this->data['warning'] = $this->t('{expirycheck:expwarning:warning}', array( + ]); + $this->data['warning'] = $this->t('{expirycheck:expwarning:warning}', [ '%NETID%' => htmlspecialchars($this->data['netId']), '%DAYS%' => $this->t('{expirycheck:expwarning:days}'), '%DAYSLEFT%' => htmlspecialchars($daysleft), - )); + ]); } $t->show(); diff --git a/modules/ldap/lib/Auth/Process/AttributeAddFromLDAP.php b/modules/ldap/lib/Auth/Process/AttributeAddFromLDAP.php index b8d1a1eb792bc19462e683eb283e5ec8d002965e..a1062376d98df4ba15fcce8c74d0b4ccb005a5a7 100644 --- a/modules/ldap/lib/Auth/Process/AttributeAddFromLDAP.php +++ b/modules/ldap/lib/Auth/Process/AttributeAddFromLDAP.php @@ -120,7 +120,7 @@ class AttributeAddFromLDAP extends BaseFilter parent::__construct($config, $reserved); // Get filter specific config options - $this->search_attributes = $this->config->getArrayize('attributes', array()); + $this->search_attributes = $this->config->getArrayize('attributes', []); if (empty($this->search_attributes)) { $new_attribute = $this->config->getString('attribute.new', ''); $this->search_attributes[$new_attribute] = $this->config->getString('search.attribute'); @@ -146,8 +146,8 @@ class AttributeAddFromLDAP extends BaseFilter // perform a merge on the ldap_search_filter // loop over the attributes and build the search and replace arrays - $arrSearch = array(); - $arrReplace = array(); + $arrSearch = []; + $arrReplace = []; foreach ($attributes as $attr => $val) { $arrSearch[] = '%'.$attr.'%'; @@ -167,7 +167,7 @@ class AttributeAddFromLDAP extends BaseFilter return; } - if (!in_array($this->attr_policy, array('merge', 'replace', 'add'), true)) { + if (!in_array($this->attr_policy, ['merge', 'replace', 'add'], true)) { \SimpleSAML\Logger::warning("AttributeAddFromLDAP: 'attribute.policy' must be one of 'merge',". "'replace' or 'add'."); return; diff --git a/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php b/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php index 20ebfd33029a4fb0aab837b9500b4eade2a732ed..6101e7b162921c732d4db64baab3ca827f0c9eb1 100644 --- a/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php +++ b/modules/ldap/lib/Auth/Process/AttributeAddUsersGroups.php @@ -41,7 +41,7 @@ class AttributeAddUsersGroups extends BaseFilter // Make the array if it is not set already if (!isset($attributes[$map['groups']])) { - $attributes[$map['groups']] = array(); + $attributes[$map['groups']] = []; } // Must be an array, else cannot merge groups @@ -105,7 +105,8 @@ class AttributeAddUsersGroups extends BaseFilter if (!isset($attributes[$map['memberof']])) { throw new \SimpleSAML\Error\Exception( $this->title.'The memberof attribute ['.$map['memberof']. - '] is not defined in the user\'s Attributes: '.implode(', ', array_keys($attributes))); + '] is not defined in the user\'s Attributes: '.implode(', ', array_keys($attributes)) + ); } // MemberOf must be an array of group DN's @@ -154,10 +155,16 @@ class AttributeAddUsersGroups extends BaseFilter "=".$attributes[$map['username']][0].") and attributes ".$map['member'] ); - $groups = array(); + $groups = []; try { - // Intention is to filter in 'ou=groups,dc=example,dc=com' for '(memberUid = <value of attribute.username>)' and take only the attributes 'cn' (=name of the group) - $all_groups = $this->getLdap()->searchformultiple($openldap_base, array($map['memberof'] => $attributes[$map['username']][0]), array($map['member'])); + /* Intention is to filter in 'ou=groups,dc=example,dc=com' for + * '(memberUid = <value of attribute.username>)' and take only the attributes 'cn' (=name of the group) + */ + $all_groups = $this->getLdap()->searchformultiple( + $openldap_base, + [$map['memberof'] => $attributes[$map['username']][0]], + [$map['member']] + ); } catch (\SimpleSAML\Error\UserNotFound $e) { return $groups; // if no groups found return with empty (still just initialized) groups array } @@ -194,7 +201,8 @@ class AttributeAddUsersGroups extends BaseFilter if (!isset($attributes[$map['dn']])) { throw new \SimpleSAML\Error\Exception( $this->title.'The DN attribute ['.$map['dn']. - '] is not defined in the user\'s Attributes: '.implode(', ', array_keys($attributes))); + '] is not defined in the user\'s Attributes: '.implode(', ', array_keys($attributes)) + ); } // DN attribute must have a value @@ -223,10 +231,10 @@ class AttributeAddUsersGroups extends BaseFilter assert(is_array($memberof)); // Used to determine what DN's have already been searched - static $searched = array(); + static $searched = []; // Init the groups variable - $groups = array(); + $groups = []; // Shorten the variable name $map = &$this->attribute_map; @@ -241,7 +249,7 @@ class AttributeAddUsersGroups extends BaseFilter // Work out what attributes to get for a group $use_group_name = false; - $get_attributes = array($map['memberof'], $map['type']); + $get_attributes = [$map['memberof'], $map['type']]; if (isset($map['name']) && $map['name']) { $get_attributes[] = $map['name']; $use_group_name = false; @@ -249,14 +257,13 @@ class AttributeAddUsersGroups extends BaseFilter // Check each DN of the passed memberOf foreach ($memberof as $dn) { - // Avoid infinite loops, only need to check a DN once if (isset($searched[$dn])) { continue; } // Track all DN's that are searched - // Use DN for key as well, isset() is faster than in_array() + // Use DN for key as well, isset() is faster than in_[] $searched[$dn] = $dn; // Query LDAP for the attribute values for the DN @@ -322,18 +329,18 @@ class AttributeAddUsersGroups extends BaseFilter try { $entries = $this->getLdap()->searchformultiple( $this->base_dn, - array($map['type'] => $this->type_map['group'], $map['member'].':1.2.840.113556.1.4.1941:' => $dn), - array($map['dn']) + [$map['type'] => $this->type_map['group'], $map['member'].':1.2.840.113556.1.4.1941:' => $dn], + [$map['dn']] ); // The search may throw an exception if no entries // are found, unlikely but possible. } catch (\SimpleSAML\Error\UserNotFound $e) { - return array(); + return []; } //Init the groups - $groups = array(); + $groups = []; // Check each entry.. foreach ($entries as $entry) { @@ -358,7 +365,7 @@ class AttributeAddUsersGroups extends BaseFilter // Could not find DN, log and continue \SimpleSAML\Logger::notice( $this->title.'The DN attribute ['. - implode(', ', array($map['dn'], strtolower($map['dn']), 'dn')). + implode(', ', [$map['dn'], strtolower($map['dn']), 'dn']). '] could not be found in the entry. '.$this->var_export($entry) ); } diff --git a/modules/ldap/lib/Auth/Process/BaseFilter.php b/modules/ldap/lib/Auth/Process/BaseFilter.php index 60e9b70d9572fcd1a653387f88e79c0f8ad95116..f7de0656fc8da7e7b090737fc0e2f5d8ec5fb916 100644 --- a/modules/ldap/lib/Auth/Process/BaseFilter.php +++ b/modules/ldap/lib/Auth/Process/BaseFilter.php @@ -110,7 +110,6 @@ abstract class BaseFilter extends \SimpleSAML\Auth\ProcessingFilter // If an authsource was defined (an not empty string)... if (isset($config['authsource']) && $config['authsource']) { - // Log the authsource request \SimpleSAML\Logger::debug( $this->title.'Attempting to get configuration values from authsource ['. @@ -142,7 +141,7 @@ abstract class BaseFilter extends \SimpleSAML\Auth\ProcessingFilter } // Build the authsource config - $authconfig = array(); + $authconfig = []; if (isset($authsource['hostname'])) { $authconfig['ldap.hostname'] = $authsource['hostname']; } @@ -224,7 +223,7 @@ abstract class BaseFilter extends \SimpleSAML\Auth\ProcessingFilter ); // Setup the attribute map which will be used to search LDAP - $this->attribute_map = array( + $this->attribute_map = [ 'dn' => $this->config->getString('attribute.dn', 'distinguishedName'), 'groups' => $this->config->getString('attribute.groups', 'groups'), 'member' => $this->config->getString('attribute.member', 'member'), @@ -232,7 +231,7 @@ abstract class BaseFilter extends \SimpleSAML\Auth\ProcessingFilter 'name' => $this->config->getString('attribute.groupname', 'name'), 'type' => $this->config->getString('attribute.type', 'objectClass'), 'username' => $this->config->getString('attribute.username', 'sAMAccountName') - ); + ]; // Log the attribute map \SimpleSAML\Logger::debug( @@ -240,10 +239,10 @@ abstract class BaseFilter extends \SimpleSAML\Auth\ProcessingFilter ); // Setup the object type map which is used to determine a DNs' type - $this->type_map = array( + $this->type_map = [ 'group' => $this->config->getString('type.group', 'group'), 'user' => $this->config->getString('type.user', 'user') - ); + ]; // Log the type map \SimpleSAML\Logger::debug( diff --git a/modules/ldap/lib/Auth/Source/LDAP.php b/modules/ldap/lib/Auth/Source/LDAP.php index e3cbd9d52c1fe20d910e56fceebcf9c8970911c5..4757a3bb2502c999fd2927f89f7f300224aa402a 100644 --- a/modules/ldap/lib/Auth/Source/LDAP.php +++ b/modules/ldap/lib/Auth/Source/LDAP.php @@ -35,8 +35,10 @@ class LDAP extends \SimpleSAML\Module\core\Auth\UserPassBase // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $this->ldapConfig = new \SimpleSAML\Module\ldap\ConfigHelper($config, - 'Authentication source '.var_export($this->authId, true)); + $this->ldapConfig = new \SimpleSAML\Module\ldap\ConfigHelper( + $config, + 'Authentication source '.var_export($this->authId, true) + ); } diff --git a/modules/ldap/lib/Auth/Source/LDAPMulti.php b/modules/ldap/lib/Auth/Source/LDAPMulti.php index 8025d44714df2d060db12565332e5267679548f8..c923e984623980b5f9aec01c5bcee82453e65b40 100644 --- a/modules/ldap/lib/Auth/Source/LDAPMulti.php +++ b/modules/ldap/lib/Auth/Source/LDAPMulti.php @@ -45,25 +45,29 @@ class LDAPMulti extends \SimpleSAML\Module\core\Auth\UserPassOrgBase // Call the parent constructor first, as required by the interface parent::__construct($info, $config); - $cfgHelper = \SimpleSAML\Configuration::loadFromArray($config, - 'Authentication source '.var_export($this->authId, true)); + $cfgHelper = \SimpleSAML\Configuration::loadFromArray( + $config, + 'Authentication source '.var_export($this->authId, true) + ); - $this->orgs = array(); - $this->ldapOrgs = array(); + $this->orgs = []; + $this->ldapOrgs = []; foreach ($config as $name => $value) { - if ($name === 'username_organization_method') { $usernameOrgMethod = $cfgHelper->getValueValidate( 'username_organization_method', - array('none', 'allow', 'force')); + ['none', 'allow', 'force'] + ); $this->setUsernameOrgMethod($usernameOrgMethod); continue; } if ($name === 'include_organization_in_username') { $this->includeOrgInUsername = $cfgHelper->getBoolean( - 'include_organization_in_username', false); + 'include_organization_in_username', + false + ); continue; } @@ -76,9 +80,10 @@ class LDAPMulti extends \SimpleSAML\Module\core\Auth\UserPassOrgBase $this->orgs[$orgId] = $orgId; } - $orgCfg = new \SimpleSAML\Module\ldap\ConfigHelper($orgCfg, - 'Authentication source '.var_export($this->authId, true). - ', organization '.var_export($orgId, true)); + $orgCfg = new \SimpleSAML\Module\ldap\ConfigHelper( + $orgCfg, + 'Authentication source '.var_export($this->authId, true).', organization '.var_export($orgId, true) + ); $this->ldapOrgs[$orgId] = $orgCfg; } } diff --git a/modules/ldap/lib/ConfigHelper.php b/modules/ldap/lib/ConfigHelper.php index 3b03a0826512413e6c888c3ae5de4e19331dcbff..d4dcff33ad5084d1f8fdd08cca9bc1734cff91bf 100644 --- a/modules/ldap/lib/ConfigHelper.php +++ b/modules/ldap/lib/ConfigHelper.php @@ -151,7 +151,6 @@ class ConfigHelper $this->searchScope = $config->getString('search.scope', 'subtree'); $this->searchFilter = $config->getString('search.filter', null); $this->searchAttributes = $config->getArray('search.attributes'); - } else { $this->dnPattern = $config->getString('dnpattern'); } @@ -187,7 +186,14 @@ class ConfigHelper throw new \SimpleSAML\Error\Error('WRONGUSERPASS'); } - $ldap = new \SimpleSAML\Auth\LDAP($this->hostname, $this->enableTLS, $this->debug, $this->timeout, $this->port, $this->referrals); + $ldap = new \SimpleSAML\Auth\LDAP( + $this->hostname, + $this->enableTLS, + $this->debug, + $this->timeout, + $this->port, + $this->referrals + ); if (!$this->searchEnable) { $ldapusername = addcslashes($username, ',+"\\<>;*'); @@ -199,7 +205,14 @@ class ConfigHelper } } - $dn = $ldap->searchfordn($this->searchBase, $this->searchAttributes, $username, true, $this->searchFilter, $this->searchScope); + $dn = $ldap->searchfordn( + $this->searchBase, + $this->searchAttributes, + $username, + true, + $this->searchFilter, + $this->searchScope + ); if ($dn === null) { /* User not found with search. */ \SimpleSAML\Logger::info($this->location.': Unable to find users DN. username=\''.$username.'\''); @@ -212,14 +225,14 @@ class ConfigHelper throw new \SimpleSAML\Error\Error('WRONGUSERPASS'); } - /* In case of SASL bind, authenticated and authorized DN may differ */ + // In case of SASL bind, authenticated and authorized DN may differ if (isset($sasl_args)) { $dn = $ldap->whoami($this->searchBase, $this->searchAttributes); } - /* Are privs needed to get the attributes? */ + // Are privs needed to get the attributes? if ($this->privRead) { - /* Yes, rebind with privs */ + // Yes, rebind with privs if (!$ldap->bind($this->privUsername, $this->privPassword)) { throw new \Exception('Error authenticating using privileged DN & password.'); } @@ -253,12 +266,14 @@ class ConfigHelper */ public function searchfordn($attribute, $value, $allowZeroHits) { - $ldap = new \SimpleSAML\Auth\LDAP($this->hostname, + $ldap = new \SimpleSAML\Auth\LDAP( + $this->hostname, $this->enableTLS, $this->debug, $this->timeout, $this->port, - $this->referrals); + $this->referrals + ); if ($attribute == null) { $attribute = $this->searchAttributes; @@ -270,8 +285,14 @@ class ConfigHelper } } - return $ldap->searchfordn($this->searchBase, $attribute, - $value, $allowZeroHits, $this->searchFilter, $this->searchScope); + return $ldap->searchfordn( + $this->searchBase, + $attribute, + $value, + $allowZeroHits, + $this->searchFilter, + $this->searchScope + ); } public function getAttributes($dn, $attributes = null) @@ -280,16 +301,18 @@ class ConfigHelper $attributes = $this->attributes; } - $ldap = new \SimpleSAML\Auth\LDAP($this->hostname, + $ldap = new \SimpleSAML\Auth\LDAP( + $this->hostname, $this->enableTLS, $this->debug, $this->timeout, $this->port, - $this->referrals); + $this->referrals + ); - /* Are privs needed to get the attributes? */ + // Are privs needed to get the attributes? if ($this->privRead) { - /* Yes, rebind with privs */ + // Yes, rebind with privs if (!$ldap->bind($this->privUsername, $this->privPassword)) { throw new \Exception('Error authenticating using privileged DN & password.'); } diff --git a/modules/memcacheMonitor/hooks/hook_frontpage.php b/modules/memcacheMonitor/hooks/hook_frontpage.php index c7f59bc6ce06f0117c370a10de78206abe882fea..9329d55317391c1db6c4e7e665185bf35ecc1bc8 100644 --- a/modules/memcacheMonitor/hooks/hook_frontpage.php +++ b/modules/memcacheMonitor/hooks/hook_frontpage.php @@ -10,8 +10,8 @@ function memcacheMonitor_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['config'][] = array( + $links['config'][] = [ 'href' => SimpleSAML\Module::getModuleURL('memcacheMonitor/memcachestat.php'), 'text' => '{core:frontpage:link_memcacheMonitor}', - ); + ]; } diff --git a/modules/memcacheMonitor/templates/memcachestat.tpl.php b/modules/memcacheMonitor/templates/memcachestat.tpl.php index 9a9a3399d313d69f9331ac08a7903cc42e9ed9b0..02505ed2d36dac5f4720e9fb4013caf23de90e11 100644 --- a/modules/memcacheMonitor/templates/memcachestat.tpl.php +++ b/modules/memcacheMonitor/templates/memcachestat.tpl.php @@ -1,42 +1,19 @@ <?php -$this->data['head'] = '<style type="text/css"> - table.statustable td, table.statustable th { - border: 1px solid #eee; - padding: 2px 6px; - } - table.statustable { - border-collapse: collapse; - } - .bmax { - border: 1px solid #555; - background: #eee; - } - .bused { - border-right: 1px solid #555; - border-bottom: 1px solid #555; - color: white; - background: #833; - } -</style> -'; - - - +$this->data['head'] = '<link href="'.$this->data['baseurlpath'].'assets/css/memcacheMonitor.css" rel="stylesheet" />'; $this->includeAtTemplateBase('includes/header.php'); $title = $this->data['title']; $table = $this->data['table']; - // Identify column headings -$column_titles = array(); -foreach($table as $row_title => $row_data) { - foreach($row_data as $ct => $foo) { - if(!in_array($ct, $column_titles, true)) { - $column_titles[] = $ct; - } - } +$column_titles = []; +foreach ($table as $row_title => $row_data) { + foreach ($row_data as $ct => $foo) { + if (!in_array($ct, $column_titles, true)) { + $column_titles[] = $ct; + } + } } ?> @@ -48,28 +25,28 @@ foreach($table as $row_title => $row_data) { <tr> <th></th> <?php -foreach($column_titles as $ct) { - echo '<th>' . htmlspecialchars($ct) . '</th>' . "\n"; +foreach ($column_titles as $ct) { + echo '<th>'.htmlspecialchars($ct).'</th>'."\n"; } ?> </tr> <?php -foreach($table as $row_title => $row_data) { - echo '<tr>' . "\n"; - echo '<th class="rowtitle" style="text-align: right">' . $this->t($this->data['rowtitles'][$row_title]) . '</th>' . "\n"; +foreach ($table as $row_title => $row_data) { + echo '<tr>' . "\n"; + echo '<th class="rowtitle" style="text-align: right">'.$this->t($this->data['rowtitles'][$row_title]).'</th>'."\n"; - foreach($column_titles as $ct) { - echo '<td>'; + foreach ($column_titles as $ct) { + echo '<td>'; - if(array_key_exists($ct, $row_data)) { - echo htmlspecialchars($row_data[$ct]); - } + if (array_key_exists($ct, $row_data)) { + echo htmlspecialchars($row_data[$ct]); + } - echo '</td>' . "\n"; - } + echo '</td>' . "\n"; + } - echo '</tr>' . "\n"; + echo '</tr>' . "\n"; } ?> @@ -77,15 +54,14 @@ foreach($table as $row_title => $row_data) { <?php if (array_key_exists('bytes', $this->data['statsraw']) && array_key_exists('limit_maxbytes', $this->data['statsraw'])) { - foreach($this->data['statsraw']['bytes'] as $key => $row_data) { - echo ('<h3>Storage usage on [' . $key . ']</h3>'); - $maxpix = 400; - $pix = floor($this->data['statsraw']['bytes'][$key]*$maxpix / $this->data['statsraw']['limit_maxbytes'][$key]); - - echo('<div class="bmax" style="width: ' . $maxpix. 'px"><div class="bused" style="width: ' . $pix . 'px"> - Used: ' . $table['bytes'][$key] . ' - </div>Total available: ' . $table['limit_maxbytes'][$key] . '</div>'); - } + foreach ($this->data['statsraw']['bytes'] as $key => $row_data) { + echo ('<h3>Storage usage on ['.$key.']</h3>'); + $maxpix = 400; + $pix = floor($this->data['statsraw']['bytes'][$key]*$maxpix / $this->data['statsraw']['limit_maxbytes'][$key]); + + echo '<div class="bmax" style="width: '.$maxpix.'px"><div class="bused" style="width: '.$pix.'px">Used: '. + $table['bytes'][$key].'</div>Total available: '.$table['limit_maxbytes'][$key].'</div>'; + } } $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/memcacheMonitor/templates/memcachestat.twig b/modules/memcacheMonitor/templates/memcachestat.twig index f3d4cbd013eb655c0c9bc986f06501d7f85be7f9..fdc4af4bd03a307ad28974a4c4463185ec4ab749 100644 --- a/modules/memcacheMonitor/templates/memcachestat.twig +++ b/modules/memcacheMonitor/templates/memcachestat.twig @@ -2,7 +2,7 @@ {% extends "base.twig" %} {% block preload %} - <link href="{{ baseurlpath }}style.css" rel="stylesheet" /> + <link href="{{ baseurlpath }}assets/css/memcacheMonitor.css" rel="stylesheet" /> {% endblock %} {% block content %} diff --git a/modules/memcacheMonitor/www/style.css b/modules/memcacheMonitor/www/assets/css/memcacheMonitor.css similarity index 100% rename from modules/memcacheMonitor/www/style.css rename to modules/memcacheMonitor/www/assets/css/memcacheMonitor.css diff --git a/modules/memcacheMonitor/www/memcachestat.php b/modules/memcacheMonitor/www/memcachestat.php index 3025afce4679b47f64263c84cb86869f5e312116..a5cb0d20211e83a12768d0d058f2272f7fe6a967 100644 --- a/modules/memcacheMonitor/www/memcachestat.php +++ b/modules/memcacheMonitor/www/memcachestat.php @@ -2,7 +2,7 @@ function tdate($input) { - return date(DATE_RFC822, $input); + return date(DATE_RFC822, $input); } function hours($input) @@ -23,42 +23,42 @@ function humanreadable($input) { $output = ""; $input = abs($input); - + if ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 100)) { - $output = sprintf("%5ldEi", $input / (1024 * 1024 * 1024 * 1024 * 1024 * 1024)); - } else if ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 10)) { - $output = sprintf("%5.1fEi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 1024)) { - $output = sprintf("%5.2fEi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 100)) { - $output = sprintf("%5ldPi", $input / (1024 * 1024 * 1024 * 1024 * 1024)); - } else if ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 10)) { - $output = sprintf("%5.1fPi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 1024 * 1024 * 1024)) { - $output = sprintf("%5.2fPi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 1024 * 1024 * 100)) { + $output = sprintf("%5ldEi", $input / (1024 * 1024 * 1024 * 1024 * 1024 * 1024)); + } elseif ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 10)) { + $output = sprintf("%5.1fEi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 1024)) { + $output = sprintf("%5.2fEi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 100)) { + $output = sprintf("%5ldPi", $input / (1024 * 1024 * 1024 * 1024 * 1024)); + } elseif ($input >= (1024 * 1024 * 1024 * 1024 * 1024 * 10)) { + $output = sprintf("%5.1fPi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024 * 1024 * 1024 * 1024)) { + $output = sprintf("%5.2fPi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024 * 1024 * 1024 * 100)) { $output = sprintf("%5ldTi", $input / (1024 * 1024 * 1024 * 1024)); - } else if ($input >= (1024 * 1024 * 1024 * 1024 * 10)) { - $output = sprintf("%5.1fTi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 1024 * 1024)) { + } elseif ($input >= (1024 * 1024 * 1024 * 1024 * 10)) { + $output = sprintf("%5.1fTi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024 * 1024 * 1024)) { $output = sprintf("%5.2fTi", $input / (1024.0 * 1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 1024 * 100)) { - $output = sprintf("%5ldGi", $input / (1024 * 1024 * 1024)); - } else if ($input >= (1024 * 1024 * 1024 * 10)) { - $output = sprintf("%5.1fGi", $input / (1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 1024)) { - $output = sprintf("%5.2fGi", $input / (1024.0 * 1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024 * 100)) { + } elseif ($input >= (1024 * 1024 * 1024 * 100)) { + $output = sprintf("%5ldGi", $input / (1024 * 1024 * 1024)); + } elseif ($input >= (1024 * 1024 * 1024 * 10)) { + $output = sprintf("%5.1fGi", $input / (1024.0 * 1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024 * 1024)) { + $output = sprintf("%5.2fGi", $input / (1024.0 * 1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024 * 100)) { $output = sprintf("%5ldMi", $input / (1024 * 1024)); - } else if ($input >= (1024 * 1024 * 10)) { - $output = sprintf("%5.1fM", $input / (1024.0 * 1024.0)); - } else if ($input >= (1024 * 1024)) { - $output = sprintf("%5.2fMi", $input / (1024.0 * 1024.0)); - } else if ($input >= (1024 * 100)) { + } elseif ($input >= (1024 * 1024 * 10)) { + $output = sprintf("%5.1fM", $input / (1024.0 * 1024.0)); + } elseif ($input >= (1024 * 1024)) { + $output = sprintf("%5.2fMi", $input / (1024.0 * 1024.0)); + } elseif ($input >= (1024 * 100)) { $output = sprintf("%5ldKi", $input / 1024); - } else if ($input >= (1024 * 10)) { + } elseif ($input >= (1024 * 10)) { $output = sprintf("%5.1fKi", $input / 1024.0); - } else if ($input >= (1024)) { + } elseif ($input >= (1024)) { $output = sprintf("%5.2fKi", $input / 1024.0); } else { $output = sprintf("%5ld", $input); @@ -72,14 +72,14 @@ $config = \SimpleSAML\Configuration::getInstance(); // Make sure that the user has admin access rights \SimpleSAML\Utils\Auth::requireAdmin(); -$formats = array( +$formats = [ 'bytes' => 'humanreadable', 'bytes_read' => 'humanreadable', 'bytes_written' => 'humanreadable', 'limit_maxbytes' => 'humanreadable', 'time' => 'tdate', 'uptime' => 'hours', -); +]; $statsraw = \SimpleSAML\Memcache::getStats(); @@ -95,7 +95,7 @@ foreach ($stats as $key => &$entry) { } $t = new \SimpleSAML\XHTML\Template($config, 'memcacheMonitor:memcachestat.tpl.php'); -$rowTitles = array( +$rowTitles = [ 'accepting_conns' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:accepting_conns}'), 'auth_cmds' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:auth_cmds}'), 'auth_errors' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:auth_errors}'), @@ -109,7 +109,9 @@ $rowTitles = array( 'cmd_get' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:cmd_get}'), 'cmd_set' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:cmd_set}'), 'cmd_touch' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:cmd_touch}'), - 'connection_structures' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:connection_structures}'), + 'connection_structures' => \SimpleSAML\Locale\Translate::noop( + '{memcacheMonitor:memcachestat:connection_structures}' + ), 'conn_yields' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:conn_yields}'), 'curr_connections' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:curr_connections}'), 'curr_items' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:curr_items}'), @@ -144,10 +146,10 @@ $rowTitles = array( 'touch_misses' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:touch_misses}'), 'uptime' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:uptime}'), 'version' => \SimpleSAML\Locale\Translate::noop('{memcacheMonitor:memcachestat:version}'), -); +]; // Identify column headings -$colTitles = array(); +$colTitles = []; foreach ($stats as $rowTitle => $rowData) { foreach ($rowData as $colTitle => $foo) { if (!in_array($colTitle, $colTitles, true)) { @@ -157,7 +159,7 @@ foreach ($stats as $rowTitle => $rowData) { } if (array_key_exists('bytes', $statsraw) && array_key_exists('limit_maxbytes', $statsraw)) { - $usage = array(); + $usage = []; $maxpix = 400; foreach ($statsraw['bytes'] as $key => $row_data) { $pix = floor($statsraw['bytes'][$key] * $maxpix / $statsraw['limit_maxbytes'][$key]); diff --git a/modules/metarefresh/bin/metarefresh.php b/modules/metarefresh/bin/metarefresh.php index 08a08a0bfd37750bf1d25d421f660fbaf87b7d6f..b02fb75a6a2385eba494f4a41d060e52ff35ce60 100755 --- a/modules/metarefresh/bin/metarefresh.php +++ b/modules/metarefresh/bin/metarefresh.php @@ -45,7 +45,7 @@ $certificates = null; $validateFingerprint = null; // This variable contains the files we will parse -$files = array(); +$files = []; // Parse arguments @@ -71,11 +71,11 @@ foreach ($argv as $a) { } // Map short options to long options - $shortOptMap = array( + $shortOptMap = [ '-h' => '--help', '-o' => '--out-dir', '-s' => '--stdout', - ); + ]; if (array_key_exists($a, $shortOptMap)) { $a = $shortOptMap[$a]; } @@ -127,7 +127,7 @@ if (count($files) === 0) { $metaloader = new \SimpleSAML\Module\metarefresh\MetaLoader(); foreach ($files as $f) { - $source = array('src' => $f); + $source = ['src' => $f]; if (isset($certificates)) { $source['certificates'] = $certificates; } diff --git a/modules/metarefresh/config-templates/config-metarefresh.php b/modules/metarefresh/config-templates/config-metarefresh.php index 978170178fd3388b63687fde928be04688e37944..c8009d4c2756ced568d6507b286e833431040f46 100644 --- a/modules/metarefresh/config-templates/config-metarefresh.php +++ b/modules/metarefresh/config-templates/config-metarefresh.php @@ -1,6 +1,6 @@ <?php -$config = array( +$config = [ /* * Global blacklist: entityIDs that should be excluded from ALL sets. */ @@ -16,12 +16,12 @@ $config = array( */ #'conditionalGET' => true, - 'sets' => array( + 'sets' => [ - 'kalmar' => array( - 'cron' => array('hourly'), - 'sources' => array( - array( + 'kalmar' => [ + 'cron' => ['hourly'], + 'sources' => [ + [ /* * entityIDs that should be excluded from this src. */ @@ -39,17 +39,17 @@ $config = array( #'conditionalGET' => true, 'src' => 'https://kalmar2.org/simplesaml/module.php/aggregator/?id=kalmarcentral&set=saml2&exclude=norway', - 'certificates' => array( + 'certificates' => [ 'current.crt', 'rollover.crt', - ), + ], 'validateFingerprint' => '59:1D:4B:46:70:46:3E:ED:A9:1F:CC:81:6D:C0:AF:2A:09:2A:A8:01', - 'template' => array( - 'tags' => array('kalmar'), - 'authproc' => array( - 51 => array('class' => 'core:AttributeMap', 'oid2name'), - ), - ), + 'template' => [ + 'tags' => ['kalmar'], + 'authproc' => [ + 51 => ['class' => 'core:AttributeMap', 'oid2name'], + ], + ], /* * The sets of entities to load, any combination of: @@ -63,12 +63,12 @@ $config = array( * * This option takes precedence over the same option per metadata set. */ - //'types' => array(), - ), - ), + //'types' => [], + ], + ], 'expireAfter' => 34560060, // Maximum 4 days cache time (3600*24*4) - 'outputDir' => 'metadata/metadata-kalmar-consuming/', + 'outputDir' => 'metadata/metadata-kalmar-consuming/', /* * Which output format the metadata should be saved as. @@ -86,7 +86,7 @@ $config = array( * * All of them will be used by default. */ - //'types' => array(), - ), - ), -); + //'types' => [], + ], + ], +]; diff --git a/modules/metarefresh/hooks/hook_cron.php b/modules/metarefresh/hooks/hook_cron.php index 8feee46ee642405a78d8c1dbf8237c39d97f146a..4ab82e2272d8eaf4fa9ed4b8f7d5016bf8bbbdad 100644 --- a/modules/metarefresh/hooks/hook_cron.php +++ b/modules/metarefresh/hooks/hook_cron.php @@ -1,4 +1,7 @@ <?php + +use \SimpleSAML\Logger; + /** * Hook to run a cron job. * @@ -10,13 +13,13 @@ function metarefresh_hook_cron(&$croninfo) assert(array_key_exists('summary', $croninfo)); assert(array_key_exists('tag', $croninfo)); - SimpleSAML\Logger::info('cron [metarefresh]: Running cron in cron tag ['.$croninfo['tag'].'] '); + Logger::info('cron [metarefresh]: Running cron in cron tag ['.$croninfo['tag'].'] '); try { $config = \SimpleSAML\Configuration::getInstance(); $mconfig = \SimpleSAML\Configuration::getOptionalConfig('config-metarefresh.php'); - $sets = $mconfig->getConfigList('sets', array()); + $sets = $mconfig->getConfigList('sets', []); $stateFile = $config->getPathValue('datadir', 'data/').'metarefresh-state.php'; foreach ($sets as $setkey => $set) { @@ -26,7 +29,7 @@ function metarefresh_hook_cron(&$croninfo) continue; } - \SimpleSAML\Logger::info('cron [metarefresh]: Executing set ['.$setkey.']'); + Logger::info('cron [metarefresh]: Executing set ['.$setkey.']'); $expireAfter = $set->getInteger('expireAfter', null); if ($expireAfter !== null) { @@ -37,32 +40,31 @@ function metarefresh_hook_cron(&$croninfo) $outputDir = $set->getString('outputDir'); $outputDir = $config->resolvePath($outputDir); - $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile'); + $outputFormat = $set->getValueValidate('outputFormat', ['flatfile', 'serialize'], 'flatfile'); - $oldMetadataSrc = \SimpleSAML\Metadata\MetaDataStorageSource::getSource(array( + $oldMetadataSrc = \SimpleSAML\Metadata\MetaDataStorageSource::getSource([ 'type' => $outputFormat, 'directory' => $outputDir, - )); + ]); $metaloader = new \SimpleSAML\Module\metarefresh\MetaLoader($expire, $stateFile, $oldMetadataSrc); // Get global blacklist, whitelist and caching info - $blacklist = $mconfig->getArray('blacklist', array()); - $whitelist = $mconfig->getArray('whitelist', array()); + $blacklist = $mconfig->getArray('blacklist', []); + $whitelist = $mconfig->getArray('whitelist', []); $conditionalGET = $mconfig->getBoolean('conditionalGET', false); // get global type filters - $available_types = array( + $available_types = [ 'saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote', 'attributeauthority-remote' - ); + ]; $set_types = $set->getArrayize('types', $available_types); foreach ($set->getArray('sources') as $source) { - // filter metadata by type of entity if (isset($source['types'])) { $metaloader->setTypes($source['types']); @@ -89,7 +91,7 @@ function metarefresh_hook_cron(&$croninfo) $source['conditionalGET'] = $conditionalGET; } - \SimpleSAML\Logger::debug('cron [metarefresh]: In set ['.$setkey.'] loading source ['.$source['src'].']'); + Logger::debug('cron [metarefresh]: In set ['.$setkey.'] loading source ['.$source['src'].']'); $metaloader->loadSource($source); } diff --git a/modules/metarefresh/hooks/hook_frontpage.php b/modules/metarefresh/hooks/hook_frontpage.php index 9179368393a066a5c12693485d4e741dfe6214b3..e66c583f29758151ea05e792c06f0809340e85e9 100644 --- a/modules/metarefresh/hooks/hook_frontpage.php +++ b/modules/metarefresh/hooks/hook_frontpage.php @@ -10,8 +10,8 @@ function metarefresh_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['federation'][] = array( + $links['federation'][] = [ 'href' => SimpleSAML\Module::getModuleURL('metarefresh/fetch.php'), 'text' => '{metarefresh:metarefresh:frontpage_link}', - ); + ]; } diff --git a/modules/metarefresh/lib/ARP.php b/modules/metarefresh/lib/ARP.php index 00ce469725b061ab9b8b91ae0210d4584b977cfe..c64ff3463f593c0ed0565b578e069eb70e7c43be 100644 --- a/modules/metarefresh/lib/ARP.php +++ b/modules/metarefresh/lib/ARP.php @@ -47,7 +47,7 @@ class ARP $this->loadAttributeMap($attributemap_filename); } } - + /** * @param string $attributemap_filename * diff --git a/modules/metarefresh/lib/MetaLoader.php b/modules/metarefresh/lib/MetaLoader.php index abdc371602e68ed81c2d4658175551a43eda7e8a..b13e8a3c735681205b4b3b598a722ada949dbbc8 100644 --- a/modules/metarefresh/lib/MetaLoader.php +++ b/modules/metarefresh/lib/MetaLoader.php @@ -2,6 +2,8 @@ namespace SimpleSAML\Module\metarefresh; +use SimpleSAML\Logger; + /** * @package SimpleSAMLphp * @author Andreas Ă…kre Solberg <andreas.solberg@uninett.no> @@ -15,13 +17,13 @@ class MetaLoader private $stateFile; private $changed; private $state; - private $types = array( + private $types = [ 'saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote', 'attributeauthority-remote' - ); + ]; /** * Constructor @@ -33,7 +35,7 @@ class MetaLoader public function __construct($expire = null, $stateFile = null, $oldMetadataSrc = null) { $this->expire = $expire; - $this->metadata = array(); + $this->metadata = []; $this->oldMetadataSrc = $oldMetadataSrc; $this->stateFile = $stateFile; $this->changed = false; @@ -43,7 +45,7 @@ class MetaLoader include $stateFile; } - $this->state = array(); + $this->state = []; } /** @@ -65,7 +67,7 @@ class MetaLoader public function setTypes($types) { if (!is_array($types)) { - $types = array($types); + $types = [$types]; } $this->types = $types; } @@ -85,23 +87,23 @@ class MetaLoader try { list($data, $responseHeaders) = \SimpleSAML\Utils\HTTP::fetch($source['src'], $context, true); } catch (\Exception $e) { - \SimpleSAML\Logger::warning('metarefresh: '.$e->getMessage()); + Logger::warning('metarefresh: '.$e->getMessage()); } // We have response headers, so the request succeeded if (!isset($responseHeaders)) { // No response headers, this means the request failed in some way, so re-use old data - \SimpleSAML\Logger::debug('No response from '.$source['src'].' - attempting to re-use cached metadata'); + Logger::debug('No response from '.$source['src'].' - attempting to re-use cached metadata'); $this->addCachedMetadata($source); return; } elseif (preg_match('@^HTTP/1\.[01]\s304\s@', $responseHeaders[0])) { // 304 response - \SimpleSAML\Logger::debug('Received HTTP 304 (Not Modified) - attempting to re-use cached metadata'); + Logger::debug('Received HTTP 304 (Not Modified) - attempting to re-use cached metadata'); $this->addCachedMetadata($source); return; } elseif (!preg_match('@^HTTP/1\.[01]\s200\s@', $responseHeaders[0])) { // Other error - \SimpleSAML\Logger::debug('Error from '.$source['src'].' - attempting to re-use cached metadata'); + Logger::debug('Error from '.$source['src'].' - attempting to re-use cached metadata'); $this->addCachedMetadata($source); return; } @@ -114,37 +116,38 @@ class MetaLoader // Everything OK. Proceed. if (isset($source['conditionalGET']) && $source['conditionalGET']) { // Stale or no metadata, so a fresh copy - \SimpleSAML\Logger::debug('Downloaded fresh copy'); + Logger::debug('Downloaded fresh copy'); } try { $entities = $this->loadXML($data, $source); } catch (\Exception $e) { - \SimpleSAML\Logger::debug('XML parser error when parsing '.$source['src'].' - attempting to re-use cached metadata'); - \SimpleSAML\Logger::debug('XML parser returned: '.$e->getMessage()); + Logger::debug('XML parser error when parsing '.$source['src'].' - attempting to re-use cached metadata'); + Logger::debug('XML parser returned: '.$e->getMessage()); $this->addCachedMetadata($source); return; } foreach ($entities as $entity) { - if (isset($source['blacklist'])) { - if (!empty($source['blacklist']) && in_array($entity->getEntityID(), $source['blacklist'], true)) { - \SimpleSAML\Logger::info('Skipping "'.$entity->getEntityID().'" - blacklisted.'."\n"); + if (!empty($source['blacklist']) && in_array($entity->getEntityId(), $source['blacklist'], true)) { + Logger::info('Skipping "'.$entity->getEntityId().'" - blacklisted.'."\n"); continue; } } if (isset($source['whitelist'])) { - if (!empty($source['whitelist']) && !in_array($entity->getEntityID(), $source['whitelist'], true)) { - \SimpleSAML\Logger::info('Skipping "'.$entity->getEntityID().'" - not in the whitelist.'."\n"); + if (!empty($source['whitelist']) && !in_array($entity->getEntityId(), $source['whitelist'], true)) { + Logger::info('Skipping "'.$entity->getEntityId().'" - not in the whitelist.'."\n"); continue; } } if (array_key_exists('certificates', $source) && $source['certificates'] !== null) { if (!$entity->validateSignature($source['certificates'])) { - \SimpleSAML\Logger::info('Skipping "'.$entity->getEntityId().'" - could not verify signature using certificate.'."\n"); + Logger::info( + 'Skipping "'.$entity->getEntityId().'" - could not verify signature using certificate.'."\n" + ); continue; } } @@ -152,11 +155,13 @@ class MetaLoader if (array_key_exists('validateFingerprint', $source) && $source['validateFingerprint'] !== null) { if (!array_key_exists('certificates', $source) || $source['certificates'] == null) { if (!$entity->validateFingerprint($source['validateFingerprint'])) { - \SimpleSAML\Logger::info('Skipping "'.$entity->getEntityId().'" - could not verify signature using fingerprint.'."\n"); + Logger::info( + 'Skipping "'.$entity->getEntityId().'" - could not verify signature using fingerprint.'."\n" + ); continue; } } else { - \SimpleSAML\Logger::info('Skipping validation with fingerprint since option certificate is set.'."\n"); + Logger::info('Skipping validation with fingerprint since option certificate is set.'."\n"); } } @@ -180,7 +185,12 @@ class MetaLoader if (in_array('attributeauthority-remote', $this->types, true)) { $attributeAuthorities = $entity->getAttributeAuthorities(); if (!empty($attributeAuthorities)) { - $this->addMetadata($source['src'], $attributeAuthorities[0], 'attributeauthority-remote', $template); + $this->addMetadata( + $source['src'], + $attributeAuthorities[0], + 'attributeauthority-remote', + $template + ); } } } @@ -213,7 +223,7 @@ class MetaLoader } } - return array('http' => array('header' => $rawheader)); + return ['http' => ['header' => $rawheader]]; } @@ -241,7 +251,7 @@ class MetaLoader if (isset($source['conditionalGET']) && $source['conditionalGET']) { // Headers section if ($responseHeaders !== null) { - $candidates = array('last-modified', 'etag'); + $candidates = ['last-modified', 'etag']; foreach ($candidates as $candidate) { if (array_key_exists($candidate, $responseHeaders)) { @@ -281,7 +291,7 @@ class MetaLoader public function writeState() { if ($this->changed) { - \SimpleSAML\Logger::debug('Writing: '.$this->stateFile); + Logger::debug('Writing: '.$this->stateFile); \SimpleSAML\Utils\System::writeFile( $this->stateFile, "<?php\n/* This file was generated by the metarefresh module at ".$this->getTime().".\n". @@ -299,7 +309,6 @@ class MetaLoader public function dumpMetadataStdOut() { foreach ($this->metadata as $category => $elements) { - echo '/* The following data should be added to metadata/'.$category.'.php. */'."\n"; foreach ($elements as $m) { @@ -338,7 +347,7 @@ class MetaLoader $metadata['metarefresh:src'] = $filename; if (!array_key_exists($type, $this->metadata)) { - $this->metadata[$type] = array(); + $this->metadata[$type] = []; } // If expire is defined in constructor... @@ -355,7 +364,7 @@ class MetaLoader $metadata['expire'] = $this->expire; } } - $this->metadata[$type][] = array('filename' => $filename, 'metadata' => $metadata); + $this->metadata[$type][] = ['filename' => $filename, 'metadata' => $metadata]; } @@ -367,9 +376,9 @@ class MetaLoader assert($config instanceof \SimpleSAML\Configuration); $arpfile = $config->getValue('arpfile'); - $types = array('saml20-sp-remote'); + $types = ['saml20-sp-remote']; - $md = array(); + $md = []; foreach ($this->metadata as $category => $elements) { if (!in_array($category, $types, true)) { continue; @@ -378,7 +387,8 @@ class MetaLoader } // $metadata, $attributemap, $prefix, $suffix - $arp = new \SimpleSAML\Module\metarefresh\ARP($md, + $arp = new \SimpleSAML\Module\metarefresh\ARP( + $md, $config->getValue('attributemap', ''), $config->getValue('prefix', ''), $config->getValue('suffix', '') @@ -387,7 +397,7 @@ class MetaLoader $arpxml = $arp->getXML(); - \SimpleSAML\Logger::info('Writing ARP file: '.$arpfile."\n"); + Logger::info('Writing ARP file: '.$arpfile."\n"); file_put_contents($arpfile, $arpxml); } @@ -402,7 +412,7 @@ class MetaLoader } if (!file_exists($outputDir)) { - \SimpleSAML\Logger::info('Creating directory: '.$outputDir."\n"); + Logger::info('Creating directory: '.$outputDir."\n"); $res = @mkdir($outputDir, 0777, true); if ($res === false) { throw new \Exception('Error creating directory: '.$outputDir); @@ -414,15 +424,15 @@ class MetaLoader if (array_key_exists($type, $this->metadata)) { $elements = $this->metadata[$type]; - \SimpleSAML\Logger::debug('Writing: '.$filename); + Logger::debug('Writing: '.$filename); - $content = '<?php'."\n".'/* This file was generated by the metarefresh module at '.$this->getTime()."\n"; - $content .= ' Do not update it manually as it will get overwritten'."\n".'*/'."\n"; + $content = '<?php'."\n".'/* This file was generated by the metarefresh module at '; + $content .= $this->getTime()."\nDo not update it manually as it will get overwritten\n".'*/'."\n"; foreach ($elements as $m) { $entityID = $m['metadata']['entityid']; - $content .= "\n"; - $content .= '$metadata[\''.addslashes($entityID).'\'] = '.var_export($m['metadata'], true).';'."\n"; + $content .= "\n".'$metadata[\''. + $content .= addslashes($entityID).'\'] = '.var_export($m['metadata'], true).';'."\n"; } $content .= "\n".'?>'; @@ -430,9 +440,9 @@ class MetaLoader \SimpleSAML\Utils\System::writeFile($filename, $content, 0644); } elseif (is_file($filename)) { if (unlink($filename)) { - \SimpleSAML\Logger::debug('Deleting stale metadata file: '.$filename); + Logger::debug('Deleting stale metadata file: '.$filename); } else { - \SimpleSAML\Logger::warning('Could not delete stale metadata file: '.$filename); + Logger::warning('Could not delete stale metadata file: '.$filename); } } } @@ -448,14 +458,14 @@ class MetaLoader { assert(is_string($outputDir)); - $metaHandler = new \SimpleSAML\Metadata\MetaDataStorageHandlerSerialize(array('directory' => $outputDir)); + $metaHandler = new \SimpleSAML\Metadata\MetaDataStorageHandlerSerialize(['directory' => $outputDir]); // First we add all the metadata entries to the metadata handler foreach ($this->metadata as $set => $elements) { foreach ($elements as $m) { $entityId = $m['metadata']['entityid']; - \SimpleSAML\Logger::debug( + Logger::debug( 'metarefresh: Add metadata entry '. var_export($entityId, true).' in set '.var_export($set, true).'.' ); @@ -468,7 +478,7 @@ class MetaLoader foreach ($metaHandler->getMetadataSets() as $set) { foreach ($metaHandler->getMetadataSet($set) as $entityId => $metadata) { if (!array_key_exists('expire', $metadata)) { - \SimpleSAML\Logger::warning( + Logger::warning( 'metarefresh: Metadata entry without expire timestamp: '.var_export($entityId, true). ' in set '.var_export($set, true).'.' ); @@ -477,10 +487,11 @@ class MetaLoader if ($metadata['expire'] > $ct) { continue; } - \SimpleSAML\Logger::debug('metarefresh: '.$entityId.' expired '.date('l jS \of F Y h:i:s A', $metadata['expire'])); - \SimpleSAML\Logger::debug( + Logger::debug('metarefresh: '.$entityId.' expired '.date('l jS \of F Y h:i:s A', $metadata['expire'])); + Logger::debug( 'metarefresh: Delete expired metadata entry '. - var_export($entityId, true).' in set '.var_export($set, true).'. ('.($ct - $metadata['expire']).' sec)' + var_export($entityId, true).' in set '.var_export($set, true). + '. ('.($ct - $metadata['expire']).' sec)' ); $metaHandler->deleteMetadata($entityId, $set); } diff --git a/modules/metarefresh/templates/fetch.tpl.php b/modules/metarefresh/templates/fetch.tpl.php index 780e98c894c86ca40c45cbddb8c8878c255ce83a..5a988ce74c1b4c3d03c188dc8956890a59a6e8b8 100644 --- a/modules/metarefresh/templates/fetch.tpl.php +++ b/modules/metarefresh/templates/fetch.tpl.php @@ -2,21 +2,16 @@ $this->data['header'] = $this->t('{metarefresh:metarefresh:metarefresh_header}'); $this->includeAtTemplateBase('includes/header.php'); -echo('<h1>'.$this->data['header'].'</h1>'); - +echo '<h1>'.$this->data['header'].'</h1>'; if (!empty($this->data['logentries'])) { - - echo '<pre style="border: 1px solid #aaa; padding: .5em; overflow: scroll">'; - foreach($this->data['logentries'] AS $l) { - echo $l . "\n"; - } - echo '</pre>'; - + echo '<pre style="border: 1px solid #aaa; padding: .5em; overflow: scroll">'; + foreach ($this->data['logentries'] as $l) { + echo $l."\n"; + } + echo '</pre>'; } else { - echo $this->t('{metarefresh:metarefresh:no_output}'); + echo $this->t('{metarefresh:metarefresh:no_output}'); } - - $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/metarefresh/www/fetch.php b/modules/metarefresh/www/fetch.php index 2a1bbc01fe715c83f4cfb1b1c63f1d57f00a3a99..a715886fa035cc9d8f4103c141be87d3bb0e90d6 100644 --- a/modules/metarefresh/www/fetch.php +++ b/modules/metarefresh/www/fetch.php @@ -7,7 +7,7 @@ $mconfig = \SimpleSAML\Configuration::getOptionalConfig('config-metarefresh.php' \SimpleSAML\Logger::setCaptureLog(true); -$sets = $mconfig->getConfigList('sets', array()); +$sets = $mconfig->getConfigList('sets', []); foreach ($sets as $setkey => $set) { \SimpleSAML\Logger::info('[metarefresh]: Executing set ['.$setkey.']'); @@ -22,21 +22,20 @@ foreach ($sets as $setkey => $set) { $metaloader = new \SimpleSAML\Module\metarefresh\MetaLoader($expire); # Get global black/whitelists - $blacklist = $mconfig->getArray('blacklist', array()); - $whitelist = $mconfig->getArray('whitelist', array()); + $blacklist = $mconfig->getArray('blacklist', []); + $whitelist = $mconfig->getArray('whitelist', []); // get global type filters - $available_types = array( + $available_types = [ 'saml20-idp-remote', 'saml20-sp-remote', 'shib13-idp-remote', 'shib13-sp-remote', 'attributeauthority-remote' - ); + ]; $set_types = $set->getArrayize('types', $available_types); foreach ($set->getArray('sources') as $source) { - // filter metadata by type of entity if (isset($source['types'])) { $metaloader->setTypes($source['types']); @@ -65,7 +64,7 @@ foreach ($sets as $setkey => $set) { $outputDir = $set->getString('outputDir'); $outputDir = $config->resolvePath($outputDir); - $outputFormat = $set->getValueValidate('outputFormat', array('flatfile', 'serialize'), 'flatfile'); + $outputFormat = $set->getValueValidate('outputFormat', ['flatfile', 'serialize'], 'flatfile'); switch ($outputFormat) { case 'flatfile': $metaloader->writeMetadataFiles($outputDir); @@ -73,7 +72,7 @@ foreach ($sets as $setkey => $set) { case 'serialize': $metaloader->writeMetadataSerialize($outputDir); break; - } + } } catch (\Exception $e) { $e = \SimpleSAML\Error\Exception::fromException($e); $e->logWarning(); diff --git a/modules/multiauth/lib/Auth/Source/MultiAuth.php b/modules/multiauth/lib/Auth/Source/MultiAuth.php index ae3682f697b90dd6601047db89792d2fe18ff869..4fa78625242794485ee5838a07730674e3b8fd91 100644 --- a/modules/multiauth/lib/Auth/Source/MultiAuth.php +++ b/modules/multiauth/lib/Auth/Source/MultiAuth.php @@ -40,8 +40,8 @@ class MultiAuth extends \SimpleSAML\Auth\Source /** * Constructor for this authentication source. * - * @param array $info Information about this authentication source. - * @param array $config Configuration. + * @param array $info Information about this authentication source. + * @param array $config Configuration. */ public function __construct($info, $config) { @@ -58,18 +58,18 @@ class MultiAuth extends \SimpleSAML\Auth\Source $globalConfiguration = \SimpleSAML\Configuration::getInstance(); $defaultLanguage = $globalConfiguration->getString('language.default', 'en'); $authsources = \SimpleSAML\Configuration::getConfig('authsources.php'); - $this->sources = array(); + $this->sources = []; foreach ($config['sources'] as $source => $info) { if (is_int($source)) { - // Backwards compatibility + // Backwards compatibility $source = $info; - $info = array(); + $info = []; } if (array_key_exists('text', $info)) { $text = $info['text']; } else { - $text = array($defaultLanguage => $source); + $text = [$defaultLanguage => $source]; } if (array_key_exists('help', $info)) { @@ -87,12 +87,12 @@ class MultiAuth extends \SimpleSAML\Auth\Source } } - $this->sources[] = array( + $this->sources[] = [ 'source' => $source, 'text' => $text, 'help' => $help, 'css_class' => $css_class, - ); + ]; } } @@ -106,7 +106,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source * This method never return. The authentication process is finished * in the delegateAuthentication method. * - * @param array &$state Information about the current authentication. + * @param array &$state Information about the current authentication. */ public function authenticate(&$state) { @@ -122,7 +122,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source * saved state array as a parameter to the login form */ $url = \SimpleSAML\Module::getModuleURL('multiauth/selectsource.php'); - $params = array('AuthState' => $id); + $params = ['AuthState' => $id]; // Allowes the user to specify the auth souce to be used if (isset($_GET['source'])) { @@ -143,8 +143,8 @@ class MultiAuth extends \SimpleSAML\Auth\Source * to be able to logout properly. Then it calls the authenticate method * on such selected authentication source. * - * @param string $authId Selected authentication source - * @param array $state Information about the current authentication. + * @param string $authId Selected authentication source + * @param array $state Information about the current authentication. */ public static function delegateAuthentication($authId, $state) { @@ -153,7 +153,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source $as = \SimpleSAML\Auth\Source::getById($authId); $valid_sources = array_map( - function($src) { + function ($src) { return $src['source']; }, $state[self::SOURCESID] @@ -164,7 +164,12 @@ class MultiAuth extends \SimpleSAML\Auth\Source // Save the selected authentication source for the logout process. $session = \SimpleSAML\Session::getSessionFromRequest(); - $session->setData(self::SESSION_SOURCE, $state[self::AUTHID], $authId, \SimpleSAML\Session::DATA_TIMEOUT_SESSION_END); + $session->setData( + self::SESSION_SOURCE, + $state[self::AUTHID], + $authId, + \SimpleSAML\Session::DATA_TIMEOUT_SESSION_END + ); try { $as->authenticate($state); @@ -183,7 +188,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source * This method retrieves the authentication source used for this * session and then call the logout method on it. * - * @param array &$state Information about the current logout operation. + * @param array &$state Information about the current logout operation. */ public function logout(&$state) { @@ -216,13 +221,13 @@ class MultiAuth extends \SimpleSAML\Auth\Source $cookieName = 'multiauth_source_'.$this->authId; $config = \SimpleSAML\Configuration::getInstance(); - $params = array( + $params = [ // We save the cookies for 90 days 'lifetime' => 7776000, //60*60*24*90 // The base path for cookies. This should be the installation directory for SimpleSAMLphp. 'path' => $config->getBasePath(), 'httponly' => false, - ); + ]; \SimpleSAML\Utils\HTTP::setCookie($cookieName, $source, $params, false); } diff --git a/modules/multiauth/templates/selectsource.twig b/modules/multiauth/templates/selectsource.twig index d308d457afa092088005cea3e90f8199ac811efd..5d1e3793e93dc82d3752390d1ab24013aa6d560b 100644 --- a/modules/multiauth/templates/selectsource.twig +++ b/modules/multiauth/templates/selectsource.twig @@ -6,17 +6,13 @@ <p>{{ '{multiauth:multiauth:select_source_text}'| trans }}</p> <form action="{{ selfUrl|escape('html') }}" method="get"> - <input type="hidden" name="AuthState" value="{{ authstate|escape('html') }} " /> + <input type="hidden" name="AuthState" value="{{ authstate|escape('html') }} "> <ul> {% for key, source in sources %} {% set name = ('src-' ~ source.source64) %} {% set button = ('button-' ~ source.source) %} <li class="{{ source.css_class|escape('html') }} authsource"> - {% if source.source == preferred %} - <input type="submit" name="{{ name|escape('html') }}" autofocus="autofocus" id="{{ button|escape('html') }}" value="{{ source.text|escape('html') }}" /> - {% else %} - <input type="submit" name="{{ name|escape('html') }}" id="{{ button|escape('html') }}" value="{{ source.text|escape('html') }}" /> - {% endif %} + <input type="submit" name="{{ name|escape('html') }}" id="{{ button|escape('html') }}" value="{{ source.text|escape('html') }}"{%- if source.source == preferred %} autofocus{% endif -%}> {% if source.help %} <p>{{ source.help|escape('html') }}</p> {% endif %} diff --git a/modules/multiauth/www/selectsource.php b/modules/multiauth/www/selectsource.php index 70c889d8a5646912ea17c0e2ebfcc647bb347167..287f7808eab880abd9749df3e665f90f4b836fac 100644 --- a/modules/multiauth/www/selectsource.php +++ b/modules/multiauth/www/selectsource.php @@ -56,8 +56,17 @@ $language = $t->getTranslator()->getLanguage()->getLanguage(); $sources = $state[\SimpleSAML\Module\multiauth\Auth\Source\MultiAuth::SOURCESID]; foreach ($sources as $key => $source) { $sources[$key]['source64'] = base64_encode($sources[$key]['source']); - $sources[$key]['text'] = (isset($sources[$key]['text'][$language]) ? $sources[$key]['text'][$language] : $sources[$key]['text'][$defaultLanguage]); - $sources[$key]['help'] = (isset($sources[$key]['help'][$language]) ? $sources[$key]['help'][$language] : $sources[$key]['help'][$defaultLanguage]); + if (isset($sources[$key]['text'][$language])) { + $sources[$key]['text'] = $sources[$key]['text'][$language]; + } else { + $sources[$key]['text'] = $sources[$key]['text'][$defaultLanguage]; + } + + if (isset($sources[$key]['help'][$language])) { + $sources[$key]['help'] = $sources[$key]['help'][$language]; + } else { + $sources[$key]['help'] = $sources[$key]['help'][$defaultLanguage]; + } } $t->data['authstate'] = $authStateId; diff --git a/modules/negotiate/lib/Auth/Source/Negotiate.php b/modules/negotiate/lib/Auth/Source/Negotiate.php index ed9b8c5e81adfe5b4dbbd04d8621fb0bf3a8daf9..21601452f408a68ff26b1f973dda20cbbf3141e6 100644 --- a/modules/negotiate/lib/Auth/Source/Negotiate.php +++ b/modules/negotiate/lib/Auth/Source/Negotiate.php @@ -2,6 +2,8 @@ namespace SimpleSAML\Module\negotiate\Auth\Source; +use \SimpleSAML\Logger; + /** * The Negotiate module. Allows for password-less, secure login by Kerberos and Negotiate. * @@ -23,8 +25,8 @@ class Negotiate extends \SimpleSAML\Auth\Source protected $debugLDAP = false; protected $timeout = 30; protected $keytab = ''; - protected $base = array(); - protected $attr = 'uid'; + protected $base = []; + protected $attr = ['uid']; protected $subnet = null; protected $admin_user = null; protected $admin_pw = null; @@ -60,9 +62,9 @@ class Negotiate extends \SimpleSAML\Auth\Source $this->enableTLS = $config->getBoolean('enable_tls', false); $this->debugLDAP = $config->getBoolean('debugLDAP', false); $this->timeout = $config->getInteger('timeout', 30); - $this->keytab = $config->getString('keytab'); + $this->keytab = \SimpleSAML\Utils\Config::getCertPath($config->getString('keytab')); $this->base = $config->getArrayizeString('base'); - $this->attr = $config->getString('attr', 'uid'); + $this->attr = $config->getArrayizeString('attr', 'uid'); $this->subnet = $config->getArray('subnet', null); $this->admin_user = $config->getString('adminUser', null); $this->admin_pw = $config->getString('adminPassword', null); @@ -86,9 +88,9 @@ class Negotiate extends \SimpleSAML\Auth\Source assert(is_array($state)); // set the default backend to config - $state['LogoutState'] = array( + $state['LogoutState'] = [ 'negotiate:backend' => $this->backend, - ); + ]; $state['negotiate:authId'] = $this->authId; @@ -105,7 +107,7 @@ class Negotiate extends \SimpleSAML\Auth\Source (!empty($_COOKIE['NEGOTIATE_AUTOLOGIN_DISABLE_PERMANENT']) && $_COOKIE['NEGOTIATE_AUTOLOGIN_DISABLE_PERMANENT'] == 'True') ) { - \SimpleSAML\Logger::debug('Negotiate - session disabled. falling back'); + Logger::debug('Negotiate - session disabled. falling back'); $this->fallBack($state); // never executed assert(false); @@ -117,9 +119,9 @@ class Negotiate extends \SimpleSAML\Auth\Source assert(false); } - \SimpleSAML\Logger::debug('Negotiate - authenticate(): looking for Negotiate'); + Logger::debug('Negotiate - authenticate(): looking for Negotiate'); if (!empty($_SERVER['HTTP_AUTHORIZATION'])) { - \SimpleSAML\Logger::debug('Negotiate - authenticate(): Negotiate found'); + Logger::debug('Negotiate - authenticate(): Negotiate found'); $this->ldap = new \SimpleSAML\Auth\LDAP( $this->hostname, $this->enableTLS, @@ -131,10 +133,10 @@ class Negotiate extends \SimpleSAML\Auth\Source list($mech,) = explode(' ', $_SERVER['HTTP_AUTHORIZATION'], 2); if (strtolower($mech) == 'basic') { - \SimpleSAML\Logger::debug('Negotiate - authenticate(): Basic found. Skipping.'); + Logger::debug('Negotiate - authenticate(): Basic found. Skipping.'); } else { if (strtolower($mech) != 'negotiate') { - \SimpleSAML\Logger::debug('Negotiate - authenticate(): No "Negotiate" found. Skipping.'); + Logger::debug('Negotiate - authenticate(): No "Negotiate" found. Skipping.'); } } @@ -143,46 +145,45 @@ class Negotiate extends \SimpleSAML\Auth\Source try { $reply = $auth->doAuthentication(); } catch (\Exception $e) { - \SimpleSAML\Logger::error('Negotiate - authenticate(): doAuthentication() exception: '.$e->getMessage()); + Logger::error('Negotiate - authenticate(): doAuthentication() exception: '.$e->getMessage()); $reply = null; } if ($reply) { // success! krb TGS received $user = $auth->getAuthenticatedUser(); - \SimpleSAML\Logger::info('Negotiate - authenticate(): '.$user.' authenticated.'); + Logger::info('Negotiate - authenticate(): '.$user.' authenticated.'); $lookup = $this->lookupUserData($user); if ($lookup !== null) { $state['Attributes'] = $lookup; // Override the backend so logout will know what to look for - $state['LogoutState'] = array( + $state['LogoutState'] = [ 'negotiate:backend' => null, - ); - \SimpleSAML\Logger::info('Negotiate - authenticate(): '.$user.' authorized.'); + ]; + Logger::info('Negotiate - authenticate(): '.$user.' authorized.'); \SimpleSAML\Auth\Source::completeAuth($state); // Never reached. assert(false); } } else { // Some error in the received ticket. Expired? - \SimpleSAML\Logger::info('Negotiate - authenticate(): Kerberos authN failed. Skipping.'); + Logger::info('Negotiate - authenticate(): Kerberos authN failed. Skipping.'); } } else { // No auth token. Send it. - \SimpleSAML\Logger::debug('Negotiate - authenticate(): Sending Negotiate.'); + Logger::debug('Negotiate - authenticate(): Sending Negotiate.'); // Save the $state array, so that we can restore if after a redirect - \SimpleSAML\Logger::debug('Negotiate - fallback: '.$state['LogoutState']['negotiate:backend']); + Logger::debug('Negotiate - fallback: '.$state['LogoutState']['negotiate:backend']); $id = \SimpleSAML\Auth\State::saveState($state, self::STAGEID); - $params = array('AuthState' => $id); + $params = ['AuthState' => $id]; $this->sendNegotiate($params); exit; } - \SimpleSAML\Logger::info('Negotiate - authenticate(): Client failed Negotiate. Falling back'); + Logger::info('Negotiate - authenticate(): Client failed Negotiate. Falling back'); $this->fallBack($state); - /* The previous function never returns, so this code is never - executed */ + // The previous function never returns, so this code is never executed assert(false); } @@ -191,13 +192,13 @@ class Negotiate extends \SimpleSAML\Auth\Source { if (array_key_exists('negotiate:disable', $spMetadata)) { if ($spMetadata['negotiate:disable'] == true) { - \SimpleSAML\Logger::debug('Negotiate - SP disabled. falling back'); + Logger::debug('Negotiate - SP disabled. falling back'); return true; } else { - \SimpleSAML\Logger::debug('Negotiate - SP disable flag found but set to FALSE'); + Logger::debug('Negotiate - SP disable flag found but set to FALSE'); } } else { - \SimpleSAML\Logger::debug('Negotiate - SP disable flag not found'); + Logger::debug('Negotiate - SP disable flag not found'); } return false; } @@ -221,11 +222,11 @@ class Negotiate extends \SimpleSAML\Auth\Source foreach ($this->subnet as $cidr) { $ret = \SimpleSAML\Utils\Net::ipCIDRcheck($cidr); if ($ret) { - \SimpleSAML\Logger::debug('Negotiate: Client "'.$ip.'" matched subnet.'); + Logger::debug('Negotiate: Client "'.$ip.'" matched subnet.'); return true; } } - \SimpleSAML\Logger::debug('Negotiate: Client "'.$ip.'" did not match subnet.'); + Logger::debug('Negotiate: Client "'.$ip.'" did not match subnet.'); return false; } @@ -238,22 +239,19 @@ class Negotiate extends \SimpleSAML\Auth\Source */ protected function sendNegotiate($params) { + $config = \SimpleSAML\Configuration::getInstance(); + $url = htmlspecialchars(\SimpleSAML\Module::getModuleURL('negotiate/backend.php', $params)); $json_url = json_encode($url); header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: Negotiate', false); - echo <<<EOF -<html> - <head> - <script type="text/javascript">window.location = $json_url</script> - <title>Redirect to login</title> - </head> -<body> - <p>Your browser seems to have Javascript disabled. Please click <a href="$url">here</a>.</p> -</body> -</html> -EOF; + + $t = new \SimpleSAML\XHTML\Template($config, 'negotiate:redirect.twig'); + $t->data['baseurlpath'] = \SimpleSAML\Module::getModuleURL('negotiate'); + $t->data['url'] = $url; + $t->data['json_url'] = $json_url; + $t->show(); } @@ -271,7 +269,7 @@ EOF; $authId = $state['LogoutState']['negotiate:backend']; if ($authId === null) { - throw new \SimpleSAML\Error\Error(array(500, "Unable to determine auth source.")); + throw new \SimpleSAML\Error\Error([500, "Unable to determine auth source."]); } $source = \SimpleSAML\Auth\Source::getById($authId); @@ -284,7 +282,7 @@ EOF; \SimpleSAML\Auth\State::throwException($state, $e); } // fallBack never returns after loginCompleted() - \SimpleSAML\Logger::debug('Negotiate: backend returned'); + Logger::debug('Negotiate: backend returned'); self::loginCompleted($state); } @@ -311,7 +309,7 @@ EOF; $dn = $this->ldap->searchfordn($this->base, $this->attr, $uid); return $this->ldap->getAttributes($dn, $this->attributes); } catch (\SimpleSAML\Error\Exception $e) { - \SimpleSAML\Logger::debug('Negotiate - ldap lookup failed: '.$e); + Logger::debug('Negotiate - ldap lookup failed: '.$e); return null; } } @@ -327,13 +325,11 @@ EOF; // no admin user return; } - \SimpleSAML\Logger::debug( - 'Negotiate - authenticate(): Binding as system user '.var_export($this->admin_user, true) - ); + Logger::debug('Negotiate - authenticate(): Binding as system user '.var_export($this->admin_user, true)); if (!$this->ldap->bind($this->admin_user, $this->admin_pw)) { $msg = 'Unable to authenticate system user (LDAP_INVALID_CREDENTIALS) '.var_export($this->admin_user, true); - \SimpleSAML\Logger::error('Negotiate - authenticate(): '.$msg); + Logger::error('Negotiate - authenticate(): '.$msg); throw new \SimpleSAML\Error\AuthSource('negotiate', $msg); } } @@ -352,7 +348,7 @@ EOF; assert(is_array($state)); // get the source that was used to authenticate $authId = $state['negotiate:backend']; - \SimpleSAML\Logger::debug('Negotiate - logout has the following authId: "'.$authId.'"'); + Logger::debug('Negotiate - logout has the following authId: "'.$authId.'"'); if ($authId === null) { $session = \SimpleSAML\Session::getSessionFromRequest(); diff --git a/modules/negotiate/templates/disable.php b/modules/negotiate/templates/disable.php index f9e2d55082eebd2a5e4efe9c84eecaebb1833a09..fd8338e9f49265f8a80830aeb5d033bf69c4a6f4 100644 --- a/modules/negotiate/templates/disable.php +++ b/modules/negotiate/templates/disable.php @@ -10,7 +10,7 @@ $this->includeAtTemplateBase('includes/header.php'); ?> <h1><?php echo $this->t('{negotiate:negotiate:disable_title}'); ?></h1> -<?php echo $this->t('{negotiate:negotiate:disable_info_pre}', array('URL' => htmlspecialchars($this->data['url']))); ?> +<?php echo $this->t('{negotiate:negotiate:disable_info_pre}', ['URL' => htmlspecialchars($this->data['url'])]); ?> <?php echo $this->t('{negotiate:negotiate:info_post}'); ?> diff --git a/modules/negotiate/templates/enable.php b/modules/negotiate/templates/enable.php index 939af6fb6d828aedd6d178970fa803e064cc099a..a25b6a213b414cfe8c7348d41c13d168fffa412f 100644 --- a/modules/negotiate/templates/enable.php +++ b/modules/negotiate/templates/enable.php @@ -11,7 +11,7 @@ $this->includeAtTemplateBase('includes/header.php'); ?> <h1><?php echo $this->t('{negotiate:negotiate:enable_title}'); ?></h1> -<?php echo $this->t('{negotiate:negotiate:enable_info_pre}', array('URL' => htmlspecialchars($this->data['url']))); ?> +<?php echo $this->t('{negotiate:negotiate:enable_info_pre}', ['URL' => htmlspecialchars($this->data['url'])]); ?> <?php echo $this->t('{negotiate:negotiate:info_post}'); ?> diff --git a/modules/negotiate/templates/redirect.twig b/modules/negotiate/templates/redirect.twig new file mode 100644 index 0000000000000000000000000000000000000000..3a69556eec3127cc60c5dec5ab09fac27d970857 --- /dev/null +++ b/modules/negotiate/templates/redirect.twig @@ -0,0 +1,11 @@ +<!DOCTYPE HTML> +<html lang="en-US"> + <head> + <script src="{{ baseurlpath }}/assets/js/redirect.js"></script> + <title>Redirect to login</title> + </head> + <body> + <p>Your browser seems to have Javascript disabled. Please click <a id="redirect" href="{{ url }}">here</a>.</p> + </body> +</html> + diff --git a/modules/negotiate/www/assets/js/redirect.js b/modules/negotiate/www/assets/js/redirect.js new file mode 100644 index 0000000000000000000000000000000000000000..3b829d111db9ff4fbbb28f36c7ccb8dc87ce0277 --- /dev/null +++ b/modules/negotiate/www/assets/js/redirect.js @@ -0,0 +1,3 @@ +document.addEventListener('DOMContentLoaded', function () { + window.location = document.querySelector('#redirect'); +}); diff --git a/modules/negotiate/www/backend.php b/modules/negotiate/www/backend.php index 07550c9e07337cc1d9cc2aef6bfd5c0aa47f0bdc..8a5222f26dd378995e108b38105ce3fb445615c8 100644 --- a/modules/negotiate/www/backend.php +++ b/modules/negotiate/www/backend.php @@ -8,7 +8,10 @@ * @package SimpleSAMLphp */ -$state = \SimpleSAML\Auth\State::loadState($_REQUEST['AuthState'], \SimpleSAML\Module\negotiate\Auth\Source\Negotiate::STAGEID); +$state = \SimpleSAML\Auth\State::loadState( + $_REQUEST['AuthState'], + \SimpleSAML\Module\negotiate\Auth\Source\Negotiate::STAGEID +); \SimpleSAML\Logger::debug('backend - fallback: '.$state['LogoutState']['negotiate:backend']); \SimpleSAML\Module\negotiate\Auth\Source\Negotiate::fallBack($state); diff --git a/modules/negotiate/www/disable.php b/modules/negotiate/www/disable.php index 1832f4a3238e307687eff4215b5aca4b8224d651..2734f05c31a7bbb9214a3ecf0965a3f74128aac4 100644 --- a/modules/negotiate/www/disable.php +++ b/modules/negotiate/www/disable.php @@ -5,11 +5,11 @@ * @package SimpleSAMLphp */ -$params = array( +$params = [ 'expire' => (mktime(0, 0, 0, 1, 1, 2038)), 'secure' => false, 'httponly' => true, -); +]; \SimpleSAML\Utils\HTTP::setCookie('NEGOTIATE_AUTOLOGIN_DISABLE_PERMANENT', 'True', $params, false); $globalConfig = \SimpleSAML\Configuration::getInstance(); diff --git a/modules/negotiate/www/enable.php b/modules/negotiate/www/enable.php index 891eac6d738a3a365411368e389274a267c2b40b..be52928db4be463d68b030e0cf07d0fbb8a8a26c 100644 --- a/modules/negotiate/www/enable.php +++ b/modules/negotiate/www/enable.php @@ -5,10 +5,10 @@ * @package SimpleSAMLphp */ -$params = array( +$params = [ 'secure' => false, 'httponly' => true, -); +]; \SimpleSAML\Utils\HTTP::setCookie('NEGOTIATE_AUTOLOGIN_DISABLE_PERMANENT', null, $params, false); $globalConfig = \SimpleSAML\Configuration::getInstance(); diff --git a/modules/negotiate/www/retry.php b/modules/negotiate/www/retry.php index 390e712e42b339774fe719f29c5c658e2833522b..c4ffd87a52ee21a5553fcb6d5277f5a2066c1bbf 100644 --- a/modules/negotiate/www/retry.php +++ b/modules/negotiate/www/retry.php @@ -8,7 +8,10 @@ * */ -$state = \SimpleSAML\Auth\State::loadState($_REQUEST['AuthState'], \SimpleSAML\Module\negotiate\Auth\Source\Negotiate::STAGEID); +$state = \SimpleSAML\Auth\State::loadState( + $_REQUEST['AuthState'], + \SimpleSAML\Module\negotiate\Auth\Source\Negotiate::STAGEID +); $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); $idpid = $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted', 'metaindex'); diff --git a/modules/oauth/config-template/module_oauth.php b/modules/oauth/config-template/module_oauth.php index a99f2acf121553267045dedf33ee739d66f1521a..63327d6be9a83f009b69908ec944ac9f025feb31 100644 --- a/modules/oauth/config-template/module_oauth.php +++ b/modules/oauth/config-template/module_oauth.php @@ -1,10 +1,10 @@ <?php -/* +/* * Configuration for the OAuth module. - * + * */ -$config = array( +$config = [ /* Enable the getUserInfo endpoint. Do not enable unless you know what you do. * It may give external parties access to userInfo unless properly secured. */ @@ -17,8 +17,8 @@ $config = array( // Tag to run storage cleanup script using the cron module... 'cron_tag' => 'hourly', - // auth is the idp to use for admin authentication, + // auth is the idp to use for admin authentication, // useridattr is the attribute-name that contains the userid as returned from idp 'auth' => 'default-sp', 'useridattr', 'user', -); +]; diff --git a/modules/oauth/hooks/hook_frontpage.php b/modules/oauth/hooks/hook_frontpage.php index 23ebb76d541025c90d8ea91b8c7c9fa18abbcbb9..028e11c85d0750157741bb07f5b5cffe20ca6cbf 100644 --- a/modules/oauth/hooks/hook_frontpage.php +++ b/modules/oauth/hooks/hook_frontpage.php @@ -9,8 +9,8 @@ function oauth_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['federation']['oauthregistry'] = array( + $links['federation']['oauthregistry'] = [ 'href' => SimpleSAML\Module::getModuleURL('oauth/registry.php'), 'text' => '{core:frontpage:link_oauth}', - ); + ]; } diff --git a/modules/oauth/lib/Consumer.php b/modules/oauth/lib/Consumer.php index 43642f49ffef0b41d4634b82341054a74bd599ac..b3a4080ae6c384a48b3971fcc51c9354d1ac5f4d 100644 --- a/modules/oauth/lib/Consumer.php +++ b/modules/oauth/lib/Consumer.php @@ -51,9 +51,9 @@ class Consumer * This static helper function wraps \SimpleSAML\Utils\HTTP::fetch * and throws an exception with diagnostics messages if it appear * to be failing on an OAuth endpoint. - * + * * If the status code is not 200, an exception is thrown. If the content-type - * of the response if text/plain, the content of the response is included in + * of the response if text/plain, the content of the response is included in * the text of the Exception thrown. */ public static function getHTTP($url, $context = '') @@ -74,7 +74,7 @@ class Consumer } throw new \Exception($error.':'.$url); - } + } // Fall back to return response, if could not reckognize HTTP header. Should not happen. return $response; } @@ -103,7 +103,7 @@ class Consumer public function getAuthorizeRequest($url, $requestToken, $redirect = true, $callback = null) { - $params = array('oauth_token' => $requestToken->key); + $params = ['oauth_token' => $requestToken->key]; if ($callback) { $params['oauth_callback'] = $callback; } @@ -111,7 +111,7 @@ class Consumer if ($redirect) { \SimpleSAML\Utils\HTTP::redirectTrustedURL($authorizeURL); exit; - } + } return $authorizeURL; } @@ -146,18 +146,18 @@ class Consumer $data_req->sign_request($this->signer, $this->consumer, $accessToken); $postdata = $data_req->to_postdata(); - $opts = array( - 'ssl' => array( + $opts = [ + 'ssl' => [ 'verify_peer' => false, 'capture_peer_cert' => true, 'capture_peer_chain' => true - ), - 'http' => array( + ], + 'http' => [ 'method' => 'POST', 'content' => $postdata, 'header' => 'Content-Type: application/x-www-form-urlencoded', - ), - ); + ], + ]; try { $response = \SimpleSAML\Utils\HTTP::fetch($url, $opts); @@ -172,9 +172,6 @@ class Consumer $data_req = \OAuthRequest::from_consumer_and_token($this->consumer, $accessToken, "GET", $url, null); $data_req->sign_request($this->signer, $this->consumer, $accessToken); - if (is_array($opts)) { - $opts = stream_context_create($opts); - } $data = \SimpleSAML\Utils\HTTP::fetch($data_req->to_url(), $opts); return json_decode($data, true); diff --git a/modules/oauth/lib/OAuthServer.php b/modules/oauth/lib/OAuthServer.php index 5114fff1ff0ddca40b849e6cde55a75a8377c471..b6607e6feb6bfeb4372dd1c50462295f6325821d 100644 --- a/modules/oauth/lib/OAuthServer.php +++ b/modules/oauth/lib/OAuthServer.php @@ -23,4 +23,3 @@ class OAuthServer extends OAuthServer return $this->signature_methods; } } - diff --git a/modules/oauth/lib/OAuthStore.php b/modules/oauth/lib/OAuthStore.php index 5469dab2d3bfa0d114fceddf926ee49ad4666bf2..b0c9d222dd5176dd343878a774309676bf03eb2c 100644 --- a/modules/oauth/lib/OAuthStore.php +++ b/modules/oauth/lib/OAuthStore.php @@ -6,8 +6,8 @@ require_once(dirname(dirname(__FILE__)).'/libextinc/OAuth.php'); /** * OAuth Store - * - * Updated version, works with consumer-callbacks, certificates and 1.0-RevA protocol + * + * Updated version, works with consumer-callbacks, certificates and 1.0-RevA protocol * behaviour (requestToken-callbacks and verifiers) * * @author Andreas Ă…kre Solberg, <andreas.solberg@uninett.no>, UNINETT AS. @@ -21,14 +21,14 @@ class OAuthStore extends \OAuthDataStore private $config; private $defaultversion = '1.0'; - protected $_store_tables = array( - 'consumers' => 'consumer = array with consumer attributes', + protected $_store_tables = [ + 'consumers' => 'consumer = array with consumer attributes', 'nonce' => 'nonce+consumer_key = -boolean-', 'requesttorequest' => 'requestToken.key = array(version,callback,consumerKey,)', 'authorized' => 'requestToken.key, verifier = array(authenticated-user-attributes)', 'access' => 'accessToken.key+consumerKey = accesstoken', 'request' => 'requestToken.key+consumerKey = requesttoken', - ); + ]; public function __construct() @@ -66,11 +66,11 @@ class OAuthStore extends \OAuthDataStore } $verifier = \SimpleSAML\Utils\Random::generateID(); - $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, array("oauth_verifier"=>$verifier)); + $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, ["oauth_verifier"=>$verifier]); $this->store->set('authorized', $requestTokenKey, $verifier, $data, $this->config->getValue('requestTokenDuration', 1800)); //60*30=1800 - return array($url, $verifier); + return [$url, $verifier]; } /** @@ -153,21 +153,23 @@ class OAuthStore extends \OAuthDataStore { \SimpleSAML\Logger::info('OAuth new_request_token('.$consumer.')'); - $lifetime = $this->config->getValue('requestTokenDuration', 1800); //60*30 + $lifetime = $this->config->getValue('requestTokenDuration', 1800); //60*30 $token = new \OAuthToken(\SimpleSAML\Utils\Random::generateID(), \SimpleSAML\Utils\Random::generateID()); $token->callback = $callback; // OAuth1.0-RevA $this->store->set('request', $token->key, $consumer->key, $token, $lifetime); // also store in requestToken->key => array('callback'=>CallbackURL, 'version'=>oauth_version - $request_attributes = array( - 'callback' => $callback, + $request_attributes = [ + 'callback' => $callback, 'version' => ($version ? $version : $this->defaultversion), 'consumerKey' => $consumer->key, - ); + ]; $this->store->set('requesttorequest', $token->key, '', $request_attributes, $lifetime); - // also store in requestToken->key => Consumer->key (enables consumer-lookup during reqToken-authorization stage) + /* also store in requestToken->key => + * Consumer->key (enables consumer-lookup during reqToken-authorization stage) + */ $this->store->set('requesttoconsumer', $token->key, '', $consumer->key, $lifetime); return $token; @@ -177,7 +179,13 @@ class OAuthStore extends \OAuthDataStore { \SimpleSAML\Logger::info('OAuth new_access_token('.$requestToken.','.$consumer.')'); $accesstoken = new \OAuthToken(\SimpleSAML\Utils\Random::generateID(), \SimpleSAML\Utils\Random::generateID()); - $this->store->set('access', $accesstoken->key, $consumer->key, $accesstoken, $this->config->getValue('accessTokenDuration', 86400)); //60*60*24=86400 + $this->store->set( + 'access', + $accesstoken->key, + $consumer->key, + $accesstoken, + $this->config->getValue('accessTokenDuration', 86400) //60*60*24=86400 + ); return $accesstoken; } diff --git a/modules/oauth/lib/Registry.php b/modules/oauth/lib/Registry.php index aea40cc86af0493e27c0389ced974b84ae71332e..0ff3b5105fed72f94ca1d3d13fa210d488ed73c0 100644 --- a/modules/oauth/lib/Registry.php +++ b/modules/oauth/lib/Registry.php @@ -15,12 +15,12 @@ class Registry { if (array_key_exists('field_'.$key, $request)) { $entry[$key] = $request['field_'.$key]; - } else if (isset($entry[$key])) { + } elseif (isset($entry[$key])) { unset($entry[$key]); } } - public function formToMeta($request, $entry = array(), $override = null) + public function formToMeta($request, $entry = [], $override = null) { $this->getStandardField($request, $entry, 'name'); $this->getStandardField($request, $entry, 'description'); @@ -53,7 +53,7 @@ class Registry $this->requireStandardField($request, 'description'); $this->requireStandardField($request, 'key'); } - + protected function header($name) { return '<tr><td> </td><td class="header">'.$name.'</td></tr>'; @@ -124,7 +124,12 @@ class Registry $this->readonlyField($metadata, 'owner', 'Owner'). $this->standardField($metadata, 'key', 'Consumer Key'). $this->readonlyField($metadata, 'secret', 'Consumer Secret<br />(Used for HMAC_SHA1 signatures)'). - $this->standardField($metadata, 'RSAcertificate', 'RSA certificate (PEM)<br />(Used for RSA_SHA1 signatures)', true). + $this->standardField( + $metadata, + 'RSAcertificate', + 'RSA certificate (PEM)<br />(Used for RSA_SHA1 signatures)', + true + ). $this->standardField($metadata, 'callback_url', 'Static/enforcing callback-url'). '</table></div>'. '</div>'. diff --git a/modules/oauth/libextinc/OAuth.php b/modules/oauth/libextinc/OAuth.php index 7ea0d8dfe4fcf0ba74082b707849564ebe885adf..c8811d6ce1263032e6fe32c9227546a5014ad945 100644 --- a/modules/oauth/libextinc/OAuth.php +++ b/modules/oauth/libextinc/OAuth.php @@ -148,10 +148,10 @@ class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod $base_string = $request->get_signature_base_string(); $request->base_string = $base_string; - $key_parts = array( + $key_parts = [ $consumer->secret, ($token) ? $token->secret : "" - ); + ]; $key_parts = OAuthUtil::urlencode_rfc3986($key_parts); $key = implode('&', $key_parts); @@ -183,10 +183,10 @@ class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod */ public function build_signature($request, $consumer, $token) { - $key_parts = array( + $key_parts = [ $consumer->secret, ($token) ? $token->secret : "" - ); + ]; $key_parts = OAuthUtil::urlencode_rfc3986($key_parts); $key = implode('&', $key_parts); @@ -279,7 +279,7 @@ class OAuthRequest public function __construct($http_method, $http_url, $parameters = null) { - $parameters = ($parameters) ? $parameters : array(); + $parameters = ($parameters) ? $parameters : []; $parameters = array_merge(OAuthUtil::parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters); $this->parameters = $parameters; $this->http_method = $http_method; @@ -316,9 +316,8 @@ class OAuthRequest // It's a POST request of the proper content-type, so parse POST // parameters and add those overriding any duplicates from GET if ($http_method == "POST" - && isset($request_headers['Content-Type']) - && strstr($request_headers['Content-Type'], - 'application/x-www-form-urlencoded') + && isset($request_headers['Content-Type']) + && strstr($request_headers['Content-Type'], 'application/x-www-form-urlencoded') ) { $post_data = OAuthUtil::parse_parameters( file_get_contents(self::$POST_INPUT) @@ -328,13 +327,14 @@ class OAuthRequest // We have a Authorization-header with OAuth data. Parse the header // and add those overriding any duplicates from GET or POST - if (isset($request_headers['Authorization']) && substr($request_headers['Authorization'], 0, 6) == 'OAuth ') { + if (isset($request_headers['Authorization']) + && substr($request_headers['Authorization'], 0, 6) == 'OAuth ' + ) { $header_parameters = OAuthUtil::split_header( $request_headers['Authorization'] ); $parameters = array_merge($parameters, $header_parameters); } - } return new OAuthRequest($http_method, $http_url, $parameters); @@ -345,11 +345,11 @@ class OAuthRequest */ public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters = null) { - $parameters = ($parameters) ? $parameters : array(); - $defaults = array("oauth_version" => OAuthRequest::$version, + $parameters = ($parameters) ? $parameters : []; + $defaults = ["oauth_version" => OAuthRequest::$version, "oauth_nonce" => OAuthRequest::generate_nonce(), "oauth_timestamp" => OAuthRequest::generate_timestamp(), - "oauth_consumer_key" => $consumer->key); + "oauth_consumer_key" => $consumer->key]; if ($token) { $defaults['oauth_token'] = $token->key; } @@ -366,7 +366,7 @@ class OAuthRequest if (is_scalar($this->parameters[$name])) { // This is the first duplicate, so transform scalar (string) // into an array so we can add the duplicates - $this->parameters[$name] = array($this->parameters[$name]); + $this->parameters[$name] = [$this->parameters[$name]]; } $this->parameters[$name][] = $value; @@ -417,11 +417,11 @@ class OAuthRequest */ public function get_signature_base_string() { - $parts = array( + $parts = [ $this->get_normalized_http_method(), $this->get_normalized_http_url(), $this->get_signable_parameters() - ); + ]; $parts = OAuthUtil::urlencode_rfc3986($parts); @@ -554,7 +554,7 @@ class OAuthServer { protected $timestamp_threshold = 300; // in seconds, five minutes protected $version = '1.0'; // hi blaine - protected $signature_methods = array(); + protected $signature_methods = []; protected $data_store; @@ -577,14 +577,14 @@ class OAuthServer */ public function fetch_request_token(&$request) { - $this->get_version($request); + $this->getVersion($request); - $consumer = $this->get_consumer($request); + $consumer = $this->getConsumer($request); // no token required for the initial token request $token = null; - $this->check_signature($request, $consumer, $token); + $this->checkSignature($request, $consumer, $token); // Rev A change $callback = $request->get_parameter('oauth_callback'); @@ -599,14 +599,14 @@ class OAuthServer */ public function fetch_access_token(&$request) { - $this->get_version($request); + $this->getVersion($request); - $consumer = $this->get_consumer($request); + $consumer = $this->getConsumer($request); // requires authorized request token - $token = $this->get_token($request, $consumer, "request"); + $token = $this->getToken($request, $consumer, "request"); - $this->check_signature($request, $consumer, $token); + $this->checkSignature($request, $consumer, $token); // Rev A change $verifier = $request->get_parameter('oauth_verifier'); @@ -620,18 +620,18 @@ class OAuthServer */ public function verify_request(&$request) { - $this->get_version($request); - $consumer = $this->get_consumer($request); - $token = $this->get_token($request, $consumer, "access"); - $this->check_signature($request, $consumer, $token); - return array($consumer, $token); + $this->getVersion($request); + $consumer = $this->getConsumer($request); + $token = $this->getToken($request, $consumer, "access"); + $this->checkSignature($request, $consumer, $token); + return [$consumer, $token]; } // Internals from here /** * version 1 */ - private function get_version(&$request) + private function getVersion(&$request) { $version = $request->get_parameter("oauth_version"); if (!$version) { @@ -648,7 +648,7 @@ class OAuthServer /** * figure out the signature with some defaults */ - private function get_signature_method($request) + private function getSignatureMethod($request) { $signature_method = $request instanceof OAuthRequest ? $request->get_parameter("oauth_signature_method") @@ -660,8 +660,7 @@ class OAuthServer throw new OAuthException('No signature method parameter. This parameter is required'); } - if (!in_array($signature_method, - array_keys($this->signature_methods))) { + if (!in_array($signature_method, array_keys($this->signature_methods))) { throw new OAuthException( "Signature method '$signature_method' not supported ". "try one of the following: ". @@ -674,7 +673,7 @@ class OAuthServer /** * try to find the consumer for the provided request's consumer key */ - private function get_consumer($request) + private function getConsumer($request) { $consumer_key = $request instanceof OAuthRequest ? $request->get_parameter("oauth_consumer_key") @@ -695,16 +694,14 @@ class OAuthServer /** * try to find the token for the provided request's token key */ - private function get_token($request, $consumer, $token_type = "access") + private function getToken($request, $consumer, $token_type = "access") { $token_field = $request instanceof OAuthRequest ? $request->get_parameter('oauth_token') : null; if (!empty($token_field)) { - $token = $this->data_store->lookup_token( - $consumer, $token_type, $token_field - ); + $token = $this->data_store->lookup_token($consumer, $token_type, $token_field); if (!$token) { throw new OAuthException('Invalid '.$token_type.' token: '.$token_field); } @@ -718,7 +715,7 @@ class OAuthServer * all-in-one function to check the signature on a request * should guess the signature method appropriately */ - private function check_signature($request, $consumer, $token) + private function checkSignature($request, $consumer, $token) { // this should probably be in a different method $timestamp = $request instanceof OAuthRequest @@ -728,13 +725,13 @@ class OAuthServer ? $request->get_parameter('oauth_nonce') : null; - $this->check_timestamp($timestamp); - $this->check_nonce($consumer, $token, $nonce, $timestamp); + $this->checkTimestamp($timestamp); + $this->checkNonce($consumer, $token, $nonce, $timestamp); - $signature_method = $this->get_signature_method($request); + $signature_method = $this->getSignatureMethod($request); $signature = $request->get_parameter('oauth_signature'); - $valid_sig = $signature_method->check_signature( + $valid_sig = $signature_method->checkSignature( $request, $consumer, $token, @@ -749,7 +746,7 @@ class OAuthServer /** * check that the timestamp is new enough */ - private function check_timestamp($timestamp) + private function checkTimestamp($timestamp) { if (!$timestamp) { throw new OAuthException( @@ -769,7 +766,7 @@ class OAuthServer /** * check that the nonce is not repeated */ - private function check_nonce($consumer, $token, $nonce, $timestamp) + private function checkNonce($consumer, $token, $nonce, $timestamp) { if (!$nonce) { throw new OAuthException( @@ -819,7 +816,6 @@ class OAuthDataStore // is authorized // should also invalidate the request token } - } class OAuthUtil @@ -827,8 +823,8 @@ class OAuthUtil public static function urlencode_rfc3986($input) { if (is_array($input)) { - return array_map(array('OAuthUtil', 'urlencode_rfc3986'), $input); - } else if (is_scalar($input)) { + return array_map(['OAuthUtil', 'urlencode_rfc3986'], $input); + } elseif (is_scalar($input)) { return str_replace( '+', ' ', @@ -855,8 +851,12 @@ class OAuthUtil // see http://code.google.com/p/oauth/issues/detail?id=163 public static function split_header($header, $only_allow_oauth_parameters = true) { - $params = array(); - if (preg_match_all('/('.($only_allow_oauth_parameters ? 'oauth_' : '').'[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches)) { + $params = []; + if (preg_match_all( + '/('.($only_allow_oauth_parameters ? 'oauth_' : '').'[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', + $header, + $matches + )) { foreach ($matches[1] as $i => $h) { $params[$h] = OAuthUtil::urldecode_rfc3986(empty($matches[3][$i]) ? $matches[4][$i] : $matches[3][$i]); } @@ -879,7 +879,7 @@ class OAuthUtil // we always want the keys to be Cased-Like-This and arh() // returns the headers in the same case as they are in the // request - $out = array(); + $out = []; foreach ($headers as $key => $value) { $key = str_replace( " ", @@ -891,7 +891,7 @@ class OAuthUtil } else { // otherwise we don't have apache and are just going to have to hope // that $_SERVER actually contains what we need - $out = array(); + $out = []; if (isset($_SERVER['CONTENT_TYPE'])) { $out['Content-Type'] = $_SERVER['CONTENT_TYPE']; } @@ -926,12 +926,12 @@ class OAuthUtil public static function parse_parameters($input) { if (!isset($input) || !$input) { - return array(); + return []; } $pairs = explode('&', $input); - $parsed_parameters = array(); + $parsed_parameters = []; foreach ($pairs as $pair) { $split = explode('=', $pair, 2); $parameter = OAuthUtil::urldecode_rfc3986($split[0]); @@ -944,7 +944,7 @@ class OAuthUtil if (is_scalar($parsed_parameters[$parameter])) { // This is the first duplicate, so transform scalar (string) into an array // so we can add the duplicates - $parsed_parameters[$parameter] = array($parsed_parameters[$parameter]); + $parsed_parameters[$parameter] = [$parsed_parameters[$parameter]]; } $parsed_parameters[$parameter][] = $value; @@ -970,7 +970,7 @@ class OAuthUtil // Ref: Spec: 9.1.1 (1) uksort($params, 'strcmp'); - $pairs = array(); + $pairs = []; foreach ($params as $parameter => $value) { if (is_array($value)) { // If two or more parameters share the same name, they are sorted by their value diff --git a/modules/oauth/templates/registry.edit.tpl.php b/modules/oauth/templates/registry.edit.tpl.php index 4c97f36f57300b845bbecb62620bff0241371cf9..b43c40d39c3239424a148bff6084f0aa056b2406 100644 --- a/modules/oauth/templates/registry.edit.tpl.php +++ b/modules/oauth/templates/registry.edit.tpl.php @@ -1,21 +1,18 @@ <?php -$this->data['jquery'] = array('core' => true, 'ui' => true, 'css' => true); -$this->data['head'] = '<link rel="stylesheet" type="text/css" href="/' . $this->data['baseurlpath'] . 'module.php/oauth/resources/style.css" />' . "\n"; -$this->data['head'] .= '<script type="text/javascript"> -$(document).ready(function() { - $("#tabdiv").tabs(); -}); -</script>'; +$this->data['jquery'] = ['core' => true, 'ui' => true, 'css' => true]; +$this->data['head'] = '<link rel="stylesheet" type="text/css" href="/'. + $this->data['baseurlpath'].'module.php/oauth/assets/css/oauth.css" />'."\n"; +$this->data['head'] .= '<script type="text/javascript" src="/'. + $this->data['baseurlpath'].'module.php/oauth/assets/js/oauth.js"></script>'; $this->includeAtTemplateBase('includes/header.php'); +echo '<h1>OAuth Client</h1>'; -echo('<h1>OAuth Client</h1>'); +echo $this->data['form']; -echo($this->data['form']); - -echo('<p style="float: right"><a href="registry.php">Return to entity listing <strong>without saving...</strong></a></p>'); +echo '<p style="float: right"><a href="registry.php">'. + 'Return to entity listing <strong>without saving...</strong></a></p>'; $this->includeAtTemplateBase('includes/footer.php'); - diff --git a/modules/oauth/templates/registry.edit.twig b/modules/oauth/templates/registry.edit.twig index baa44d4f966634fc952e48ad96ad3b1aa21ee30e..ad9345d731a93a397528e1c6e2c0a05d7dd940f6 100644 --- a/modules/oauth/templates/registry.edit.twig +++ b/modules/oauth/templates/registry.edit.twig @@ -2,21 +2,11 @@ {% extends "base.twig" %} {% block preload %} - <link href="{{ baseurlpath }}resources/style.css" rel="stylesheet" /> + <link href="{{ baseurlpath }}assets/css/oauth.css" rel="stylesheet"> {% endblock %} {% block postload %} -<script type="text/javascript"> - $(document).ready(function() { - $("#tabdiv").tabs(); - $('ul.tabset_tabs li').click( - function() { - $("html, body").animate({ scrollTop: 0 }, "slow"); - } - ) - - }); -</script> + <script src="{{ baseurlpath}}assets/js/oauth.js"></script> {% endblock %} {% block content %} diff --git a/modules/oauth/templates/registry.list.php b/modules/oauth/templates/registry.list.php index e17329e52467e6c5da9271872b6ef5164b7dcab4..1c3b287fb696b8ced33285dbe34599ebd85426ef 100644 --- a/modules/oauth/templates/registry.list.php +++ b/modules/oauth/templates/registry.list.php @@ -1,51 +1,47 @@ <?php -$this->data['jquery'] = array('core' => true, 'ui' => true, 'css' => true); -$this->data['head'] = '<link rel="stylesheet" type="text/css" href="/'.$this->data['baseurlpath'].'module.php/oauth/resources/style.css" />'."\n"; - +$this->data['jquery'] = ['core' => true, 'ui' => true, 'css' => true]; +$this->data['head'] = '<link rel="stylesheet" type="text/css" href="/'. + $this->data['baseurlpath'].'module.php/oauth/assets/oauth.css" />'."\n"; $this->includeAtTemplateBase('includes/header.php'); - -echo('<h1>OAuth Client Registry</h1>'); - -echo('<p>Here you can register new OAuth Clients. You are successfully logged in as ' . htmlspecialchars($this->data['userid']) . '</p>'); - -echo('<h2>Your clients</h2>'); -echo('<table class="metalist" style="width: 100%">'); -$i = 0; $rows = array('odd', 'even'); -foreach($this->data['entries']['mine'] AS $entryc ) { - $entry = $entryc['value']; - $i++; - echo('<tr class="' . $rows[$i % 2] . '"> - <td>' . htmlspecialchars($entry['name']) . '</td> - <td><tt>' . htmlspecialchars($entry['key']) . '</tt></td> - <td> - <a href="registry.edit.php?editkey=' . urlencode($entry['key']) . '">edit</a> - <a href="registry.php?delete=' . urlencode($entry['key']) . '">delete</a> - </td></tr>'); +echo '<h1>OAuth Client Registry</h1>'; +echo '<p>Here you can register new OAuth Clients. You are successfully logged in as '. + htmlspecialchars($this->data['userid']).'</p>'; + +echo '<h2>Your clients</h2>'; +echo '<table class="metalist" style="width: 100%">'; +$i = 0; +$rows = ['odd', 'even']; +foreach ($this->data['entries']['mine'] as $entryc) { + $entry = $entryc['value']; + $i++; + echo '<tr class="'.$rows[$i % 2].'"><td>'. + htmlspecialchars($entry['name']).'</td> <td><code>'.htmlspecialchars($entry['key']). + '</code></td><td><a href="registry.edit.php?editkey='.urlencode($entry['key']). + '">edit</a><a href="registry.php?delete='.urlencode($entry['key']).'">delete</a></td></tr>'; } if ($i == 0) { - echo('<tr><td colspan="3">No entries registered</td></tr>'); + echo'<tr><td colspan="3">No entries registered</td></tr>'; } -echo('</table>'); - -echo('<p><a href="registry.edit.php">Add new client</a></p>'); - -echo('<h2>Other clients</h2>'); -echo('<table class="metalist" style="width: 100%">'); -$i = 0; $rows = array('odd', 'even'); -foreach($this->data['entries']['others'] AS $entryc ) { - $entry = $entryc['value']; - $i++; - echo('<tr class="' . $rows[$i % 2] . '"> - <td>' . htmlspecialchars($entry['name']) . '</td> - <td><tt>' . htmlspecialchars($entry['key']) . '</tt></td> - <td>' . (isset($entry['owner']) ? htmlspecialchars($entry['owner']) : 'No owner') . ' - </td></tr>'); +echo '</table>'; + +echo '<p><a href="registry.edit.php">Add new client</a></p>'; + +echo '<h2>Other clients</h2>'; +echo '<table class="metalist" style="width: 100%">'; +$i = 0; +$rows = ['odd', 'even']; +foreach ($this->data['entries']['others'] as $entryc) { + $entry = $entryc['value']; + $i++; + echo '<tr class="'.$rows[$i % 2].'"><td>'. + htmlspecialchars($entry['name']).'</td><td><code>'.htmlspecialchars($entry['key']). + '</code></td><td>'.(isset($entry['owner']) ? htmlspecialchars($entry['owner']) : 'No owner'). + '</td></tr>'; } if ($i == 0) { - echo('<tr><td colspan="3">No entries registered</td></tr>'); + echo '<tr><td colspan="3">No entries registered</td></tr>'; } -echo('</table>'); +echo '</table>'; $this->includeAtTemplateBase('includes/footer.php'); - diff --git a/modules/oauth/templates/registry.list.twig b/modules/oauth/templates/registry.list.twig index e6ec234c6020d7623373ee2dd0de468033250f2a..86bc5a6792a26489a6d52ec13b65538ab764ca82 100644 --- a/modules/oauth/templates/registry.list.twig +++ b/modules/oauth/templates/registry.list.twig @@ -2,7 +2,7 @@ {% extends "base.twig" %} {% block preload %} - <link href="{{ baseurlpath }}style.css" rel="stylesheet" /> + <link href="{{ baseurlpath }}assets/css/oauth.css" rel="stylesheet" /> {% endblock %} {% block content %} @@ -12,7 +12,7 @@ <table class="metalist" style="width: 100%;"> {% for key, entryc in entries.mine %} - {% if loop.index0 % 2 == 0 %} + {% if loop.index0 is even %} {% set class = 'even' %} {% else %} {% set class = 'odd' %} @@ -36,7 +36,7 @@ <table class="metalist" style="width: 100%"> {% for key, entryc in entries.others %} - {% if loop.index0 % 2 == 0 %} + {% if loop.index0 is even %} {% set class = 'even' %} {% else %} {% set class = 'odd' %} diff --git a/modules/oauth/templates/registry.saved.php b/modules/oauth/templates/registry.saved.php index 0ff62eb50fb116c93272588995898d3b371b3299..2e4bd27a92a916384f614e8b55fd058803e9c199 100644 --- a/modules/oauth/templates/registry.saved.php +++ b/modules/oauth/templates/registry.saved.php @@ -1,15 +1,8 @@ <?php - - $this->includeAtTemplateBase('includes/header.php'); - -echo('<h1>OAuth Client saved</h1>'); - -echo('<p><a href="registry.php">Go back to OAuth client listing</a></p>'); - - +echo '<h1>OAuth Client saved</h1>'; +echo '<p><a href="registry.php">Go back to OAuth client listing</a></p>'; $this->includeAtTemplateBase('includes/footer.php'); - diff --git a/modules/oauth/www/resources/style.css b/modules/oauth/www/assets/css/oauth.css similarity index 71% rename from modules/oauth/www/resources/style.css rename to modules/oauth/www/assets/css/oauth.css index 4df7a79504106ad9102dfb88d797561b12f9a55b..7b8ad7e92cb2d9fcf4f6f57ecaf714898bd15fa3 100644 --- a/modules/oauth/www/resources/style.css +++ b/modules/oauth/www/assets/css/oauth.css @@ -1,39 +1,38 @@ table.formtable { - width: 100%; + width: 100%; } table.formtable tr td.name { - text-align: right; - vertical-align: top; - padding-right: .6em; + text-align: right; + vertical-align: top; + padding-right: .6em; } table.formtable tr td.value { - text-align: left; - padding: 0px; + text-align: left; + padding: 0px; } table.formtable tr td.header { - padding-left: 5px; - padding-top: 8px; - font-weight: bold; - font-size: 110%; + padding-left: 5px; + padding-top: 8px; + font-weight: bold; + font-size: 110%; } table.formtable tr td input,table.formtable tr td textarea { - width: 90%; - border: 1px solid #bbb; - margin: 2px 5px; - padding: 2px 4px; + width: 90%; + border: 1px solid #bbb; + margin: 2px 5px; + padding: 2px 4px; } - table.metalist { - border: 1px solid #aaa; - border-collapse: collapse; + border: 1px solid #aaa; + border-collapse: collapse; } table.metalist tr td { - padding: 2px 5px; + padding: 2px 5px; } table.metalist tr.even td { - background: #e5e5e5; + background: #e5e5e5; } @media all { diff --git a/modules/oauth/www/assets/js/oauth.js b/modules/oauth/www/assets/js/oauth.js new file mode 100644 index 0000000000000000000000000000000000000000..442c63effcc4101a5f3ca02b50fb522cb83fd229 --- /dev/null +++ b/modules/oauth/www/assets/js/oauth.js @@ -0,0 +1,3 @@ +document.addEventListener('DOMContentLoaded', function () { + $("#tabdiv").tabs(); +}); diff --git a/modules/oauth/www/getUserInfo.php b/modules/oauth/www/getUserInfo.php index d793ed97345b2131f77f69495fe027c536630d35..ad9f878c8b511be1eaa9c87a1ff7ac15120f7b22 100644 --- a/modules/oauth/www/getUserInfo.php +++ b/modules/oauth/www/getUserInfo.php @@ -5,7 +5,9 @@ require_once(dirname(dirname(__FILE__)).'/libextinc/OAuth.php'); $oauthconfig = \SimpleSAML\Configuration::getConfig('module_oauth.php'); if (!$oauthconfig->getBoolean('getUserInfo.enable', false)) { - throw new \Exception('Get user info endpoint is disabled. This endpoint can be enabled in the module_oauth.php configuration file.'); + throw new \Exception( + 'Get user info endpoint is disabled. This endpoint can be enabled in the module_oauth.php configuration file.' + ); } $store = new \SimpleSAML\Module\oauth\OAuthStore(); diff --git a/modules/oauth/www/registry.edit.php b/modules/oauth/www/registry.edit.php index 053f7737f5096a972c4c2cc8fecd5f08aedb6431..c9a50b2f32f5fd4f683f122910f89a6b9e9779eb 100644 --- a/modules/oauth/www/registry.edit.php +++ b/modules/oauth/www/registry.edit.php @@ -28,7 +28,9 @@ function requireOwnership($entry, $userid) throw new \Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.'); } if ($entry['owner'] !== $userid) { - throw new \Exception('OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.'); + throw new \Exception( + 'OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.' + ); } } @@ -37,11 +39,11 @@ if (array_key_exists('editkey', $_REQUEST)) { $entry = $entryc['value']; requireOwnership($entry, $userid); } else { - $entry = array( + $entry = [ 'owner' => $userid, 'key' => \SimpleSAML\Utils\Random::generateID(), 'secret' => \SimpleSAML\Utils\Random::generateID(), - ); + ]; } $editor = new \SimpleSAML\Module\oauth\Registry(); @@ -49,7 +51,7 @@ $editor = new \SimpleSAML\Module\oauth\Registry(); if (isset($_POST['submit'])) { $editor->checkForm($_POST); - $entry = $editor->formToMeta($_POST, array(), array('owner' => $userid)); + $entry = $editor->formToMeta($_POST, [], ['owner' => $userid]); requireOwnership($entry, $userid); @@ -65,5 +67,5 @@ $form = $editor->metaToForm($entry); $template = new \SimpleSAML\XHTML\Template($config, 'oauth:registry.edit.tpl.php'); $template->data['form'] = $form; -$template->data['jquery'] = array('core' => false, 'ui' => true, 'css' => true); +$template->data['jquery'] = ['core' => false, 'ui' => true, 'css' => true]; $template->show(); diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index 4fbdcd1ed4f75a928eaff29edbd5ae4f5dcee245..3f3403bf1193b9400332adf41b511f18b1b89642 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -1,5 +1,4 @@ <?php - // Load SimpleSAMLphp, configuration and metadata $config = \SimpleSAML\Configuration::getInstance(); $session = \SimpleSAML\Session::getSessionFromRequest(); @@ -28,7 +27,9 @@ function requireOwnership($entry, $userid) throw new \Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.'); } if ($entry['owner'] !== $userid) { - throw new \Exception('OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.'); + throw new \Exception( + 'OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.' + ); } } @@ -42,12 +43,13 @@ if (isset($_REQUEST['delete'])) { $list = $store->getList('consumers'); -$slist = array('mine' => array(), 'others' => array()); +$slist = ['mine' => [], 'others' => []]; if (is_array($list)) { foreach ($list as $listitem) { if (array_key_exists('owner', $listitem['value'])) { if ($listitem['value']['owner'] === $userid) { - $slist['mine'][] = $listitem; continue; + $slist['mine'][] = $listitem; + continue; } } } diff --git a/modules/portal/config-templates/module_portal.php b/modules/portal/config-templates/module_portal.php index e390ce25052b7934265427d374f532bc93b8d612..85df6f99ab589004bc09c08671a677d25f66dcd8 100644 --- a/modules/portal/config-templates/module_portal.php +++ b/modules/portal/config-templates/module_portal.php @@ -1,11 +1,11 @@ <?php -/* +/* * Configuration for the module portal. */ -$config = array( - 'pagesets' => array( - array('frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation'), - array('sanitycheck', 'statistics'), - ), -); +$config = [ + 'pagesets' => [ + ['frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation'], + ['sanitycheck', 'statistics'], + ], +]; diff --git a/modules/portal/hooks/hook_htmlinject.php b/modules/portal/hooks/hook_htmlinject.php index 699837c0551a77df3b56b810f610d6b63436c454..efa1984a32aa37402255535297c245325658deef 100644 --- a/modules/portal/hooks/hook_htmlinject.php +++ b/modules/portal/hooks/hook_htmlinject.php @@ -12,19 +12,19 @@ function portal_hook_htmlinject(&$hookinfo) assert(array_key_exists('post', $hookinfo)); assert(array_key_exists('page', $hookinfo)); - $links = array('links' => array()); + $links = ['links' => []]; \SimpleSAML\Module::callHooks('frontpage', $links); $portalConfig = \SimpleSAML\Configuration::getOptionalConfig('module_portal.php'); - $allLinks = array(); + $allLinks = []; foreach ($links as $ls) { $allLinks = array_merge($allLinks, $ls); } - $pagesets = $portalConfig->getValue('pagesets', array( - array('frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation'), - )); + $pagesets = $portalConfig->getValue('pagesets', [ + ['frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation'], + ]); \SimpleSAML\Module::callHooks('portalextras', $pagesets); $portal = new \SimpleSAML\Module\portal\Portal($allLinks, $pagesets); @@ -36,8 +36,8 @@ function portal_hook_htmlinject(&$hookinfo) $hookinfo['jquery']['css'] = true; // Header - $hookinfo['pre'][] = '<div id="portalmenu" class="ui-tabs ui-widget ui-widget-content ui-corner-all">'. - $portal->getMenu($hookinfo['page']). + $hookinfo['pre'][] = '<div id="portalmenu" class="ui-tabs ui-widget ui-widget-content ui-corner-all">'. + $portal->getMenu($hookinfo['page']). '<div id="portalcontent" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'; // Footer diff --git a/modules/portal/lib/Portal.php b/modules/portal/lib/Portal.php index 52d722c112f7f76929b34bf87a903d8e39283b9b..517ce2edfa4a75bf7afa0798f0d3b9c8fa0f5fbc 100644 --- a/modules/portal/lib/Portal.php +++ b/modules/portal/lib/Portal.php @@ -38,7 +38,7 @@ class Portal public function getLoginInfo($translator, $thispage) { - $info = array('info' => '', 'translator' => $translator, 'thispage' => $thispage); + $info = ['info' => '', 'translator' => $translator, 'thispage' => $thispage]; \SimpleSAML\Module::callHooks('portalLoginInfo', $info); return $info['info']; } @@ -49,8 +49,8 @@ class Portal $t = new \SimpleSAML\Locale\Translate($config); $tabset = $this->getTabset($thispage); $logininfo = $this->getLoginInfo($t, $thispage); - $text = ''; - $text .= '<ul class="tabset_tabs ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'; + $classes = 'tabset_tabs ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'; + $text = '<ul class="'.$classes.'">'; foreach ($this->pages as $pageid => $page) { if (isset($tabset) && !in_array($pageid, $tabset, true)) { continue; @@ -65,7 +65,7 @@ class Portal if (!isset($page['href'])) { $text .= '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#">'. $t->t($name).'</a></li>'; - } else if ($pageid === $thispage) { + } elseif ($pageid === $thispage) { $text .= '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#">'. $t->t($name).'</a></li>'; } else { diff --git a/modules/preprodwarning/lib/Auth/Process/Warning.php b/modules/preprodwarning/lib/Auth/Process/Warning.php index 1a235a83aa20d1210fe8d3e4f4404940aec8138d..bbc6fdadb2d20f684c75db19e17f5e7419dce5bf 100644 --- a/modules/preprodwarning/lib/Auth/Process/Warning.php +++ b/modules/preprodwarning/lib/Auth/Process/Warning.php @@ -30,6 +30,6 @@ class Warning extends \SimpleSAML\Auth\ProcessingFilter // Save state and redirect. $id = \SimpleSAML\Auth\State::saveState($state, 'warning:request'); $url = \SimpleSAML\Module::getModuleURL('preprodwarning/showwarning.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } } diff --git a/modules/preprodwarning/templates/warning.php b/modules/preprodwarning/templates/warning.php index 41f2912d875219502a63b366ae7a1ecdfc886ef3..3d09fa9c33334cd53a9dd6d49b669fa50ddc0856 100644 --- a/modules/preprodwarning/templates/warning.php +++ b/modules/preprodwarning/templates/warning.php @@ -20,22 +20,17 @@ $this->data['header'] = $this->t('{preprodwarning:warning:warning_header}'); $this->data['autofocus'] = 'yesbutton'; $this->includeAtTemplateBase('includes/header.php'); - -?> - -<form style="display: inline; margin: 0px; padding: 0px" action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>"> - -<?php - // Embed hidden fields... - foreach ($this->data['yesData'] as $name => $value) { - echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; - } -?> - <p><?php echo $this->t('{preprodwarning:warning:warning}'); ?></p> - <input type="submit" name="yes" id="yesbutton" value="<?php echo htmlspecialchars($this->t('{preprodwarning:warning:yes}')) ?>" /> - -</form> - -<?php +$yesTarget = htmlspecialchars($this->data['yesTarget']); +$yesWarning = htmlspecialchars($this->t('{preprodwarning:warning:yes}')); +$warning = $this->t('{preprodwarning:warning:warning}'); +echo '<form style="display: inline; margin: 0px; padding: 0px" action="'.$yesTarget.'">'; + +// Embed hidden fields... +foreach ($this->data['yesData'] as $name => $value) { + echo '<input type="hidden" name="'.htmlspecialchars($name).'" value="'.htmlspecialchars($value).'" />'; +} +echo '<p>'.$warning.'</p>'; +echo '<input type="submit" name="yes" id="yesbutton" value="'.$yesWarning.'" />'; +echo '</form>'; $this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/preprodwarning/templates/warning.twig b/modules/preprodwarning/templates/warning.twig index 9a86ffb69eab0654e68e8d54dba08e34dfa6e845..838dd072b1d946abb43b16c41846dc1cf7afc13f 100644 --- a/modules/preprodwarning/templates/warning.twig +++ b/modules/preprodwarning/templates/warning.twig @@ -7,11 +7,10 @@ <p>{% trans %}You are now accessing a pre-production system. This authentication setup is for testing and pre-production verification only. If someone sent you a link that pointed you here, and you are not <i>a tester</i> you probably got the wrong link, and should <b>not be here</b>.{% endtrans %}</p><br /> {% for name,value in yesData %} - <input type="hidden" name="{{ name }}" value="{{ value }}" /> + <input type="hidden" name="{{ name }}" value="{{ value }}"> {% endfor %} <p> - <input type="submit" name="yes" class="pure-button pure-button-red" value="{{'Yes, I know I am accessing a pre-production system'|trans}}" /> - + <input type="submit" name="yes" class="pure-button pure-button-red" value="{{'Yes, I know I am accessing a pre-production system'|trans}}" autofocus> </p> </form> diff --git a/modules/preprodwarning/www/showwarning.php b/modules/preprodwarning/www/showwarning.php index 41eff20555e739aceb016ba574a55162637410fa..394617d35cab6a1df9f58f5fda76b366b744cc68 100644 --- a/modules/preprodwarning/www/showwarning.php +++ b/modules/preprodwarning/www/showwarning.php @@ -24,5 +24,5 @@ $globalConfig = \SimpleSAML\Configuration::getInstance(); $t = new \SimpleSAML\XHTML\Template($globalConfig, 'preprodwarning:warning.php'); $t->data['yesTarget'] = \SimpleSAML\Module::getModuleURL('preprodwarning/showwarning.php'); -$t->data['yesData'] = array('StateId' => $id); +$t->data['yesData'] = ['StateId' => $id]; $t->show(); diff --git a/modules/radius/lib/Auth/Source/Radius.php b/modules/radius/lib/Auth/Source/Radius.php index c37238e826973f2be3e0c1e674b33730832bb743..70a192b4136b913ff5bbfbfc4479a4cf3602fe79 100644 --- a/modules/radius/lib/Auth/Source/Radius.php +++ b/modules/radius/lib/Auth/Source/Radius.php @@ -83,26 +83,29 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase parent::__construct($info, $config); // Parse configuration. - $config = \SimpleSAML\Configuration::loadFromArray($config, - 'Authentication source '.var_export($this->authId, true)); + $config = \SimpleSAML\Configuration::loadFromArray( + $config, + 'Authentication source '.var_export($this->authId, true) + ); - $this->servers = $config->getArray('servers', array()); + $this->servers = $config->getArray('servers', []); // For backwards compatibility if (empty($this->servers)) { $this->hostname = $config->getString('hostname'); $this->port = $config->getIntegerRange('port', 1, 65535, 1812); $this->secret = $config->getString('secret'); - $this->servers[] = array( + $this->servers[] = [ 'hostname' => $this->hostname, 'port' => $this->port, 'secret' => $this->secret - ); + ]; } $this->timeout = $config->getInteger('timeout', 5); $this->retries = $config->getInteger('retries', 3); $this->realm = $config->getString('realm', null); $this->usernameAttribute = $config->getString('username_attribute', null); - $this->nasIdentifier = $config->getString('nas_identifier', + $this->nasIdentifier = $config->getString( + 'nas_identifier', \SimpleSAML\Utils\HTTP::getSelfHost() ); @@ -127,7 +130,7 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase $radius = radius_auth_open(); - /* Try to add all radius servers, trigger a failure if no one works. */ + // Try to add all radius servers, trigger a failure if no one works $success = false; foreach ($this->servers as $server) { if (!isset($server['port'])) { @@ -135,10 +138,14 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase } if (!radius_add_server( $radius, - $server['hostname'], $server['port'], $server['secret'], - $this->timeout, $this->retries)) { - \SimpleSAML\Logger::info("Could not add radius server: ". - radius_strerror($radius) + $server['hostname'], + $server['port'], + $server['secret'], + $this->timeout, + $this->retries + )) { + \SimpleSAML\Logger::info( + "Could not add radius server: ".radius_strerror($radius) ); continue; } @@ -149,8 +156,8 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase } if (!radius_create_request($radius, \RADIUS_ACCESS_REQUEST)) { - throw new \Exception('Error creating radius request: '. - radius_strerror($radius) + throw new \Exception( + 'Error creating radius request: '.radius_strerror($radius) ); } @@ -174,18 +181,18 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase case \RADIUS_ACCESS_CHALLENGE: throw new \Exception('Radius authentication error: Challenge requested, but not supported.'); default: - throw new \Exception('Error during radius authentication: '. - radius_strerror($radius) - ); + throw new \Exception( + 'Error during radius authentication: '.radius_strerror($radius) + ); } } // If we get this far, we have a valid login - $attributes = array(); + $attributes = []; if ($this->usernameAttribute !== null) { - $attributes[$this->usernameAttribute] = array($username); + $attributes[$this->usernameAttribute] = [$username]; } if ($this->vendor === null) { @@ -198,16 +205,15 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase // get AAI attribute sets. Contributed by Stefan Winter, (c) RESTENA while ($resa = radius_get_attr($radius)) { - if (!is_array($resa)) { - throw new \Exception('Error getting radius attributes: '. - radius_strerror($radius) + throw new \Exception( + 'Error getting radius attributes: '.radius_strerror($radius) ); } // Use the received user name if ($resa['attr'] == \RADIUS_USER_NAME) { - $attributes[$this->usernameAttribute] = array($resa['data']); + $attributes[$this->usernameAttribute] = [$resa['data']]; continue; } @@ -217,8 +223,8 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase $resv = radius_get_vendor_attr($resa['data']); if (!is_array($resv)) { - throw new \Exception('Error getting vendor specific attribute: '. - radius_strerror($radius) + throw new \Exception( + 'Error getting vendor specific attribute: '.radius_strerror($radius) ); } @@ -237,7 +243,7 @@ class Radius extends \SimpleSAML\Module\core\Auth\UserPassBase if (array_key_exists($attrib_name, $attributes)) { $attributes[$attrib_name][] = $attrib_value; } else { - $attributes[$attrib_name] = array($attrib_value); + $attributes[$attrib_name] = [$attrib_value]; } } // end of contribution diff --git a/modules/riak/config-templates/module_riak.php b/modules/riak/config-templates/module_riak.php index 4d3043195f2b07b4323dce5b4cbac33bc3b0ca5e..99f535fee579d461b295c9bfcc90234f3d4cf099 100644 --- a/modules/riak/config-templates/module_riak.php +++ b/modules/riak/config-templates/module_riak.php @@ -4,7 +4,7 @@ * */ -$config = array( +$config = [ /* * This module has the following config options and defaults. * @@ -13,4 +13,4 @@ $config = array( * 'port' => 8098, * 'bucket' => 'SimpleSAMLphp', */ -); +]; diff --git a/modules/riak/hooks/hook_cron.php b/modules/riak/hooks/hook_cron.php index c7bc7e6f17d632af01b5f4c39f17d6508a6035c2..c42d2c313e75b66cb6855a2b353e7033e1ebdff9 100644 --- a/modules/riak/hooks/hook_cron.php +++ b/modules/riak/hooks/hook_cron.php @@ -41,14 +41,14 @@ function riak_hook_cron(&$croninfo) try { $store = new \SimpleSAML\Module\riak\Store\Store(); - $result = $store->bucket->indexSearch('expires', 'int', - 1, time() - 30); + $result = $store->bucket->indexSearch('expires', 'int', 1, time() - 30); foreach ($result as $link) { $link->getBinary()->delete(); } - \SimpleSAML\Logger::info(sprintf("deleted %s riak key%s", - sizeof($result), sizeof($result) == 1 ? '' : 's')); + \SimpleSAML\Logger::info( + sprintf("deleted %s riak key%s", sizeof($result), sizeof($result) == 1 ? '' : 's') + ); } catch (\Exception $e) { $message = 'riak threw exception: '.$e->getMessage(); \SimpleSAML\Logger::warning($message); diff --git a/modules/saml/docs/authproc_authncontextclassref.md b/modules/saml/docs/authproc_authncontextclassref.md new file mode 100644 index 0000000000000000000000000000000000000000..5e755a88b5d0aaa34de70f8c5f08463cb4d1b704 --- /dev/null +++ b/modules/saml/docs/authproc_authncontextclassref.md @@ -0,0 +1,14 @@ +`saml:AuthnContextClassRef` +=========================== + +IDP-side filter for setting the `AuthnContextClassRef` element in the authentication response. + +Examples +-------- + + 'authproc.idp' => array( + 92 => array( + 'class' => 'saml:AuthnContextClassRef', + 'AuthnContextClassRef' => 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport', + ), + ), diff --git a/modules/saml/hooks/hook_metadata_hosted.php b/modules/saml/hooks/hook_metadata_hosted.php index 9090edd9c62c66bfd0dd0d1aada5243d45b827ea..e1dc65c36f81892947e651fc296020ad3bfb7090 100644 --- a/modules/saml/hooks/hook_metadata_hosted.php +++ b/modules/saml/hooks/hook_metadata_hosted.php @@ -20,16 +20,16 @@ function saml_hook_metadata_hosted(&$metadataHosted) $name = $metadata->getValue('OrganizationDisplayName', null); } if ($name === null) { - $name = $source->getAuthID(); + $name = $source->getAuthId(); } - $md = array( + $md = [ 'entityid' => $source->getEntityId(), 'metadata-index' => $source->getEntityId(), 'metadata-set' => 'saml20-sp-hosted', 'metadata-url' => $source->getMetadataURL().'?output=xhtml', 'name' => $name, - ); + ]; $metadataHosted[] = $md; } diff --git a/modules/saml/lib/Auth/Process/ExpectedAuthnContextClassRef.php b/modules/saml/lib/Auth/Process/ExpectedAuthnContextClassRef.php index d7ae42fbc6b15949d8fbb60214c3f7481a8797d7..fd6277732326b7bfad1cc82bce053b7f3d217b85 100644 --- a/modules/saml/lib/Auth/Process/ExpectedAuthnContextClassRef.php +++ b/modules/saml/lib/Auth/Process/ExpectedAuthnContextClassRef.php @@ -99,6 +99,6 @@ class ExpectedAuthnContextClassRef extends \SimpleSAML\Auth\ProcessingFilter $url = \SimpleSAML\Module::getModuleURL( 'saml/sp/wrong_authncontextclassref.php' ); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['StateId' => $id]); } } diff --git a/modules/saml/lib/Auth/Process/FilterScopes.php b/modules/saml/lib/Auth/Process/FilterScopes.php index 6b9eda30f63dcb0601300a9ab86147b9fef00a53..67ef886df09e4dec683df2fbced1bf02d6c1ca44 100644 --- a/modules/saml/lib/Auth/Process/FilterScopes.php +++ b/modules/saml/lib/Auth/Process/FilterScopes.php @@ -17,10 +17,10 @@ class FilterScopes extends \SimpleSAML\Auth\ProcessingFilter /** * Stores any pre-configured scoped attributes which come from the filter configuration. */ - private $scopedAttributes = array( + private $scopedAttributes = [ 'eduPersonScopedAffiliation', 'eduPersonPrincipalName' - ); + ]; /** @@ -53,7 +53,7 @@ class FilterScopes extends \SimpleSAML\Auth\ProcessingFilter Logger::warning('No scoped attributes configured.'); return; } - $validScopes = array(); + $validScopes = []; if (array_key_exists('scope', $src) && is_array($src['scope']) && !empty($src['scope'])) { $validScopes = $src['scope']; } @@ -64,7 +64,7 @@ class FilterScopes extends \SimpleSAML\Auth\ProcessingFilter } $values = $request['Attributes'][$attribute]; - $newValues = array(); + $newValues = []; foreach ($values as $value) { $ep = \SimpleSAML\Utils\Config\Metadata::getDefaultEndpoint($request['Source']['SingleSignOnService']); $loc = $ep['Location']; diff --git a/modules/saml/lib/Auth/Process/NameIDAttribute.php b/modules/saml/lib/Auth/Process/NameIDAttribute.php index 29387ba0acdcc03a7f2d353164193cf8df341c70..e1455b214d4e6bd3604b762eef6868362f39f3b6 100644 --- a/modules/saml/lib/Auth/Process/NameIDAttribute.php +++ b/modules/saml/lib/Auth/Process/NameIDAttribute.php @@ -65,7 +65,7 @@ class NameIDAttribute extends \SimpleSAML\Auth\ProcessingFilter { assert(is_string($format)); - $ret = array(); + $ret = []; $pos = 0; while (($next = strpos($format, '%', $pos)) !== false) { $ret[] = substr($format, $pos, $next - $pos); @@ -139,6 +139,6 @@ class NameIDAttribute extends \SimpleSAML\Auth\ProcessingFilter $isString = !$isString; } - $state['Attributes'][$this->attribute] = array($value); + $state['Attributes'][$this->attribute] = [$value]; } } diff --git a/modules/saml/lib/Auth/Process/PersistentNameID2TargetedID.php b/modules/saml/lib/Auth/Process/PersistentNameID2TargetedID.php index 021630afab65a03840afd3ce15004d5492b320b8..d07d8ee0a0245a76582ccf08589ca8e944526ba8 100644 --- a/modules/saml/lib/Auth/Process/PersistentNameID2TargetedID.php +++ b/modules/saml/lib/Auth/Process/PersistentNameID2TargetedID.php @@ -70,6 +70,6 @@ class PersistentNameID2TargetedID extends \SimpleSAML\Auth\ProcessingFilter /** @var \SAML2\XML\saml\NameID $nameID */ $nameID = $state['saml:NameID'][\SAML2\Constants::NAMEID_PERSISTENT]; - $state['Attributes'][$this->attribute] = array((!$this->nameId) ? $nameID->value : $nameID); + $state['Attributes'][$this->attribute] = [(!$this->nameId) ? $nameID->value : $nameID]; } } diff --git a/modules/saml/lib/Auth/Process/SQLPersistentNameID.php b/modules/saml/lib/Auth/Process/SQLPersistentNameID.php index c1b3bf51a35fe1809c9ca3c3a00742d6b3efe728..38b6d0c98229a0e6c24d0a439758aedeabedd1c6 100644 --- a/modules/saml/lib/Auth/Process/SQLPersistentNameID.php +++ b/modules/saml/lib/Auth/Process/SQLPersistentNameID.php @@ -92,11 +92,11 @@ class SQLPersistentNameID extends \SimpleSAML\Module\saml\BaseNameIDGenerator return null; } - $validNameIdFormats = @array_filter(array( + $validNameIdFormats = @array_filter([ $state['saml:NameIDFormat'], $state['SPMetadata']['NameIDPolicy'], $state['SPMetadata']['NameIDFormat'] - )); + ]); if (count($validNameIdFormats) && !in_array($this->format, $validNameIdFormats, true) && !$this->allowDifferent ) { diff --git a/modules/saml/lib/Auth/Source/SP.php b/modules/saml/lib/Auth/Source/SP.php index 25a70078156e207d741039d470fa2e483470ae6c..ecd1e852c6a92e251b804c360b0e2bce51851df5 100644 --- a/modules/saml/lib/Auth/Source/SP.php +++ b/modules/saml/lib/Auth/Source/SP.php @@ -201,15 +201,15 @@ class SP extends Source $accr = \SimpleSAML\Utils\Arrays::arrayize($state['saml:AuthnContextClassRef']); $comp = \SAML2\Constants::COMPARISON_EXACT; if (isset($state['saml:AuthnContextComparison']) - && in_array($state['AuthnContextComparison'], array( + && in_array($state['AuthnContextComparison'], [ \SAML2\Constants::COMPARISON_EXACT, \SAML2\Constants::COMPARISON_MINIMUM, \SAML2\Constants::COMPARISON_MAXIMUM, \SAML2\Constants::COMPARISON_BETTER, - ), true)) { + ], true)) { $comp = $state['saml:AuthnContextComparison']; } - $ar->setRequestedAuthnContext(array('AuthnContextClassRef' => $accr, 'Comparison' => $comp)); + $ar->setRequestedAuthnContext(['AuthnContextClassRef' => $accr, 'Comparison' => $comp]); } if (isset($state['ForceAuthn'])) { @@ -229,10 +229,10 @@ class SP extends Source if (isset($state['saml:NameIDPolicy'])) { if (is_string($state['saml:NameIDPolicy'])) { - $policy = array( + $policy = [ 'Format' => (string) $state['saml:NameIDPolicy'], 'AllowCreate' => true, - ); + ]; } elseif (is_array($state['saml:NameIDPolicy'])) { $policy = $state['saml:NameIDPolicy']; } else { @@ -244,16 +244,18 @@ class SP extends Source if (isset($state['saml:IDPList'])) { $IDPList = $state['saml:IDPList']; } else { - $IDPList = array(); + $IDPList = []; } - $ar->setIDPList(array_unique( - array_merge( - $this->metadata->getArray('IDPList', array()), - $idpMetadata->getArray('IDPList', array() - ), - (array) $IDPList) - )); + $ar->setIDPList( + array_unique( + array_merge( + $this->metadata->getArray('IDPList', []), + $idpMetadata->getArray('IDPList', []), + (array) $IDPList + ) + ) + ); if (isset($state['saml:ProxyCount']) && $state['saml:ProxyCount'] !== null) { $ar->setProxyCount($state['saml:ProxyCount']); @@ -263,7 +265,7 @@ class SP extends Source $ar->setProxyCount($this->metadata->getInteger('ProxyCount', null)); } - $requesterID = array(); + $requesterID = []; if (isset($state['saml:RequesterID'])) { $requesterID = $state['saml:RequesterID']; } @@ -284,19 +286,26 @@ class SP extends Source $id = State::saveState($state, 'saml:sp:sso', true); $ar->setId($id); - \SimpleSAML\Logger::debug('Sending SAML 2 AuthnRequest to '. - var_export($idpMetadata->getString('entityid'), true)); + \SimpleSAML\Logger::debug( + 'Sending SAML 2 AuthnRequest to '.var_export($idpMetadata->getString('entityid'), true) + ); // Select appropriate SSO endpoint if ($ar->getProtocolBinding() === \SAML2\Constants::BINDING_HOK_SSO) { - $dst = $idpMetadata->getDefaultEndpoint('SingleSignOnService', array( - \SAML2\Constants::BINDING_HOK_SSO) + $dst = $idpMetadata->getDefaultEndpoint( + 'SingleSignOnService', + [ + \SAML2\Constants::BINDING_HOK_SSO + ] ); } else { - $dst = $idpMetadata->getEndpointPrioritizedByBinding('SingleSignOnService', [ - \SAML2\Constants::BINDING_HTTP_REDIRECT, - \SAML2\Constants::BINDING_HTTP_POST, - ]); + $dst = $idpMetadata->getEndpointPrioritizedByBinding( + 'SingleSignOnService', + [ + \SAML2\Constants::BINDING_HTTP_REDIRECT, + \SAML2\Constants::BINDING_HTTP_POST, + ] + ); } $ar->setDestination($dst['Location']); @@ -363,13 +372,13 @@ class SP extends Source $discoURL = \SimpleSAML\Module::getModuleURL('saml/disco.php'); } - $returnTo = \SimpleSAML\Module::getModuleURL('saml/sp/discoresp.php', array('AuthID' => $id)); + $returnTo = \SimpleSAML\Module::getModuleURL('saml/sp/discoresp.php', ['AuthID' => $id]); - $params = array( + $params = [ 'entityID' => $this->entityId, 'return' => $returnTo, 'returnIDParam' => 'idpentityid' - ); + ]; if (isset($state['saml:IDPList'])) { $params['IDPList'] = $state['saml:IDPList']; @@ -539,15 +548,15 @@ class SP extends Source if (isset($state['isPassive']) && (bool) $state['isPassive']) { // passive request, we cannot authenticate the user throw new \SimpleSAML\Module\saml\Error\NoPassive( - \SAML2\Constants::STATUS_REQUESTER, - 'Reauthentication required' + \SAML2\Constants::STATUS_REQUESTER, + 'Reauthentication required' ); } // save the state WITHOUT a restart URL, so that we don't try an IdP-initiated login if something goes wrong $id = State::saveState($state, 'saml:proxy:invalid_idp', true); $url = \SimpleSAML\Module::getModuleURL('saml/proxy/invalid_session.php'); - \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('AuthState' => $id)); + \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, ['AuthState' => $id]); assert(false); } @@ -565,7 +574,7 @@ class SP extends Source if (isset($state['Responder'])) { $state['saml:proxy:reauthLogout:PrevResponder'] = $state['Responder']; } - $state['Responder'] = array('\SimpleSAML\Module\saml\Auth\Source\SP', 'reauthPostLogout'); + $state['Responder'] = ['\SimpleSAML\Module\saml\Auth\Source\SP', 'reauthPostLogout']; $idp = \SimpleSAML\IdP::getByState($state); $idp->handleLogoutRequest($state, null); @@ -636,9 +645,9 @@ class SP extends Source $idpMetadata = $this->getIdPMetadata($idp); - $endpoint = $idpMetadata->getEndpointPrioritizedByBinding('SingleLogoutService', array( + $endpoint = $idpMetadata->getEndpointPrioritizedByBinding('SingleLogoutService', [ \SAML2\Constants::BINDING_HTTP_REDIRECT, - \SAML2\Constants::BINDING_HTTP_POST), false); + \SAML2\Constants::BINDING_HTTP_POST], false); if ($endpoint === false) { \SimpleSAML\Logger::info('No logout endpoint for IdP '.var_export($idp, true).'.'); return; @@ -701,7 +710,7 @@ class SP extends Source assert(array_key_exists('LogoutState', $state)); assert(array_key_exists('saml:logout:Type', $state['LogoutState'])); - $idpMetadata = $this->getIdpMetadata($idp); + $idpMetadata = $this->getIdPMetadata($idp); $spMetadataArray = $this->metadata->toArray(); $idpMetadataArray = $idpMetadata->toArray(); @@ -710,15 +719,15 @@ class SP extends Source $state['saml:sp:IdP'] = $idp; $state['PersistentAuthData'][] = 'saml:sp:IdP'; - $authProcState = array( + $authProcState = [ 'saml:sp:IdP' => $idp, 'saml:sp:State' => $state, - 'ReturnCall' => array('\SimpleSAML\Module\saml\Auth\Source\SP', 'onProcessingCompleted'), + 'ReturnCall' => ['\SimpleSAML\Module\saml\Auth\Source\SP', 'onProcessingCompleted'], 'Attributes' => $attributes, 'Destination' => $spMetadataArray, 'Source' => $idpMetadataArray, - ); + ]; if (isset($state['saml:sp:NameID'])) { $authProcState['saml:sp:NameID'] = $state['saml:sp:NameID']; diff --git a/modules/saml/lib/BaseNameIDGenerator.php b/modules/saml/lib/BaseNameIDGenerator.php index 12115dc37dfb5769db9cdbeca9193c47c349f7f7..c5360854e7904bb1ba721eafd5d5937093f0080b 100644 --- a/modules/saml/lib/BaseNameIDGenerator.php +++ b/modules/saml/lib/BaseNameIDGenerator.php @@ -117,5 +117,4 @@ abstract class BaseNameIDGenerator extends \SimpleSAML\Auth\ProcessingFilter $state['saml:NameID'][$this->format] = $nameId; } - } diff --git a/modules/saml/lib/Error.php b/modules/saml/lib/Error.php index b288ef107e8d71cf6c6959452522ab3598270ab5..e45b846ff89c99987927d99907da775750c7a43d 100644 --- a/modules/saml/lib/Error.php +++ b/modules/saml/lib/Error.php @@ -36,8 +36,10 @@ class Error extends \SimpleSAML\Error\Exception * Create a SAML 2 error. * * @param string $status The top-level status code. - * @param string|null $subStatus The second-level status code. Can be NULL, in which case there is no second-level status code. - * @param string|null $statusMessage The status message. Can be NULL, in which case there is no status message. + * @param string|null $subStatus The second-level status code. + * Can be NULL, in which case there is no second-level status code. + * @param string|null $statusMessage The status message. + * Can be NULL, in which case there is no status message. * @param \Exception|null $cause The cause of this exception. Can be NULL. */ public function __construct($status, $subStatus = null, $statusMessage = null, \Exception $cause = null) @@ -116,7 +118,7 @@ class Error extends \SimpleSAML\Error\Exception \SAML2\Constants::STATUS_NO_PASSIVE, $exception->getMessage(), $exception - ); + ); // TODO: remove this branch in 2.0 } elseif ($exception instanceof \SimpleSAML\Error\ProxyCountExceeded) { $e = new self( @@ -131,7 +133,7 @@ class Error extends \SimpleSAML\Error\Exception null, get_class($exception).': '.$exception->getMessage(), $exception - ); + ); } return $e; @@ -163,7 +165,7 @@ class Error extends \SimpleSAML\Error\Exception ); break; } - break; + break; } if ($e === null) { diff --git a/modules/saml/lib/IdP/SAML1.php b/modules/saml/lib/IdP/SAML1.php index a6d8ce0ed4b075b57fe443ee50d6b4d3e6e188b3..3f1d734d4331da523cf0d5301d9737004cf8ad14 100644 --- a/modules/saml/lib/IdP/SAML1.php +++ b/modules/saml/lib/IdP/SAML1.php @@ -27,8 +27,10 @@ class SAML1 $spMetadata = $state["SPMetadata"]; $spEntityId = $spMetadata['entityid']; - $spMetadata = \SimpleSAML\Configuration::loadFromArray($spMetadata, - '$metadata['.var_export($spEntityId, true).']'); + $spMetadata = \SimpleSAML\Configuration::loadFromArray( + $spMetadata, + '$metadata['.var_export($spEntityId, true).']' + ); \SimpleSAML\Logger::info('Sending SAML 1.1 Response to '.var_export($spEntityId, true)); @@ -43,11 +45,11 @@ class SAML1 $config = \SimpleSAML\Configuration::getInstance(); $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); - $statsData = array( + $statsData = [ 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'protocol' => 'saml1', - ); + ]; if (isset($state['saml:AuthnRequestReceivedAt'])) { $statsData['logintime'] = microtime(true) - $state['saml:AuthnRequestReceivedAt']; } @@ -96,7 +98,9 @@ class SAML1 $target = null; } - \SimpleSAML\Logger::info('Shib1.3 - IdP.SSOService: Got incoming Shib authnRequest from '.var_export($spEntityId, true).'.'); + \SimpleSAML\Logger::info( + 'Shib1.3 - IdP.SSOService: Got incoming Shib authnRequest from '.var_export($spEntityId, true).'.' + ); $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'shib13-sp-remote'); @@ -113,27 +117,32 @@ class SAML1 break; } if (!$found) { - throw new \Exception('Invalid AssertionConsumerService for SP '. - var_export($spEntityId, true).': '.var_export($shire, true)); + throw new \Exception( + 'Invalid AssertionConsumerService for SP '.var_export($spEntityId, true).': '.var_export($shire, true) + ); } - \SimpleSAML\Stats::log('saml:idp:AuthnRequest', array( - 'spEntityID' => $spEntityId, - 'protocol' => 'saml1', - )); + \SimpleSAML\Stats::log( + 'saml:idp:AuthnRequest', + [ + 'spEntityID' => $spEntityId, + 'protocol' => 'saml1', + ] + ); $sessionLostURL = HTTP::addURLParameters( HTTP::getSelfURL(), - array('cookieTime' => time())); + ['cookieTime' => time()] + ); - $state = array( - 'Responder' => array('\SimpleSAML\Module\saml\IdP\SAML1', 'sendResponse'), + $state = [ + 'Responder' => ['\SimpleSAML\Module\saml\IdP\SAML1', 'sendResponse'], 'SPMetadata' => $spMetadata->toArray(), \SimpleSAML\Auth\State::RESTART => $sessionLostURL, 'saml:shire' => $shire, 'saml:target' => $target, 'saml:AuthnRequestReceivedAt' => microtime(true), - ); + ]; $idp->handleAuthenticationRequest($state); } diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php index 3cdb14fa33ecd5e7b057549bb66cc487b69e9581..d0bb9f849bd426ae41e48b43676d9b8e32c25024 100644 --- a/modules/saml/lib/IdP/SAML2.php +++ b/modules/saml/lib/IdP/SAML2.php @@ -53,14 +53,14 @@ class SAML2 } // create the session association (for logout) - $association = array( + $association = [ 'id' => 'saml:'.$spEntityId, 'Handler' => '\SimpleSAML\Module\saml\IdP\SAML2', 'Expires' => $assertion->getSessionNotOnOrAfter(), 'saml:entityID' => $spEntityId, 'saml:NameID' => $state['saml:idp:NameID'], 'saml:SessionIndex' => $assertion->getSessionIndex(), - ); + ]; // maybe encrypt the assertion $assertion = self::encryptAssertion($idpMetadata, $spMetadata, $assertion); @@ -69,16 +69,16 @@ class SAML2 $ar = self::buildResponse($idpMetadata, $spMetadata, $consumerURL); $ar->setInResponseTo($requestId); $ar->setRelayState($relayState); - $ar->setAssertions(array($assertion)); + $ar->setAssertions([$assertion]); // register the session association with the IdP $idp->addAssociation($association); - $statsData = array( + $statsData = [ 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'protocol' => 'saml2', - ); + ]; if (isset($state['saml:AuthnRequestReceivedAt'])) { $statsData['logintime'] = microtime(true) - $state['saml:AuthnRequestReceivedAt']; } @@ -129,19 +129,19 @@ class SAML2 $ar->setInResponseTo($requestId); $ar->setRelayState($relayState); - $status = array( + $status = [ 'Code' => $error->getStatus(), 'SubCode' => $error->getSubStatus(), 'Message' => $error->getStatusMessage(), - ); + ]; $ar->setStatus($status); - $statsData = array( + $statsData = [ 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'protocol' => 'saml2', 'error' => $status, - ); + ]; if (isset($state['saml:AuthnRequestReceivedAt'])) { $statsData['logintime'] = microtime(true) - $state['saml:AuthnRequestReceivedAt']; } @@ -254,7 +254,7 @@ class SAML2 $metadata = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); $idpMetadata = $idp->getConfig(); - $supportedBindings = array(\SAML2\Constants::BINDING_HTTP_POST); + $supportedBindings = [\SAML2\Constants::BINDING_HTTP_POST]; if ($idpMetadata->getBoolean('saml20.sendartifact', false)) { $supportedBindings[] = \SAML2\Constants::BINDING_HTTP_ARTIFACT; } @@ -301,7 +301,7 @@ class SAML2 } $requestId = null; - $IDPList = array(); + $IDPList = []; $ProxyCount = null; $RequesterID = null; $forceAuthn = false; @@ -374,14 +374,14 @@ class SAML2 ); } - \SimpleSAML\Stats::log('saml:idp:AuthnRequest', array( + \SimpleSAML\Stats::log('saml:idp:AuthnRequest', [ 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'forceAuthn' => $forceAuthn, 'isPassive' => $isPassive, 'protocol' => 'saml2', 'idpInit' => $idpInit, - )); + ]); $acsEndpoint = self::getAssertionConsumerService( $supportedBindings, @@ -391,7 +391,7 @@ class SAML2 $consumerIndex ); - $IDPList = array_unique(array_merge($IDPList, $spMetadata->getArrayizeString('IDPList', array()))); + $IDPList = array_unique(array_merge($IDPList, $spMetadata->getArrayizeString('IDPList', []))); if ($ProxyCount === null) { $ProxyCount = $spMetadata->getInteger('ProxyCount', null); } @@ -400,10 +400,10 @@ class SAML2 $forceAuthn = $spMetadata->getBoolean('ForceAuthn', false); } - $sessionLostParams = array( + $sessionLostParams = [ 'spentityid' => $spEntityId, 'cookieTime' => time(), - ); + ]; if ($relayState !== null) { $sessionLostParams['RelayState'] = $relayState; } @@ -413,10 +413,13 @@ class SAML2 $sessionLostParams ); - $state = array( - 'Responder' => array('\SimpleSAML\Module\saml\IdP\SAML2', 'sendResponse'), - \SimpleSAML\Auth\State::EXCEPTION_HANDLER_FUNC => array('\SimpleSAML\Module\saml\IdP\SAML2', 'handleAuthError'), - \SimpleSAML\Auth\State::RESTART => $sessionLostURL, + $state = [ + 'Responder' => ['\SimpleSAML\Module\saml\IdP\SAML2', 'sendResponse'], + \SimpleSAML\Auth\State::EXCEPTION_HANDLER_FUNC => [ + '\SimpleSAML\Module\saml\IdP\SAML2', + 'handleAuthError' + ], + \SimpleSAML\Auth\State::RESTART => $sessionLostURL, 'SPMetadata' => $spMetadata->toArray(), 'saml:RelayState' => $relayState, @@ -433,7 +436,7 @@ class SAML2 'saml:Extensions' => $extensions, 'saml:AuthnRequestReceivedAt' => microtime(true), 'saml:RequestedAuthnContext' => $authnContext, - ); + ]; // ECP AuthnRequests need to supply credentials if ($binding instanceof SOAP) { @@ -472,17 +475,17 @@ class SAML2 $idpMetadata = $idp->getConfig(); $spMetadata = $metadata->getMetaDataConfig($association['saml:entityID'], 'saml20-sp-remote'); - \SimpleSAML\Stats::log('saml:idp:LogoutRequest:sent', array( + \SimpleSAML\Stats::log('saml:idp:LogoutRequest:sent', [ 'spEntityID' => $association['saml:entityID'], 'idpEntityID' => $idpMetadata->getString('entityid'), - )); + ]); $dst = $spMetadata->getEndpointPrioritizedByBinding( 'SingleLogoutService', - array( + [ \SAML2\Constants::BINDING_HTTP_REDIRECT, \SAML2\Constants::BINDING_HTTP_POST - ) + ] ); $binding = \SAML2\Binding::getBinding($dst['Binding']); $lr = self::buildLogoutRequest($idpMetadata, $spMetadata, $association, $relayState); @@ -516,27 +519,27 @@ class SAML2 if (isset($state['core:Failed']) && $state['core:Failed']) { $partial = true; - $lr->setStatus(array( + $lr->setStatus([ 'Code' => \SAML2\Constants::STATUS_SUCCESS, 'SubCode' => \SAML2\Constants::STATUS_PARTIAL_LOGOUT, - )); + ]); Logger::info('Sending logout response for partial logout to SP '.var_export($spEntityId, true)); } else { $partial = false; Logger::debug('Sending logout response to SP '.var_export($spEntityId, true)); } - \SimpleSAML\Stats::log('saml:idp:LogoutResponse:sent', array( + \SimpleSAML\Stats::log('saml:idp:LogoutResponse:sent', [ 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), 'partial' => $partial - )); + ]); $dst = $spMetadata->getEndpointPrioritizedByBinding( 'SingleLogoutService', - array( + [ \SAML2\Constants::BINDING_HTTP_REDIRECT, \SAML2\Constants::BINDING_HTTP_POST - ) + ] ); $binding = \SAML2\Binding::getBinding($dst['Binding']); if (isset($dst['ResponseLocation'])) { @@ -575,10 +578,10 @@ class SAML2 if ($message instanceof \SAML2\LogoutResponse) { Logger::info('Received SAML 2.0 LogoutResponse from: '.var_export($spEntityId, true)); - $statsData = array( + $statsData = [ 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), - ); + ]; if (!$message->isSuccess()) { $statsData['error'] = $message->getStatus(); } @@ -598,20 +601,20 @@ class SAML2 $idp->handleLogoutResponse($assocId, $relayState, $logoutError); } elseif ($message instanceof \SAML2\LogoutRequest) { Logger::info('Received SAML 2.0 LogoutRequest from: '.var_export($spEntityId, true)); - \SimpleSAML\Stats::log('saml:idp:LogoutRequest:recv', array( + \SimpleSAML\Stats::log('saml:idp:LogoutRequest:recv', [ 'spEntityID' => $spEntityId, 'idpEntityID' => $idpMetadata->getString('entityid'), - )); + ]); $spStatsId = $spMetadata->getString('core:statistics-id', $spEntityId); Logger::stats('saml20-idp-SLO spinit '.$spStatsId.' '.$idpMetadata->getString('entityid')); - $state = array( - 'Responder' => array('\SimpleSAML\Module\saml\IdP\SAML2', 'sendLogoutResponse'), + $state = [ + 'Responder' => ['\SimpleSAML\Module\saml\IdP\SAML2', 'sendLogoutResponse'], 'saml:SPEntityId' => $spEntityId, 'saml:RelayState' => $message->getRelayState(), 'saml:RequestId' => $message->getId(), - ); + ]; $assocId = 'saml:'.$spEntityId; $idp->handleLogoutRequest($state, $assocId); @@ -640,14 +643,14 @@ class SAML2 $idpMetadata = $idp->getConfig(); $spMetadata = $metadata->getMetaDataConfig($association['saml:entityID'], 'saml20-sp-remote'); - $bindings = array( + $bindings = [ \SAML2\Constants::BINDING_HTTP_REDIRECT, \SAML2\Constants::BINDING_HTTP_POST - ); + ]; $dst = $spMetadata->getEndpointPrioritizedByBinding('SingleLogoutService', $bindings); if ($dst['Binding'] === \SAML2\Constants::BINDING_HTTP_POST) { - $params = array('association' => $association['id'], 'idp' => $idp->getId()); + $params = ['association' => $association['id'], 'idp' => $idp->getId()]; if ($relayState !== null) { $params['RelayState'] = $relayState; } @@ -676,7 +679,7 @@ class SAML2 try { return $metadata->getMetaDataConfig($association['saml:entityID'], 'saml20-sp-remote'); } catch (\Exception $e) { - return Configuration::loadFromArray(array(), 'Unknown SAML 2 entity.'); + return Configuration::loadFromArray([], 'Unknown SAML 2 entity.'); } } @@ -688,7 +691,7 @@ class SAML2 * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. * @param array &$state The authentication state of the user. * - * @return string The NameID value. + * @return string|null The NameID value. */ private static function generateNameIdValue( Configuration $idpMetadata, @@ -758,8 +761,8 @@ class SAML2 $defaultEncoding = 'string'; } - $srcEncodings = $idpMetadata->getArray('attributeencodings', array()); - $dstEncodings = $spMetadata->getArray('attributeencodings', array()); + $srcEncodings = $idpMetadata->getArray('attributeencodings', []); + $dstEncodings = $spMetadata->getArray('attributeencodings', []); /* * Merge the two encoding arrays. Encodings specified in the target metadata @@ -767,9 +770,9 @@ class SAML2 */ $encodings = array_merge($srcEncodings, $dstEncodings); - $ret = array(); + $ret = []; foreach ($attributes as $name => $values) { - $ret[$name] = array(); + $ret[$name] = []; if (array_key_exists($name, $encodings)) { $encoding = $encodings[$name]; } else { @@ -885,7 +888,7 @@ class SAML2 } $a->setIssuer($idpMetadata->getString('entityid')); - $a->setValidAudiences(array($spMetadata->getString('entityid'))); + $a->setValidAudiences([$spMetadata->getString('entityid')]); $a->setNotBefore($now - 30); @@ -897,6 +900,8 @@ class SAML2 if (isset($state['saml:AuthnContextClassRef'])) { $a->setAuthnContextClassRef($state['saml:AuthnContextClassRef']); + } elseif (\SimpleSAML\Utils\HTTP::isHTTPS()) { + $a->setAuthnContextClassRef(\SAML2\Constants::AC_PASSWORD_PROTECTED_TRANSPORT); } else { $a->setAuthnContextClassRef(\SAML2\Constants::AC_PASSWORD); } @@ -938,7 +943,7 @@ class SAML2 if (preg_match($pattern, $clientCert, $matches)) { // we have a client certificate from the browser which we add to the HoK assertion $x509Certificate = new \SAML2\XML\ds\X509Certificate(); - $x509Certificate->certificate = str_replace(array("\r", "\n", " "), '', $matches[1]); + $x509Certificate->certificate = str_replace(["\r", "\n", " "], '', $matches[1]); $x509Data = new \SAML2\XML\ds\X509Data(); $x509Data->data[] = $x509Certificate; @@ -967,7 +972,7 @@ class SAML2 // Bearer $sc->Method = \SAML2\Constants::CM_BEARER; } - $a->setSubjectConfirmation(array($sc)); + $a->setSubjectConfirmation([$sc]); // add attributes if ($spMetadata->getBoolean('simplesaml.attributes', true)) { @@ -1085,7 +1090,7 @@ class SAML2 } // extract the public key from the certificate for encryption - $key = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type' => 'public')); + $key = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, ['type' => 'public']); $key->loadKey($pemKey); } else { throw new \SimpleSAML\Error\ConfigurationError( @@ -1146,9 +1151,9 @@ class SAML2 * * @param \SimpleSAML\Configuration $idpMetadata The metadata of the IdP. * @param \SimpleSAML\Configuration $spMetadata The metadata of the SP. - * @param string $consumerURL The Destination URL of the response. + * @param string $consumerURL The Destination URL of the response. * - * @return \SAML2\LogoutResponse The SAML2 LogoutResponse corresponding to the given data. + * @return \SAML2\Response The SAML2 Response corresponding to the given data. */ private static function buildResponse( Configuration $idpMetadata, diff --git a/modules/saml/lib/IdP/SQLNameID.php b/modules/saml/lib/IdP/SQLNameID.php index f07ff36e2ff644f25cd969f4138fbe563f72b239..95d5712df26a64a808b072144af9e397b905acee 100644 --- a/modules/saml/lib/IdP/SQLNameID.php +++ b/modules/saml/lib/IdP/SQLNameID.php @@ -30,7 +30,8 @@ class SQLNameID )'; $store->pdo->exec($query); - $query = 'CREATE INDEX '.$store->prefix.'_saml_PersistentNameID_idp_sp ON '.$store->prefix.'_saml_PersistentNameID (_idp, _sp)'; + $query = 'CREATE INDEX '.$store->prefix.'_saml_PersistentNameID_idp_sp ON '; + $query .= $store->prefix.'_saml_PersistentNameID (_idp, _sp)'; $store->pdo->exec($query); $store->setTableVersion('saml_PersistentNameID', 1); @@ -48,7 +49,9 @@ class SQLNameID { $store = \SimpleSAML\Store::getInstance(); if (!($store instanceof \SimpleSAML\Store\SQL)) { - throw new \SimpleSAML\Error\Exception('SQL NameID store requires SimpleSAMLphp to be configured with a SQL datastore.'); + throw new \SimpleSAML\Error\Exception( + 'SQL NameID store requires SimpleSAMLphp to be configured with a SQL datastore.' + ); } self::createTable($store); @@ -75,14 +78,15 @@ class SQLNameID $store = self::getStore(); - $params = array( + $params = [ '_idp' => $idpEntityId, '_sp' => $spEntityId, '_user' => $user, '_value' => $value, - ); + ]; - $query = 'INSERT INTO '.$store->prefix.'_saml_PersistentNameID (_idp, _sp, _user, _value) VALUES(:_idp, :_sp, :_user, :_value)'; + $query = 'INSERT INTO '.$store->prefix; + $query .= '_saml_PersistentNameID (_idp, _sp, _user, _value) VALUES(:_idp, :_sp, :_user, :_value)'; $query = $store->pdo->prepare($query); $query->execute($params); } @@ -104,13 +108,14 @@ class SQLNameID $store = self::getStore(); - $params = array( + $params = [ '_idp' => $idpEntityId, '_sp' => $spEntityId, '_user' => $user, - ); + ]; - $query = 'SELECT _value FROM '.$store->prefix.'_saml_PersistentNameID WHERE _idp = :_idp AND _sp = :_sp AND _user = :_user'; + $query = 'SELECT _value FROM '.$store->prefix; + $query .= '_saml_PersistentNameID WHERE _idp = :_idp AND _sp = :_sp AND _user = :_user'; $query = $store->pdo->prepare($query); $query->execute($params); @@ -139,13 +144,14 @@ class SQLNameID $store = self::getStore(); - $params = array( + $params = [ '_idp' => $idpEntityId, '_sp' => $spEntityId, '_user' => $user, - ); + ]; - $query = 'DELETE FROM '.$store->prefix.'_saml_PersistentNameID WHERE _idp = :_idp AND _sp = :_sp AND _user = :_user'; + $query = 'DELETE FROM '.$store->prefix; + $query .= '_saml_PersistentNameID WHERE _idp = :_idp AND _sp = :_sp AND _user = :_user'; $query = $store->pdo->prepare($query); $query->execute($params); } @@ -165,16 +171,17 @@ class SQLNameID $store = self::getStore(); - $params = array( + $params = [ '_idp' => $idpEntityId, '_sp' => $spEntityId, - ); + ]; - $query = 'SELECT _user, _value FROM '.$store->prefix.'_saml_PersistentNameID WHERE _idp = :_idp AND _sp = :_sp'; + $query = 'SELECT _user, _value FROM '.$store->prefix; + $query .= '_saml_PersistentNameID WHERE _idp = :_idp AND _sp = :_sp'; $query = $store->pdo->prepare($query); $query->execute($params); - $res = array(); + $res = []; while (($row = $query->fetch(\PDO::FETCH_ASSOC)) !== false) { $res[$row['_user']] = $row['_value']; } diff --git a/modules/saml/lib/Message.php b/modules/saml/lib/Message.php index 8cc89f6478f683028838b88f3cdc9e6ca968ea06..1af7164e83deb500bace45ee125e7fb1349324c2 100644 --- a/modules/saml/lib/Message.php +++ b/modules/saml/lib/Message.php @@ -38,7 +38,7 @@ class Message $algo = $srcMetadata->getString('signature.algorithm', XMLSecurityKey::RSA_SHA256); } - $privateKey = new XMLSecurityKey($algo, array('type' => 'private')); + $privateKey = new XMLSecurityKey($algo, ['type' => 'private']); if (array_key_exists('password', $keyArray)) { $privateKey->passphrase = $keyArray['password']; } @@ -56,7 +56,7 @@ class Message return; } - $element->setCertificates(array($certArray['PEM'])); + $element->setCertificates([$certArray['PEM']]); } @@ -114,7 +114,7 @@ class Message */ private static function findCertificate(array $certFingerprints, array $certificates) { - $candidates = array(); + $candidates = []; foreach ($certificates as $cert) { $fp = strtolower(sha1(base64_decode($cert))); @@ -152,7 +152,7 @@ class Message // find the public key that should verify signatures by this entity $keys = $srcMetadata->getPublicKeys('signing'); if (!empty($keys)) { - $pemKeys = array(); + $pemKeys = []; foreach ($keys as $key) { switch ($key['type']) { case 'X509Certificate': @@ -187,7 +187,7 @@ class Message } $pemCert = self::findCertificate($certFingerprint, $certificates); - $pemKeys = array($pemCert); + $pemKeys = [$pemCert]; } else { throw new \SimpleSAML\Error\Exception( 'Missing certificate in metadata for '. @@ -199,7 +199,7 @@ class Message $lastException = null; foreach ($pemKeys as $i => $pem) { - $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, array('type' => 'public')); + $key = new XMLSecurityKey(XMLSecurityKey::RSA_SHA256, ['type' => 'public']); $key->loadKey($pem); try { @@ -287,17 +287,17 @@ class Message if ($sharedKey !== null) { $key = new XMLSecurityKey(XMLSecurityKey::AES128_CBC); $key->loadKey($sharedKey); - return array($key); + return [$key]; } - $keys = array(); + $keys = []; // load the new private key if it exists $keyArray = \SimpleSAML\Utils\Crypto::loadPrivateKey($dstMetadata, false, 'new_'); if ($keyArray !== null) { assert(isset($keyArray['PEM'])); - $key = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, array('type' => 'private')); + $key = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, ['type' => 'private']); if (array_key_exists('password', $keyArray)) { $key->passphrase = $keyArray['password']; } @@ -309,7 +309,7 @@ class Message $keyArray = \SimpleSAML\Utils\Crypto::loadPrivateKey($dstMetadata, true); assert(isset($keyArray['PEM'])); - $key = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, array('type' => 'private')); + $key = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, ['type' => 'private']); if (array_key_exists('password', $keyArray)) { $key->passphrase = $keyArray['password']; } @@ -336,7 +336,7 @@ class Message ) { $blacklist = $srcMetadata->getArray('encryption.blacklisted-algorithms', null); if ($blacklist === null) { - $blacklist = $dstMetadata->getArray('encryption.blacklisted-algorithms', array(XMLSecurityKey::RSA_1_5)); + $blacklist = $dstMetadata->getArray('encryption.blacklisted-algorithms', [XMLSecurityKey::RSA_1_5]); } return $blacklist; } @@ -471,7 +471,7 @@ class Message $ar = new \SAML2\AuthnRequest(); // get the NameIDPolicy to apply. IdP metadata has precedence. - $nameIdPolicy = array(); + $nameIdPolicy = []; if ($idpMetadata->hasValue('NameIDPolicy')) { $nameIdPolicy = $idpMetadata->getValue('NameIDPolicy'); } elseif ($spMetadata->hasValue('NameIDPolicy')) { @@ -480,14 +480,14 @@ class Message if (!is_array($nameIdPolicy)) { // handle old configurations where 'NameIDPolicy' was used to specify just the format - $nameIdPolicy = array('Format' => $nameIdPolicy); + $nameIdPolicy = ['Format' => $nameIdPolicy]; } $nameIdPolicy_cf = \SimpleSAML\Configuration::loadFromArray($nameIdPolicy); - $policy = array( + $policy = [ 'Format' => $nameIdPolicy_cf->getString('Format', \SAML2\Constants::NAMEID_TRANSIENT), 'AllowCreate' => $nameIdPolicy_cf->getBoolean('AllowCreate', true), - ); + ]; $spNameQualifier = $nameIdPolicy_cf->getString('SPNameQualifier', false); if ($spNameQualifier !== false) { $policy['SPNameQualifier'] = $spNameQualifier; @@ -497,12 +497,12 @@ class Message $ar->setForceAuthn($spMetadata->getBoolean('ForceAuthn', false)); $ar->setIsPassive($spMetadata->getBoolean('IsPassive', false)); - $protbind = $spMetadata->getValueValidate('ProtocolBinding', array( + $protbind = $spMetadata->getValueValidate('ProtocolBinding', [ \SAML2\Constants::BINDING_HTTP_POST, \SAML2\Constants::BINDING_HOK_SSO, \SAML2\Constants::BINDING_HTTP_ARTIFACT, \SAML2\Constants::BINDING_HTTP_REDIRECT, - ), \SAML2\Constants::BINDING_HTTP_POST); + ], \SAML2\Constants::BINDING_HTTP_POST); // Shoaib: setting the appropriate binding based on parameter in sp-metadata defaults to HTTP_POST $ar->setProtocolBinding($protbind); @@ -512,13 +512,13 @@ class Message if ($spMetadata->hasValue('AuthnContextClassRef')) { $accr = $spMetadata->getArrayizeString('AuthnContextClassRef'); - $comp = $spMetadata->getValueValidate('AuthnContextComparison', array( + $comp = $spMetadata->getValueValidate('AuthnContextComparison', [ \SAML2\Constants::COMPARISON_EXACT, \SAML2\Constants::COMPARISON_MINIMUM, \SAML2\Constants::COMPARISON_MAXIMUM, \SAML2\Constants::COMPARISON_BETTER, - ), \SAML2\Constants::COMPARISON_EXACT); - $ar->setRequestedAuthnContext(array('AuthnContextClassRef' => $accr, 'Comparison' => $comp)); + ], \SAML2\Constants::COMPARISON_EXACT); + $ar->setRequestedAuthnContext(['AuthnContextClassRef' => $accr, 'Comparison' => $comp]); } self::addRedirectSign($spMetadata, $idpMetadata, $ar); @@ -609,7 +609,7 @@ class Message throw new \SimpleSAML\Error\Exception('No assertions found in response from IdP.'); } - $ret = array(); + $ret = []; foreach ($assertion as $a) { $ret[] = self::processAssertion($spMetadata, $idpMetadata, $response, $a, $responseSigned); } @@ -686,7 +686,7 @@ class Message $found = false; $lastError = 'No SubjectConfirmation element in Subject.'; - $validSCMethods = array(\SAML2\Constants::CM_BEARER, \SAML2\Constants::CM_HOK, \SAML2\Constants::CM_VOUCHES); + $validSCMethods = [\SAML2\Constants::CM_BEARER, \SAML2\Constants::CM_HOK, \SAML2\Constants::CM_VOUCHES]; foreach ($assertion->getSubjectConfirmation() as $sc) { if (!in_array($sc->Method, $validSCMethods, true)) { $lastError = 'Invalid Method on SubjectConfirmation: '.var_export($sc->Method, true); @@ -728,9 +728,9 @@ class Message continue; } // we have a valid client certificate from the browser - $clientCert = str_replace(array("\r", "\n", " "), '', $matches[1]); + $clientCert = str_replace(["\r", "\n", " "], '', $matches[1]); - $keyInfo = array(); + $keyInfo = []; foreach ($scd->info as $thing) { if ($thing instanceof \SAML2\XML\ds\KeyInfo) { $keyInfo[] = $thing; @@ -742,7 +742,7 @@ class Message continue; } - $x509data = array(); + $x509data = []; foreach ($keyInfo[0]->info as $thing) { if ($thing instanceof \SAML2\XML\ds\X509Data) { $x509data[] = $thing; @@ -754,7 +754,7 @@ class Message continue; } - $x509cert = array(); + $x509cert = []; foreach ($x509data[0]->data as $thing) { if ($thing instanceof \SAML2\XML\ds\X509Certificate) { $x509cert[] = $thing; @@ -811,9 +811,9 @@ class Message // maybe we need to base64 decode the attributes in the assertion? if ($idpMetadata->getBoolean('base64attributes', false)) { $attributes = $assertion->getAttributes(); - $newAttributes = array(); + $newAttributes = []; foreach ($attributes as $name => $values) { - $newAttributes[$name] = array(); + $newAttributes[$name] = []; foreach ($values as $value) { foreach (explode('_', $value) as $v) { $newAttributes[$name][] = base64_decode($v); @@ -880,7 +880,7 @@ class Message $pemKey = "-----BEGIN CERTIFICATE-----\n". chunk_split($key['X509Certificate'], 64). "-----END CERTIFICATE-----\n"; - $key = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, array('type' => 'public')); + $key = new XMLSecurityKey(XMLSecurityKey::RSA_OAEP_MGF1P, ['type' => 'public']); $key->loadKey($pemKey); return $key; } diff --git a/modules/saml/lib/SP/LogoutStore.php b/modules/saml/lib/SP/LogoutStore.php index b3db87991abdd11fb712c6bcc843c8c91b29f148..8ea35423a5c3e81bd937f1d7bcd9cff1857f547d 100644 --- a/modules/saml/lib/SP/LogoutStore.php +++ b/modules/saml/lib/SP/LogoutStore.php @@ -25,10 +25,12 @@ class LogoutStore switch ($store->driver) { case 'pgsql': // This does not affect the NOT NULL constraint - $query = 'ALTER TABLE '.$store->prefix.'_saml_LogoutStore ALTER COLUMN _authSource TYPE VARCHAR(255)'; + $query = 'ALTER TABLE '.$store->prefix. + '_saml_LogoutStore ALTER COLUMN _authSource TYPE VARCHAR(255)'; break; default: - $query = 'ALTER TABLE '.$store->prefix.'_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL'; + $query = 'ALTER TABLE '.$store->prefix. + '_saml_LogoutStore MODIFY _authSource VARCHAR(255) NOT NULL'; break; } @@ -52,10 +54,12 @@ class LogoutStore )'; $store->pdo->exec($query); - $query = 'CREATE INDEX '.$store->prefix.'_saml_LogoutStore_expire ON '.$store->prefix.'_saml_LogoutStore (_expire)'; + $query = 'CREATE INDEX '.$store->prefix.'_saml_LogoutStore_expire ON '; + $query .= $store->prefix.'_saml_LogoutStore (_expire)'; $store->pdo->exec($query); - $query = 'CREATE INDEX '.$store->prefix.'_saml_LogoutStore_nameId ON '.$store->prefix.'_saml_LogoutStore (_authSource, _nameId)'; + $query = 'CREATE INDEX '.$store->prefix.'_saml_LogoutStore_nameId ON '; + $query .= $store->prefix.'_saml_LogoutStore (_authSource, _nameId)'; $store->pdo->exec($query); $store->setTableVersion('saml_LogoutStore', 2); @@ -72,7 +76,7 @@ class LogoutStore \SimpleSAML\Logger::debug('saml.LogoutStore: Cleaning logout store.'); $query = 'DELETE FROM '.$store->prefix.'_saml_LogoutStore WHERE _expire < :now'; - $params = array('now' => gmdate('Y-m-d H:i:s')); + $params = ['now' => gmdate('Y-m-d H:i:s')]; $query = $store->pdo->prepare($query); $query->execute($params); @@ -87,8 +91,14 @@ class LogoutStore * @param string $nameId The hash of the users NameID. * @param string $sessionIndex The SessionIndex of the user. */ - private static function addSessionSQL(\SimpleSAML\Store\SQL $store, $authId, $nameId, $sessionIndex, $expire, $sessionId) - { + private static function addSessionSQL( + \SimpleSAML\Store\SQL $store, + $authId, + $nameId, + $sessionIndex, + $expire, + $sessionId + ) { assert(is_string($authId)); assert(is_string($nameId)); assert(is_string($sessionIndex)); @@ -101,14 +111,18 @@ class LogoutStore self::cleanLogoutStore($store); } - $data = array( + $data = [ '_authSource' => $authId, '_nameId' => $nameId, '_sessionIndex' => $sessionIndex, '_expire' => gmdate('Y-m-d H:i:s', $expire), '_sessionId' => $sessionId, + ]; + $store->insertOrUpdate( + $store->prefix.'_saml_LogoutStore', + ['_authSource', '_nameId', '_sessionIndex'], + $data ); - $store->insertOrUpdate($store->prefix.'_saml_LogoutStore', array('_authSource', '_nameId', '_sessionIndex'), $data); } @@ -127,19 +141,19 @@ class LogoutStore self::createLogoutTable($store); - $params = array( + $params = [ '_authSource' => $authId, '_nameId' => $nameId, 'now' => gmdate('Y-m-d H:i:s'), - ); + ]; // We request the columns in lowercase in order to be compatible with PostgreSQL - $query = 'SELECT _sessionIndex AS _sessionindex, _sessionId AS _sessionid FROM '.$store->prefix.'_saml_LogoutStore'. - ' WHERE _authSource = :_authSource AND _nameId = :_nameId AND _expire >= :now'; + $query = 'SELECT _sessionIndex AS _sessionindex, _sessionId AS _sessionid FROM '.$store->prefix; + $query .= '_saml_LogoutStore'.' WHERE _authSource = :_authSource AND _nameId = :_nameId AND _expire >= :now'; $query = $store->pdo->prepare($query); $query->execute($params); - $res = array(); + $res = []; while (($row = $query->fetch(\PDO::FETCH_ASSOC)) !== false) { $res[$row['_sessionindex']] = $row['_sessionid']; } @@ -162,7 +176,7 @@ class LogoutStore assert(is_string($authId)); assert(is_string($nameId)); - $res = array(); + $res = []; foreach ($sessionIndexes as $sessionIndex) { $sessionId = $store->get('saml.LogoutStore', $nameId.':'.$sessionIndex); if ($sessionId === null) { @@ -267,7 +281,9 @@ class LogoutStore $sessionIndex = sha1($sessionIndex); } } - unset($sessionIndex); // Remove reference + + // Remove reference + unset($sessionIndex); if ($store instanceof \SimpleSAML\Store\SQL) { $sessions = self::getSessionsSQL($store, $authId, $strNameId); @@ -277,7 +293,6 @@ class LogoutStore } else { /** @var \SimpleSAML\Store $sessions At this point the store cannot be false */ $sessions = self::getSessionsStore($store, $authId, $strNameId, $sessionIndexes); - } if (empty($sessionIndexes)) { @@ -300,11 +315,15 @@ class LogoutStore } if (!$session->isValid($authId)) { - \SimpleSAML\Logger::info('saml.LogoutStore: Skipping logout of session because it isn\'t authenticated.'); + \SimpleSAML\Logger::info( + 'saml.LogoutStore: Skipping logout of session because it isn\'t authenticated.' + ); continue; } - \SimpleSAML\Logger::info('saml.LogoutStore: Logging out of session with trackId ['.$session->getTrackID().'].'); + \SimpleSAML\Logger::info( + 'saml.LogoutStore: Logging out of session with trackId ['.$session->getTrackID().'].' + ); $session->doLogout($authId); $numLoggedOut += 1; } diff --git a/modules/saml/templates/proxy/invalid_session.php b/modules/saml/templates/proxy/invalid_session.php index 94d63f9cdaa4cf5f510cc01d7c14bf8a427c3536..ede358580d665a0a8c88c8b340931d97d458debd 100644 --- a/modules/saml/templates/proxy/invalid_session.php +++ b/modules/saml/templates/proxy/invalid_session.php @@ -16,10 +16,10 @@ $this->includeAtTemplateBase('includes/header.php'); $translator = $this->getTranslator(); -$params = array( +$params = [ '%IDP%' => $this->data['idp_name'], '%SP%' => $this->data['sp_name'], -); +]; ?> <h2><?php echo $translator->t('{saml:proxy:invalid_idp}'); ?></h2> <p><?php echo $translator->t('{saml:proxy:invalid_idp_description}', $params); ?></p> diff --git a/modules/saml/www/disco.php b/modules/saml/www/disco.php index 147338f0d6d3ea980bcbcd8eea4afe2fa514a747..b7d06c454550a1dab8eab8edb181c4a6a750e379 100644 --- a/modules/saml/www/disco.php +++ b/modules/saml/www/disco.php @@ -4,5 +4,5 @@ * Built-in IdP discovery service. */ -$discoHandler = new \SimpleSAML\XHTML\IdPDisco(array('saml20-idp-remote', 'shib13-idp-remote'), 'saml'); +$discoHandler = new \SimpleSAML\XHTML\IdPDisco(['saml20-idp-remote', 'shib13-idp-remote'], 'saml'); $discoHandler->handleRequest(); diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php index 7ed92b3c32c02401c7dcdbc7ae81e46f4985aac6..355218d0820c791696b16f6ff4ae839c3ce0d82b 100644 --- a/modules/saml/www/sp/metadata.php +++ b/modules/saml/www/sp/metadata.php @@ -15,20 +15,22 @@ if ($source === null) { } if (!($source instanceof \SimpleSAML\Module\saml\Auth\Source\SP)) { - throw new \SimpleSAML\Error\AuthSource($sourceId, - 'The authentication source is not a SAML Service Provider.'); + throw new \SimpleSAML\Error\AuthSource( + $sourceId, + 'The authentication source is not a SAML Service Provider.' + ); } $entityId = $source->getEntityId(); $spconfig = $source->getMetadata(); $store = \SimpleSAML\Store::getInstance(); -$metaArray20 = array(); +$metaArray20 = []; -$slosvcdefault = array( +$slosvcdefault = [ \SAML2\Constants::BINDING_HTTP_REDIRECT, \SAML2\Constants::BINDING_SOAP, -); +]; $slob = $spconfig->getArray('SingleLogoutServiceBinding', $slosvcdefault); $slol = \SimpleSAML\Module::getModuleURL('saml/sp/saml2-logout.php/'.$sourceId); @@ -38,18 +40,18 @@ foreach ($slob as $binding) { // we cannot properly support SOAP logout continue; } - $metaArray20['SingleLogoutService'][] = array( + $metaArray20['SingleLogoutService'][] = [ 'Binding' => $binding, 'Location' => $slol, - ); + ]; } -$assertionsconsumerservicesdefault = array( +$assertionsconsumerservicesdefault = [ 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post', 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01', -); +]; if ($spconfig->getString('ProtocolBinding', '') == 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser') { $assertionsconsumerservicesdefault[] = 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser'; @@ -58,11 +60,10 @@ if ($spconfig->getString('ProtocolBinding', '') == 'urn:oasis:names:tc:SAML:2.0: $assertionsconsumerservices = $spconfig->getArray('acs.Bindings', $assertionsconsumerservicesdefault); $index = 0; -$eps = array(); -$supported_protocols = array(); +$eps = []; +$supported_protocols = []; foreach ($assertionsconsumerservices as $services) { - - $acsArray = array('index' => $index); + $acsArray = ['index' => $index]; switch ($services) { case 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST': $acsArray['Binding'] = \SAML2\Constants::BINDING_HTTP_POST; @@ -107,19 +108,19 @@ foreach ($assertionsconsumerservices as $services) { $metaArray20['AssertionConsumerService'] = $eps; -$keys = array(); +$keys = []; $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($spconfig, false, 'new_'); if ($certInfo !== null && array_key_exists('certData', $certInfo)) { $hasNewCert = true; $certData = $certInfo['certData']; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => true, 'X509Certificate' => $certInfo['certData'], - ); + ]; } else { $hasNewCert = false; } @@ -128,12 +129,12 @@ $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($spconfig); if ($certInfo !== null && array_key_exists('certData', $certInfo)) { $certData = $certInfo['certData']; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => ($hasNewCert ? false : true), 'X509Certificate' => $certInfo['certData'], - ); + ]; } else { $certData = null; } @@ -144,12 +145,12 @@ if ($format !== null) { } $name = $spconfig->getLocalizedString('name', null); -$attributes = $spconfig->getArray('attributes', array()); +$attributes = $spconfig->getArray('attributes', []); if ($name !== null && !empty($attributes)) { $metaArray20['name'] = $name; $metaArray20['attributes'] = $attributes; - $metaArray20['attributes.required'] = $spconfig->getArray('attributes.required', array()); + $metaArray20['attributes.required'] = $spconfig->getArray('attributes.required', []); if (empty($metaArray20['attributes.required'])) { unset($metaArray20['attributes.required']); @@ -260,7 +261,6 @@ if (isset($metaArray20['attributes']) && is_array($metaArray20['attributes'])) { $xml = \SimpleSAML\Metadata\Signer::sign($xml, $spconfig->toArray(), 'SAML 2 SP'); if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] == 'xhtml') { - $t = new \SimpleSAML\XHTML\Template($config, 'metadata.php', 'admin'); $t->data['clipboard.js'] = true; diff --git a/modules/saml/www/sp/saml1-acs.php b/modules/saml/www/sp/saml1-acs.php index c6be5c70149998fefed8fd312a71d14ed3d9f21a..db18627fd98e37ac800e7609708f392d23cb0057 100644 --- a/modules/saml/www/sp/saml1-acs.php +++ b/modules/saml/www/sp/saml1-acs.php @@ -29,18 +29,20 @@ $target = (string) $_REQUEST['TARGET']; if (preg_match('@^https?://@i', $target)) { // Unsolicited response - $state = array( + $state = [ 'saml:sp:isUnsolicited' => true, 'saml:sp:AuthId' => $sourceId, 'saml:sp:RelayState' => \SimpleSAML\Utils\HTTP::checkURLAllowed($target), - ); + ]; } else { $state = \SimpleSAML\Auth\State::loadState($_REQUEST['TARGET'], 'saml:sp:sso'); - // Check that the authentication source is correct. + // Check that the authentication source is correct assert(array_key_exists('saml:sp:AuthId', $state)); if ($state['saml:sp:AuthId'] !== $sourceId) { - throw new \SimpleSAML\Error\Exception('The authentication source id in the URL does not match the authentication source which sent the request.'); + throw new \SimpleSAML\Error\Exception( + 'The authentication source id in the URL does not match the authentication source which sent the request.' + ); } assert(isset($state['saml:idp'])); @@ -50,8 +52,10 @@ $spMetadata = $source->getMetadata(); if (array_key_exists('SAMLart', $_REQUEST)) { if (!isset($state['saml:idp'])) { - /* Unsolicited response. */ - throw new \SimpleSAML\Error\Exception('IdP initiated authentication not supported with the SAML 1.1 SAMLart protocol.'); + // Unsolicited response + throw new \SimpleSAML\Error\Exception( + 'IdP initiated authentication not supported with the SAML 1.1 SAMLart protocol.' + ); } $idpMetadata = $source->getIdPMetadata($state['saml:idp']); @@ -78,9 +82,9 @@ if (isset($state['saml:idp']) && $responseIssuer !== $state['saml:idp']) { throw new \SimpleSAML\Error\Exception('The issuer of the response wasn\'t the destination of the request.'); } -$logoutState = array( +$logoutState = [ 'saml:logout:Type' => 'saml1' - ); +]; $state['LogoutState'] = $logoutState; $state['saml:sp:NameID'] = $response->getNameID(); diff --git a/modules/saml/www/sp/saml2-acs.php b/modules/saml/www/sp/saml2-acs.php index 859c287832028318b9bd94b090ddd7f4fcb2acc1..9dcec80c5b762c119c7014a3269da63e1a63e36f 100644 --- a/modules/saml/www/sp/saml2-acs.php +++ b/modules/saml/www/sp/saml2-acs.php @@ -72,7 +72,7 @@ if ($prevAuth !== null && $prevAuth['id'] === $response->getId() && $prevAuth['i throw new \SimpleSAML\Error\Exception('Duplicate assertion received.'); } -$idpMetadata = array(); +$idpMetadata = []; $state = null; $stateId = $response->getInResponseTo(); @@ -100,7 +100,7 @@ if ($state) { assert(array_key_exists('ExpectedIssuer', $state)); if ($state['ExpectedIssuer'] !== $idp) { $idpMetadata = $source->getIdPMetadata($idp); - $idplist = $idpMetadata->getArrayize('IDPList', array()); + $idplist = $idpMetadata->getArrayize('IDPList', []); if (!in_array($state['ExpectedIssuer'], $idplist, true)) { throw new \SimpleSAML\Error\Exception( 'The issuer of the response does not match to the identity provider we sent the request to.' @@ -109,7 +109,7 @@ if ($state) { } } else { // this is an unsolicited response - $state = array( + $state = [ 'saml:sp:isUnsolicited' => true, 'saml:sp:AuthId' => $sourceId, 'saml:sp:RelayState' => \SimpleSAML\Utils\HTTP::checkURLAllowed( @@ -118,7 +118,7 @@ if ($state) { $response->getRelayState() ) ), - ); + ]; } SimpleSAML\Logger::debug('Received SAML2 Response from '.var_export($idp, true).'.'); @@ -140,10 +140,9 @@ $authenticatingAuthority = null; $nameId = null; $sessionIndex = null; $expire = null; -$attributes = array(); +$attributes = []; $foundAuthnStatement = false; foreach ($assertions as $assertion) { - // check for duplicate assertion (replay attack) $store = \SimpleSAML\Store::getInstance(); if ($store !== false) { @@ -202,12 +201,12 @@ if (!empty($nameId)) { \SimpleSAML\Module\saml\SP\LogoutStore::addSession($sourceId, $nameId, $sessionIndex, $logoutExpire); // we need to save the NameID and SessionIndex for logout - $logoutState = array( + $logoutState = [ 'saml:logout:Type' => 'saml2', 'saml:logout:IdP' => $idp, 'saml:logout:NameID' => $nameId, 'saml:logout:SessionIndex' => $sessionIndex, - ); + ]; $state['saml:sp:NameID'] = $nameId; // no need to mark it as persistent, it already is } else { @@ -224,9 +223,9 @@ if (!empty($nameId)) { * it to the store), marking the IdP as SAML 1.0, which does not implement logout. Then we can safely log the user * out from the local session, skipping Single Logout upstream to the IdP. */ - $logoutState = array( + $logoutState = [ 'saml:logout:Type' => 'saml1', - ); + ]; } $state['LogoutState'] = $logoutState; @@ -245,10 +244,10 @@ if ($expire !== null) { } // note some information about the authentication, in case we receive the same response again -$state['saml:sp:prevAuth'] = array( +$state['saml:sp:prevAuth'] = [ 'id' => $response->getId(), 'issuer' => $idp, -); +]; if (isset($state['\SimpleSAML\Auth\Source.ReturnURL'])) { $state['saml:sp:prevAuth']['redirect'] = $state['\SimpleSAML\Auth\Source.ReturnURL']; } elseif (isset($state['saml:sp:RelayState'])) { diff --git a/modules/saml/www/sp/saml2-logout.php b/modules/saml/www/sp/saml2-logout.php index 8b9cc250f93412fe13dff9583d1197256eb43a5c..e67431f83ac204193fb2c4d69800c9f57f96dc41 100644 --- a/modules/saml/www/sp/saml2-logout.php +++ b/modules/saml/www/sp/saml2-logout.php @@ -54,7 +54,6 @@ if ($destination !== null && $destination !== \SimpleSAML\Utils\HTTP::getSelfURL } if ($message instanceof \SAML2\LogoutResponse) { - $relayState = $message->getRelayState(); if ($relayState === null) { // Somehow, our RelayState has been lost. @@ -62,15 +61,15 @@ if ($message instanceof \SAML2\LogoutResponse) { } if (!$message->isSuccess()) { - \SimpleSAML\Logger::warning('Unsuccessful logout. Status was: '.\SimpleSAML\Module\saml\Message::getResponseError($message)); + \SimpleSAML\Logger::warning( + 'Unsuccessful logout. Status was: '.\SimpleSAML\Module\saml\Message::getResponseError($message) + ); } $state = \SimpleSAML\Auth\State::loadState($relayState, 'saml:slosent'); $state['saml:sp:LogoutStatus'] = $message->getStatus(); \SimpleSAML\Auth\Source::completeLogout($state); - } elseif ($message instanceof \SAML2\LogoutRequest) { - \SimpleSAML\Logger::debug('module/saml2/sp/logout: Request from '.$idpEntityId); \SimpleSAML\Logger::stats('saml20-idp-SLO idpinit '.$spEntityId.' '.$idpEntityId); @@ -119,9 +118,12 @@ if ($message instanceof \SAML2\LogoutResponse) { \SimpleSAML\Logger::warning('Logged out of '.$numLoggedOut.' of '.count($sessionIndexes).' sessions.'); } - $dst = $idpMetadata->getEndpointPrioritizedByBinding('SingleLogoutService', array( - \SAML2\Constants::BINDING_HTTP_REDIRECT, - \SAML2\Constants::BINDING_HTTP_POST) + $dst = $idpMetadata->getEndpointPrioritizedByBinding( + 'SingleLogoutService', + [ + \SAML2\Constants::BINDING_HTTP_REDIRECT, + \SAML2\Constants::BINDING_HTTP_POST + ] ); if (!$binding instanceof \SAML2\SOAP) { diff --git a/modules/sanitycheck/config-templates/config-sanitycheck.php b/modules/sanitycheck/config-templates/config-sanitycheck.php index 7ba3199e33d86cfbe33551e06ad7713de1b3b053..d9b45bb8af9fb724067659284eb3a0d67116d642 100644 --- a/modules/sanitycheck/config-templates/config-sanitycheck.php +++ b/modules/sanitycheck/config-templates/config-sanitycheck.php @@ -1,9 +1,9 @@ <?php -/* +/* * The configuration of SimpleSAMLphp sanitycheck package */ -$config = array( +$config = [ /* * Do you want to generate statistics using the cron module? If so, specify which cron tag to use. * Examples: daily, weekly @@ -11,4 +11,4 @@ $config = array( * 'cron_tag' => null, */ 'cron_tag' => 'hourly', -); +]; diff --git a/modules/sanitycheck/hooks/hook_cron.php b/modules/sanitycheck/hooks/hook_cron.php index ae85a1a208d665098b62ce46e6d626649b35cf65..15e0736ddbdd7c6457dd586b210f7af6ae4295db 100644 --- a/modules/sanitycheck/hooks/hook_cron.php +++ b/modules/sanitycheck/hooks/hook_cron.php @@ -21,12 +21,12 @@ function sanitycheck_hook_cron(&$croninfo) return; } - $info = array(); - $errors = array(); - $hookinfo = array( + $info = []; + $errors = []; + $hookinfo = [ 'info' => &$info, 'errors' => &$errors, - ); + ]; SimpleSAML\Module::callHooks('sanitycheck', $hookinfo); @@ -35,7 +35,6 @@ function sanitycheck_hook_cron(&$croninfo) $croninfo['summary'][] = 'Sanitycheck error: '.$err; } } - } catch (Exception $e) { $croninfo['summary'][] = 'Error executing sanity check: '.$e->getMessage(); } diff --git a/modules/sanitycheck/hooks/hook_frontpage.php b/modules/sanitycheck/hooks/hook_frontpage.php index 7a13de7c73a6a949e0eabfc1f63a54129eb5c5c0..95dddf7aa1861dab67ca05dc502e881795404421 100644 --- a/modules/sanitycheck/hooks/hook_frontpage.php +++ b/modules/sanitycheck/hooks/hook_frontpage.php @@ -9,8 +9,8 @@ function sanitycheck_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['config']['sanitycheck'] = array( + $links['config']['sanitycheck'] = [ 'href' => SimpleSAML\Module::getModuleURL('sanitycheck/index.php'), 'text' => '{core:frontpage:link_sanitycheck}', - ); + ]; } diff --git a/modules/sanitycheck/hooks/hook_moduleinfo.php b/modules/sanitycheck/hooks/hook_moduleinfo.php index 0621b972c9333811d67e523b68942fe198938b45..87d014e2ec5a2e0c2098e1fe9aab5a60062d9d26 100644 --- a/modules/sanitycheck/hooks/hook_moduleinfo.php +++ b/modules/sanitycheck/hooks/hook_moduleinfo.php @@ -9,11 +9,11 @@ function sanitycheck_hook_moduleinfo(&$moduleinfo) assert(is_array($moduleinfo)); assert(array_key_exists('info', $moduleinfo)); - $moduleinfo['info']['sanitycheck'] = array( - 'name' => array('en' => 'Sanity check'), - 'description' => array('en' => 'This module adds functionality for other modules to provide sanity checks.'), + $moduleinfo['info']['sanitycheck'] = [ + 'name' => ['en' => 'Sanity check'], + 'description' => ['en' => 'This module adds functionality for other modules to provide sanity checks.'], - 'dependencies' => array('core'), - 'uses' => array('cron'), - ); + 'dependencies' => ['core'], + 'uses' => ['cron'], + ]; } diff --git a/modules/sanitycheck/templates/check.tpl.php b/modules/sanitycheck/templates/check.tpl.php index cf34bff6121205914565cc434813e7973b006db3..ba9f69ada602d490a9f01bf6593e81a123f02800 100644 --- a/modules/sanitycheck/templates/check.tpl.php +++ b/modules/sanitycheck/templates/check.tpl.php @@ -2,44 +2,28 @@ $this->data['header'] = 'Sanity check'; $this->includeAtTemplateBase('includes/header.php'); -?> - -<h2><?php echo($this->data['header']); ?></h2> - -<?php +echo '<h2>'.$this->data['header'].'</h2>'; if (count($this->data['errors']) > 0) { -?> -<div style="border: 1px solid #800; background: #caa; margin: 1em; padding: .5em"> -<p><?php echo '<img class="float-r" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="Failed" />'; ?> -These checks failed:</p> -<?php - - echo '<ul>'; - foreach ($this->data['errors'] AS $err) { - echo '<li>' . $err . '</li>'; - } - echo '</ul>'; - -echo '</div>'; + echo '<div style="border: 1px solid #800; background: #caa; margin: 1em; padding: .5em">'; + echo '<p><img class="float-r" src="/'.$this->data['baseurlpath']. + 'resources/icons/silk/delete.png" alt="Failed" />These checks failed:</p>'; + echo '<ul>'; + foreach ($this->data['errors'] as $err) { + echo '<li>'.$err.'</li>'; + } } ?> - + </ul> +</div> <?php if (count($this->data['info']) > 0) { -?> -<div style="border: 1px solid #ccc; background: #eee; margin: 1em; padding: .5em"> -<p><?php echo '<img class="float-r" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="OK" />'; ?> -These checks succeeded:</p> -<?php - echo '<ul>'; - foreach ($this->data['info'] AS $i) { - echo '<li>' . $i . '</li>'; - } - echo '</ul>'; - - -echo '</div>'; + echo '<div style="border: 1px solid #ccc; background: #eee; margin: 1em; padding: .5em">'; + echo '<p><img class="float-r" src="/'.$this->data['baseurlpath']. + 'resources/icons/silk/accept.png" alt="OK" />These checks succeeded:</p>'; + echo '<ul>'; + foreach ($this->data['info'] as $i) { + echo '<li>'.$i.'</li>'; + } } -?> - -<?php $this->includeAtTemplateBase('includes/footer.php'); ?> \ No newline at end of file +echo '</ul></div>'; +$this->includeAtTemplateBase('includes/footer.php'); diff --git a/modules/sanitycheck/www/index.php b/modules/sanitycheck/www/index.php index d7302529e7d3aa9437c2e13a7949f13e2f696e4e..8946bad073f5ca56a7107056c5343ec8acefda21 100644 --- a/modules/sanitycheck/www/index.php +++ b/modules/sanitycheck/www/index.php @@ -2,16 +2,15 @@ $config = \SimpleSAML\Configuration::getInstance(); -$info = array(); -$errors = array(); -$hookinfo = array( +$info = []; +$errors = []; +$hookinfo = [ 'info' => &$info, 'errors' => &$errors, -); +]; \SimpleSAML\Module::callHooks('sanitycheck', $hookinfo); if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'text') { - if (count($errors) === 0) { echo 'OK'; } else { diff --git a/modules/smartattributes/lib/Auth/Process/SmartID.php b/modules/smartattributes/lib/Auth/Process/SmartID.php index 4a23cf7c6159edb7dc2bbbd8e2a05246c5bbfffc..00ca468eae4ff9ce4f4afe09e1de9949577f1ce7 100644 --- a/modules/smartattributes/lib/Auth/Process/SmartID.php +++ b/modules/smartattributes/lib/Auth/Process/SmartID.php @@ -11,7 +11,7 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter * etc., be sure to comment out the entries that map xxx_targetedID to * eduPersonTargetedID, or there will be no way to see its origin any more. */ - private $_candidates = array( + private $candidates = [ 'eduPersonTargetedID', 'eduPersonPrincipalName', 'pairwise-id', @@ -21,30 +21,30 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter 'twitter_targetedID', 'windowslive_targetedID', 'linkedin_targetedID', - ); + ]; /** * The name of the generated ID attribute. */ - private $_id_attribute = 'smart_id'; + private $id_attribute = 'smart_id'; /** * Whether to append the AuthenticatingAuthority, separated by '!' * This only works when SSP is used as a gateway. */ - private $_add_authority = true; + private $add_authority = true; /** * Whether to prepend the CandidateID, separated by ':' */ - private $_add_candidate = true; + private $add_candidate = true; /** * Attributes which should be added/appended. * * Associative array of arrays. */ - private $attributes = array(); + private $attributes = []; public function __construct($config, $reserved) @@ -54,29 +54,29 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($config)); if (array_key_exists('candidates', $config)) { - $this->_candidates = $config['candidates']; - if (!is_array($this->_candidates)) { + $this->candidates = $config['candidates']; + if (!is_array($this->candidates)) { throw new \Exception('SmartID authproc configuration error: \'candidates\' should be an array.'); } } if (array_key_exists('id_attribute', $config)) { - $this->_id_attribute = $config['id_attribute']; - if (!is_string($this->_id_attribute)) { + $this->id_attribute = $config['id_attribute']; + if (!is_string($this->id_attribute)) { throw new \Exception('SmartID authproc configuration error: \'id_attribute\' should be a string.'); } } if (array_key_exists('add_authority', $config)) { - $this->_add_authority = $config['add_authority']; - if (!is_bool($this->_add_authority)) { + $this->add_authority = $config['add_authority']; + if (!is_bool($this->add_authority)) { throw new \Exception('SmartID authproc configuration error: \'add_authority\' should be a boolean.'); } } if (array_key_exists('add_candidate', $config)) { - $this->_add_candidate = $config['add_candidate']; - if (!is_bool($this->_add_candidate)) { + $this->add_candidate = $config['add_candidate']; + if (!is_bool($this->add_candidate)) { throw new \Exception('SmartID authproc configuration error: \'add_candidate\' should be a boolean.'); } } @@ -85,12 +85,13 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter private function addID($attributes, $request) { $state = $request['saml:sp:State']; - foreach ($this->_candidates as $idCandidate) { + foreach ($this->candidates as $idCandidate) { if (isset($attributes[$idCandidate][0])) { - if (($this->_add_authority) && (isset($state['saml:AuthenticatingAuthority'][0]))) { - return ($this->_add_candidate ? $idCandidate.':' : '').$attributes[$idCandidate][0].'!'.$state['saml:AuthenticatingAuthority'][0]; + if (($this->add_authority) && (isset($state['saml:AuthenticatingAuthority'][0]))) { + return ($this->add_candidate ? $idCandidate.':' : '').$attributes[$idCandidate][0].'!'. + $state['saml:AuthenticatingAuthority'][0]; } else { - return ($this->_add_candidate ? $idCandidate.':' : '').$attributes[$idCandidate][0]; + return ($this->add_candidate ? $idCandidate.':' : '').$attributes[$idCandidate][0]; } } } @@ -98,7 +99,7 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter * At this stage no usable id_candidate has been detected. */ throw new \SimpleSAML\Error\Exception('This service needs at least one of the following - attributes to identity users: '.implode(', ', $this->_candidates).'. Unfortunately not + attributes to identity users: '.implode(', ', $this->candidates).'. Unfortunately not one of them was detected. Please ask your institution administrator to release one of them, or try using another identity provider.'); } @@ -118,7 +119,7 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter $id = $this->addID($request['Attributes'], $request); if (isset($id)) { - $request['Attributes'][$this->_id_attribute] = array($id); + $request['Attributes'][$this->id_attribute] = [$id]; } } } diff --git a/modules/smartattributes/lib/Auth/Process/SmartName.php b/modules/smartattributes/lib/Auth/Process/SmartName.php index 388ffe5c35e6503c1a1632dad3e1a2798d216e7c..19a69baa6f31d66fc8a15e3bdc1c7d72d3c67bb5 100644 --- a/modules/smartattributes/lib/Auth/Process/SmartName.php +++ b/modules/smartattributes/lib/Auth/Process/SmartName.php @@ -16,7 +16,7 @@ class SmartName extends \SimpleSAML\Auth\ProcessingFilter * * Assiciative array of arrays. */ - private $attributes = array(); + private $attributes = []; private function getFullName($attributes) @@ -52,7 +52,7 @@ class SmartName extends \SimpleSAML\Auth\ProcessingFilter if (isset($localname)) { return $localname; } - } + } return null; } @@ -86,7 +86,7 @@ class SmartName extends \SimpleSAML\Auth\ProcessingFilter $fullname = $this->getFullName($attributes); if (isset($fullname)) { - $request['Attributes']['smartname-fullname'] = array($fullname); + $request['Attributes']['smartname-fullname'] = [$fullname]; } } } diff --git a/modules/sqlauth/lib/Auth/Source/SQL.php b/modules/sqlauth/lib/Auth/Source/SQL.php index f968dbc9c695d8be002de780289314e9d8a9e791..b820a6a3e44dc818969bd46d300b059cc777c21e 100644 --- a/modules/sqlauth/lib/Auth/Source/SQL.php +++ b/modules/sqlauth/lib/Auth/Source/SQL.php @@ -55,7 +55,7 @@ class SQL extends \SimpleSAML\Module\core\Auth\UserPassBase parent::__construct($info, $config); // Make sure that all required parameters are present. - foreach (array('dsn', 'username', 'password', 'query') as $param) { + foreach (['dsn', 'username', 'password', 'query'] as $param) { if (!array_key_exists($param, $config)) { throw new \Exception('Missing required attribute \''.$param. '\' for authentication source '.$this->authId); @@ -142,7 +142,7 @@ class SQL extends \SimpleSAML\Module\core\Auth\UserPassBase } try { - $sth->execute(array('username' => $username, 'password' => $password)); + $sth->execute(['username' => $username, 'password' => $password]); } catch (\PDOException $e) { throw new \Exception('sqlauth:'.$this->authId. ': - Failed to execute query: '.$e->getMessage()); @@ -169,10 +169,9 @@ class SQL extends \SimpleSAML\Module\core\Auth\UserPassBase * which are present in more than one row will become multivalued. null values and * duplicate values will be skipped. All values will be converted to strings. */ - $attributes = array(); + $attributes = []; foreach ($data as $row) { foreach ($row as $name => $value) { - if ($value === null) { continue; } @@ -180,7 +179,7 @@ class SQL extends \SimpleSAML\Module\core\Auth\UserPassBase $value = (string) $value; if (!array_key_exists($name, $attributes)) { - $attributes[$name] = array(); + $attributes[$name] = []; } if (in_array($value, $attributes[$name], true)) { diff --git a/modules/statistics/bin/loganalyzer.php b/modules/statistics/bin/loganalyzer.php index 52f5842ea907791a23fb8be53b27e59209b20613..85ae093f3e31ab1dfdde61a1ce1ca304c4f17154 100755 --- a/modules/statistics/bin/loganalyzer.php +++ b/modules/statistics/bin/loganalyzer.php @@ -29,7 +29,7 @@ foreach ($argv as $a) { } // Map short options to long options. - $shortOptMap = array('-d' => '--debug'); + $shortOptMap = ['-d' => '--debug']; if (array_key_exists($a, $shortOptMap)) { $a = $shortOptMap[$a]; } @@ -85,6 +85,4 @@ Options: -d, --debug Used when configuring the log file syntax. See doc. --dry-run Aggregate but do not store the results. END; - } - diff --git a/modules/statistics/bin/logcleaner.php b/modules/statistics/bin/logcleaner.php index 071318124d4b9fc002bbdb5a09445361973d20bb..b160cdab2780d2806831aa044a0e2655e1812bed 100755 --- a/modules/statistics/bin/logcleaner.php +++ b/modules/statistics/bin/logcleaner.php @@ -30,7 +30,7 @@ foreach ($argv as $a) { } // Map short options to long options. - $shortOptMap = array('-d' => '--debug'); + $shortOptMap = ['-d' => '--debug']; if (array_key_exists($a, $shortOptMap)) { $a = $shortOptMap[$a]; } @@ -90,4 +90,3 @@ Options: END; } - diff --git a/modules/statistics/config-templates/module_statistics.php b/modules/statistics/config-templates/module_statistics.php index 16a21cdd187033b0c131f6f9edfdfd621a00b884..9e186dc2908f65297a74825e8c03e830fee1fe84 100644 --- a/modules/statistics/config-templates/module_statistics.php +++ b/modules/statistics/config-templates/module_statistics.php @@ -1,9 +1,9 @@ <?php -/* +/* * The configuration of SimpleSAMLphp statistics package */ -$config = array( +$config = [ // Authentication & authorization for statistics // Whether the statistics require authentication before use. @@ -24,163 +24,167 @@ $config = array( 'statdir' => '/tmp/stats/', 'inputfile' => '/var/log/simplesamlphp.stat', 'offset' => 60 * 60 * 2 + 60 * 60 * 24 * 3, // Two hours offset to match epoch and norwegian winter time. - + 'datestart' => 1, 'datelength' => 15, 'offsetspan' => 21, - + // Dimensions on graph from Google Charts in pixels... 'dimension.x' => 800, 'dimension.y' => 350, - + /* * Do you want to generate statistics using the cron module? If so, specify which cron tag to use. * Examples: daily, weekly - * To not run statistics in cron, set value to + * To not run statistics in cron, set value to * 'cron_tag' => null, */ 'cron_tag' => 'daily', /* - * Set max running time for this script. This is also controlle by max_execution_time in php.ini - * and is defalut set to 30 sec. Your web server can have other timeout configurations that may + * Set max running time for this script. This is also controlled by max_execution_time in php.ini + * and is set to 30 sec by default. Your web server can have other timeout configurations that may * also interrupt PHP execution. Apache has a Timeout directive and IIS has a * CGI timeout function. Both default to 300 seconds. */ 'time_limit' => 300, - - 'timeres' => array( - 'day' => array( + + 'timeres' => [ + 'day' => [ 'name' => 'Day', 'slot' => 60 * 15, // Slots of 15 minutes 'fileslot' => 60 * 60 * 24, // One day (24 hours) file slots - 'axislabelint' => 6 * 4, // Number of slots per label. 4 per hour *6 = 6 hours - 'dateformat-period' => 'j. M', // 4. Mars - 'dateformat-intra' => 'j. M H:i', // 4. Mars 12:30 - ), - 'week' => array( + 'axislabelint' => 6 * 4, // Number of slots per label. 4 per hour *6 = 6 hours + 'dateformat-period' => 'j. M', // 4. Mars + 'dateformat-intra' => 'j. M H:i', // 4. Mars 12:30 + ], + 'week' => [ 'name' => 'Week', 'slot' => 60 * 60, // Slots of one hour 'fileslot' => 60 * 60 * 24 * 7, // 7 days of data in each file 'axislabelint' => 24, // Number of slots per label. 24 is one each day - 'dateformat-period' => 'j. M', // 4. Mars - 'dateformat-intra' => 'j. M H:i', // 4. Mars 12:30 - ), - 'month' => array( + 'dateformat-period' => 'j. M', // 4. Mars + 'dateformat-intra' => 'j. M H:i', // 4. Mars 12:30 + ], + 'month' => [ 'name' => 'Month', 'slot' => 60 * 60 * 24, // Slots of one day 'fileslot' => 60 * 60 * 24 * 30, // 30 days of data in each file 'axislabelint' => 7, // Number of slots per label. 7 days => 1 week - 'dateformat-period' => 'j. M Y H:i', // 4. Mars 12:30 - 'dateformat-intra' => 'j. M', // 4. Mars - ), - 'monthaligned' => array( + 'dateformat-period' => 'j. M Y H:i', // 4. Mars 12:30 + 'dateformat-intra' => 'j. M', // 4. Mars + ], + 'monthaligned' => [ 'name' => 'AlignedMonth', 'slot' => 60 * 60 * 24, // Slots of one day 'fileslot' => null, // 30 days of data in each file 'customDateHandler' => 'month', 'axislabelint' => 7, // Number of slots per label. 7 days => 1 week - 'dateformat-period' => 'j. M Y H:i', // 4. Mars 12:30 - 'dateformat-intra' => 'j. M', // 4. Mars - ), - 'days180' => array( + 'dateformat-period' => 'j. M Y H:i', // 4. Mars 12:30 + 'dateformat-intra' => 'j. M', // 4. Mars + ], + 'days180' => [ 'name' => '180 days', 'slot' => 60 * 60 * 24, // Slots of 1 day (24 hours) 'fileslot' => 60 * 60 * 24 * 180, // 80 days of data in each file 'axislabelint' => 30, // Number of slots per label. 7 days => 1 week 'dateformat-period' => 'j. M', // 4. Mars 'dateformat-intra' => 'j. M', // 4. Mars - ), - ), + ], + ], - 'statrules' => array( - 'sloratio' => array( + 'statrules' => [ + 'sloratio' => [ 'name' => 'SLO to SSO ratio', - 'descr' => 'Comparison of the number of Single Log-Out compared to Single Sign-On. Graph shows how many logouts where initiated for each Single Sign-On.', + 'descr' => 'Comparison of the number of Single Log-Out compared to Single Sign-On.'. + ' Graph shows how many logouts where initiated for each Single Sign-On.', 'type' => 'calculated', 'presenter' => 'statistics:Ratio', - 'ref' => array('slo', 'sso'), - 'fieldPresentation' => array( + 'ref' => ['slo', 'sso'], + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - 'ssomulti' => array( + ], + ], + 'ssomulti' => [ 'name' => 'Requests per session', - 'descr' => 'Number of SSO request pairs exchanged between IdP and SP within the same IdP session. A high number indicates that the session at the SP is timing out faster than at the IdP.', + 'descr' => 'Number of SSO request pairs exchanged between IdP and SP within the same IdP session.'. + ' A high number indicates that the session at the SP is timing out faster than at the IdP.', 'type' => 'calculated', 'presenter' => 'statistics:Ratio', - 'ref' => array('sso', 'ssofirst'), - 'fieldPresentation' => array( + 'ref' => ['sso', 'ssofirst'], + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - 'sso' => array( + ], + ], + 'sso' => [ 'name' => 'SSO to service', 'descr' => 'The number of logins at a Service Provider.', 'action' => 'saml20-idp-SSO', 'col' => 6, // Service Provider EntityID - 'fieldPresentation' => array( + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - 'ssofirst' => array( + ], + ], + 'ssofirst' => [ 'name' => 'SSO-first to service', 'descr' => 'The number of logins at a Service Provider.', 'action' => 'saml20-idp-SSO-first', 'col' => 6, // Service Provider EntityID - 'fieldPresentation' => array( + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - 'slo' => array( + ], + ], + 'slo' => [ 'name' => 'SLO initiated from service', 'descr' => 'The number of initated Sinlge Logout from each of the service providers.', 'action' => 'saml20-idp-SLO', 'col' => 7, // Service Provider EntityID that initiated the logout. - 'fieldPresentation' => array( + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - 'consent' => array( + ], + ], + 'consent' => [ 'name' => 'Consent', - 'descr' => 'Consent statistics. Everytime a user logs in to a service an entry is logged for one of three states: consent was found, consent was not found or consent storage was not available.', + 'descr' => 'Consent statistics. Everytime a user logs in to a service an entry is logged for'. + ' one of three states: consent was found, consent was not found or consent storage was not available.', 'action' => 'consent', 'col' => 6, - 'fieldPresentation' => array( + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - 'consentresponse' => array( + ], + ], + 'consentresponse' => [ 'name' => 'Consent response', - 'descr' => 'Consent response statistics. Everytime a user accepts consent, it is logged whether the user selected to remember the consent to next time.', + 'descr' => 'Consent response statistics. Everytime a user accepts consent,'. + ' it is logged whether the user selected to remember the consent to next time.', 'action' => 'consentResponse', 'col' => 6, - 'fieldPresentation' => array( + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - 'slopages' => array( + ], + ], + 'slopages' => [ 'name' => 'SLO iframe pages', 'descr' => 'The varioust IFrame SLO pages a user visits', 'action' => 'slo-iframe', 'col' => 6, // Page the user visits. - ), - 'slofail' => array( + ], + 'slofail' => [ 'name' => 'Failed iframe IdP-init SLOs', 'descr' => 'The number of logout failures from various SPs', 'action' => 'slo-iframe-fail', 'col' => 6, // Service Provider EntityID that wasn't logged out. - 'fieldPresentation' => array( + 'fieldPresentation' => [ 'class' => 'statistics:Entity', 'config' => 'saml20-sp-remote', - ), - ), - ), -); + ], + ], + ], +]; diff --git a/modules/statistics/hooks/hook_cron.php b/modules/statistics/hooks/hook_cron.php index b86b480d3121d3c8dd8a6f8b7bda1a86332d0163..a3ee4952cc347d567d4d044f4bbd83b05b7a7b5d 100644 --- a/modules/statistics/hooks/hook_cron.php +++ b/modules/statistics/hooks/hook_cron.php @@ -13,19 +13,19 @@ function statistics_hook_cron(&$croninfo) assert(array_key_exists('tag', $croninfo)); $statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); - + if (is_null($statconfig->getValue('cron_tag', null))) { return; } if ($statconfig->getValue('cron_tag', null) !== $croninfo['tag']) { return; } - + $maxtime = $statconfig->getInteger('time_limit', null); if ($maxtime) { set_time_limit($maxtime); } - + try { $aggregator = new \SimpleSAML\Module\statistics\Aggregator(); $results = $aggregator->aggregate(); diff --git a/modules/statistics/hooks/hook_frontpage.php b/modules/statistics/hooks/hook_frontpage.php index a97da1f2c5f31ee8b900b6b3eb0aba82c1a3e2f0..462a300bfb265e8c0a97036c4df9084743a8e4cf 100644 --- a/modules/statistics/hooks/hook_frontpage.php +++ b/modules/statistics/hooks/hook_frontpage.php @@ -9,13 +9,13 @@ function statistics_hook_frontpage(&$links) assert(is_array($links)); assert(array_key_exists('links', $links)); - $links['config']['statistics'] = array( + $links['config']['statistics'] = [ 'href' => SimpleSAML\Module::getModuleURL('statistics/showstats.php'), 'text' => '{core:frontpage:link_statistics}', - ); - $links['config']['statisticsmeta'] = array( + ]; + $links['config']['statisticsmeta'] = [ 'href' => SimpleSAML\Module::getModuleURL('statistics/statmeta.php'), 'text' => '{core:frontpage:link_statistics_metadata}', - 'shorttext' => array('en' => 'Statistics metadata', 'no' => 'Statistikk metadata'), - ); + 'shorttext' => ['en' => 'Statistics metadata', 'no' => 'Statistikk metadata'], + ]; } diff --git a/modules/statistics/hooks/hook_sanitycheck.php b/modules/statistics/hooks/hook_sanitycheck.php index 85117477c9bdc3d11014f50899868f44dc50bb85..879ee3ee784c292f68cd979d66420799b6251085 100644 --- a/modules/statistics/hooks/hook_sanitycheck.php +++ b/modules/statistics/hooks/hook_sanitycheck.php @@ -13,7 +13,8 @@ function statistics_hook_sanitycheck(&$hookinfo) try { $statconfig = \SimpleSAML\Configuration::getConfig('module_statistics.php'); } catch (Exception $e) { - $hookinfo['errors'][] = '[statistics] Could not get configuration: '.$e->getMessage(); return; + $hookinfo['errors'][] = '[statistics] Could not get configuration: '.$e->getMessage(); + return; } $statdir = $statconfig->getValue('statdir'); diff --git a/modules/statistics/lib/AccessCheck.php b/modules/statistics/lib/AccessCheck.php index a4a003abb90488cda913eb43949dfa8780b50d19..750a5d0526e0aa3aa494e6f0ffdba9dc70dbef6c 100644 --- a/modules/statistics/lib/AccessCheck.php +++ b/modules/statistics/lib/AccessCheck.php @@ -61,10 +61,14 @@ class AccessCheck // Check if userid is allowed access.. if (in_array($attributes[$useridattr][0], $allowedusers, true)) { - \SimpleSAML\Logger::debug('Statistics auth - User granted access by user ID ['.$attributes[$useridattr][0].']'); + \SimpleSAML\Logger::debug( + 'Statistics auth - User granted access by user ID ['.$attributes[$useridattr][0].']' + ); return; } - \SimpleSAML\Logger::debug('Statistics auth - User denied access by user ID ['.$attributes[$useridattr][0].']'); + \SimpleSAML\Logger::debug( + 'Statistics auth - User denied access by user ID ['.$attributes[$useridattr][0].']' + ); } else { \SimpleSAML\Logger::debug('Statistics auth - no allowedUsers list.'); } diff --git a/modules/statistics/lib/Aggregator.php b/modules/statistics/lib/Aggregator.php index 9a022e341194b820382c2e3a941c66a7b61f4b99..966012d6399329c6b5f250a3d68e53b9f22197e8 100644 --- a/modules/statistics/lib/Aggregator.php +++ b/modules/statistics/lib/Aggregator.php @@ -93,12 +93,14 @@ class Aggregator } $logparser = new LogParser( - $this->statconfig->getValue('datestart', 0), $this->statconfig->getValue('datelength', 15), $this->statconfig->getValue('offsetspan', 44) + $this->statconfig->getValue('datestart', 0), + $this->statconfig->getValue('datelength', 15), + $this->statconfig->getValue('offsetspan', 44) ); - $datehandler = array( + $datehandler = [ 'default' => new DateHandler($this->offset), 'month' => new DateHandlerMonth($this->offset), - ); + ]; $notBefore = 0; $lastRead = 0; @@ -109,9 +111,9 @@ class Aggregator $lastlinehash = $this->metadata['lastlinehash']; } - $lastlogline = 'sdfsdf'; + $lastlogline = 'sdfsdf'; $lastlineflip = false; - $results = array(); + $results = []; $i = 0; // Parse through log file, line by line @@ -138,7 +140,8 @@ class Aggregator if ($debug) { echo "----------------------------------------\n"; echo 'Log line: '.$logline."\n"; - echo 'Date parse ['.substr($logline, 0, $this->statconfig->getValue('datelength', 15)).'] to ['.date(DATE_RFC822, $epoch).']'."\n"; + echo 'Date parse ['.substr($logline, 0, $this->statconfig->getValue('datelength', 15)). + '] to ['.date(DATE_RFC822, $epoch).']'."\n"; echo htmlentities(print_r($content, true)); if ($i >= 13) { exit; @@ -212,7 +215,7 @@ class Aggregator if (is_int($colrule)) { return trim($content[$colrule]); } elseif (is_array($colrule)) { - $difcols = array(); + $difcols = []; foreach ($colrule as $cr) { $difcols[] = trim($content[$cr]); } @@ -224,11 +227,11 @@ class Aggregator private function cummulateData($previous, $newdata) { - $dataset = array(); + $dataset = []; foreach (func_get_args() as $item) { foreach ($item as $slot => $dataarray) { if (!array_key_exists($slot, $dataset)) { - $dataset[$slot] = array(); + $dataset[$slot] = []; } foreach ($dataarray as $key => $data) { if (!array_key_exists($key, $dataset[$slot])) { @@ -243,10 +246,10 @@ class Aggregator public function store($results) { - $datehandler = array( + $datehandler = [ 'default' => new DateHandler($this->offset), 'month' => new DateHandlerMonth($this->offset), - ); + ]; // Iterate the first level of results, which is per rule, as defined in the config. foreach ($results as $rulename => $timeresdata) { @@ -270,24 +273,24 @@ class Aggregator // Get start and end slot number within the file, based on the fileslot. $start = (int) $datehandler['default']->toSlot( - $datehandler[$dh]->fromSlot($fileno, $this->timeres[$tres]['fileslot']), + $datehandler[$dh]->fromSlot($fileno, $this->timeres[$tres]['fileslot']), $this->timeres[$tres]['slot'] ); $end = (int) $datehandler['default']->toSlot( - $datehandler[$dh]->fromSlot($fileno + 1, $this->timeres[$tres]['fileslot']), + $datehandler[$dh]->fromSlot($fileno + 1, $this->timeres[$tres]['fileslot']), $this->timeres[$tres]['slot'] ); // Fill in missing entries and sort file results - $filledresult = array(); + $filledresult = []; for ($slot = $start; $slot < $end; $slot++) { if (array_key_exists($slot, $fileres)) { $filledresult[$slot] = $fileres[$slot]; } else { if ($lastfile == $fileno && $slot > $maxslot) { - $filledresult[$slot] = array('_' => null); + $filledresult[$slot] = ['_' => null]; } else { - $filledresult[$slot] = array('_' => 0); + $filledresult[$slot] = ['_' => 0]; } } } @@ -295,7 +298,7 @@ class Aggregator $filename = $this->statdir.'/'.$rulename.'-'.$tres.'-'.$fileno.'.stat'; if (file_exists($filename)) { $previousData = unserialize(file_get_contents($filename)); - $filledresult = $this->cummulateData($previousData, $filledresult); + $filledresult = $this->cummulateData($previousData, $filledresult); } // store file diff --git a/modules/statistics/lib/DateHandler.php b/modules/statistics/lib/DateHandler.php index b62cfb62494ab703f3e82b3b2ff866a0f8ce85e1..ae9807df9ea6907992b4e25c7aad2921df49fcd2 100644 --- a/modules/statistics/lib/DateHandler.php +++ b/modules/statistics/lib/DateHandler.php @@ -14,7 +14,7 @@ class DateHandler /** * Constructor * - * @param array $offset Date offset + * @param array $offset Date offset */ public function __construct($offset) { diff --git a/modules/statistics/lib/DateHandlerMonth.php b/modules/statistics/lib/DateHandlerMonth.php index 78209d03e98880ab2a9c0accc076de53b47b397c..061af6e62c8029a3eeea32de3a221c4b811f496b 100644 --- a/modules/statistics/lib/DateHandlerMonth.php +++ b/modules/statistics/lib/DateHandlerMonth.php @@ -12,7 +12,7 @@ class DateHandlerMonth extends DateHandler /** * Constructor * - * @param integer $offset Date offset + * @param integer $offset Date offset */ public function __construct($offset) { diff --git a/modules/statistics/lib/Graph/GoogleCharts.php b/modules/statistics/lib/Graph/GoogleCharts.php index 072ef33b7d92b867acf0854b9796273141bd10bd..129639de50d103e4002b0504e7e3c3a117242141 100644 --- a/modules/statistics/lib/Graph/GoogleCharts.php +++ b/modules/statistics/lib/Graph/GoogleCharts.php @@ -4,7 +4,7 @@ namespace SimpleSAML\Module\statistics\Graph; /* * \SimpleSAML\Module\statistics\Graph\GoogleCharts will help you to create a Google Chart - * using the Google Charts API. + * using the Google Charts API. * * @author Andreas Ă…kre Solberg <andreas.solberg@uninett.no> * @package SimpleSAMLphp @@ -44,7 +44,7 @@ class GoogleCharts // t:10.0,58.0,95.0 private function encodedata($datasets) { - $setstr = array(); + $setstr = []; foreach ($datasets as $dataset) { $setstr[] = self::extEncode($dataset); } @@ -64,15 +64,15 @@ class GoogleCharts $second = substr($extended_table, intval(($delta * $v / 100) % $size), 1); $chardata .= "$first$second"; } else { - $chardata .= '__'; // Value out of max range; - } + $chardata .= '__'; // Value out of max range; + } } - return $chardata; + return $chardata; } /** * Generate a Google Charts URL which points to a generated image. - * More documentation on Google Charts here: + * More documentation on Google Charts here: * http://code.google.com/apis/chart/ * * @param string $axis Axis @@ -119,7 +119,7 @@ class GoogleCharts 'chs='.$this->x.'x'.$this->y. // Dateset values. - '&chd='.$this->encodedata(array($datasets)). + '&chd='.$this->encodedata([$datasets]). // chart type is linechart '&cht=p'. @@ -137,12 +137,14 @@ class GoogleCharts * * Here is some test code: * <code> - * $foo = array(0, 2, 2.3, 2.6, 6, 10, 15, 98, 198, 256, 487, 563, 763, 801, 899, 999, 987, 198234.485, 283746); - * foreach ($foo AS $f) { - * echo '<p>' . $f . ' => ' . \SimpleSAML\Module\statistics\Graph\GoogleCharts::roof($f); - * } + * $foo = array( + * 0, 2, 2.3, 2.6, 6, 10, 15, 98, 198, 256, 487, 563, 763, 801, 899, 999, 987, 198234.485, 283746 + * ); + * foreach ($foo as $f) { + * echo '<p>'.$f.' => '.\SimpleSAML\Module\statistics\Graph\GoogleCharts::roof($f); + * } * </code> - * + * * @param integer $max Input value. */ public static function roof($max) @@ -160,7 +162,7 @@ class GoogleCharts } $maxGridLines = 10; - $candidates = array(1, 2, 5, 10, 20, 25, 50, 100); + $candidates = [1, 2, 5, 10, 20, 25, 50, 100]; foreach ($candidates as $c) { if ($t / $c < $maxGridLines) { @@ -169,5 +171,6 @@ class GoogleCharts return $target_top; } } + return 1; } } diff --git a/modules/statistics/lib/LogCleaner.php b/modules/statistics/lib/LogCleaner.php index d04204df951894a9a273d83bb63e8a0eb29e4e70..eafb501904e36d7cac8883a3edb1b70da4bca12f 100644 --- a/modules/statistics/lib/LogCleaner.php +++ b/modules/statistics/lib/LogCleaner.php @@ -60,10 +60,12 @@ class LogCleaner $file = fopen($this->inputfile, 'r'); $logparser = new LogParser( - $this->statconfig->getValue('datestart', 0), $this->statconfig->getValue('datelength', 15), $this->statconfig->getValue('offsetspan', 44) + $this->statconfig->getValue('datestart', 0), + $this->statconfig->getValue('datelength', 15), + $this->statconfig->getValue('offsetspan', 44) ); - $sessioncounter = array(); + $sessioncounter = []; $i = 0; // Parse through log file, line by line @@ -94,7 +96,8 @@ class LogCleaner if ($debug) { echo "----------------------------------------\n"; echo 'Log line: '.$logline."\n"; - echo 'Date parse ['.substr($logline, 0, $this->statconfig->getValue('datelength', 15)).'] to ['.date(DATE_RFC822, $epoch).']'."\n"; + echo 'Date parse ['.substr($logline, 0, $this->statconfig->getValue('datelength', 15)). + '] to ['.date(DATE_RFC822, $epoch).']'."\n"; echo htmlentities(print_r($content, true)); if ($i >= 13) { exit; @@ -102,7 +105,7 @@ class LogCleaner } } - $histogram = array(); + $histogram = []; foreach ($sessioncounter as $trackid => $sc) { if (!isset($histogram[$sc])) { $histogram[$sc] = 0; @@ -111,7 +114,7 @@ class LogCleaner } ksort($histogram); - $todelete = array(); + $todelete = []; foreach ($sessioncounter as $trackid => $sc) { if ($sc > 200) { $todelete[] = $trackid; @@ -149,7 +152,9 @@ class LogCleaner $outfile = fopen($outputfile, 'x'); // Create the output file $logparser = new LogParser( - $this->statconfig->getValue('datestart', 0), $this->statconfig->getValue('datelength', 15), $this->statconfig->getValue('offsetspan', 44) + $this->statconfig->getValue('datestart', 0), + $this->statconfig->getValue('datelength', 15), + $this->statconfig->getValue('offsetspan', 44) ); $i = 0; diff --git a/modules/statistics/lib/RatioDataset.php b/modules/statistics/lib/RatioDataset.php index fcb7377fd4a0aafdba04dec9d6f855617f8b857a..5449a3fd1797c03c08b9d04d8e530f58d8202be4 100644 --- a/modules/statistics/lib/RatioDataset.php +++ b/modules/statistics/lib/RatioDataset.php @@ -14,8 +14,8 @@ class RatioDataset extends StatDataset /** * Aggregate summary table from dataset. To be used in the table view. */ - $this->summary = array(); - $noofvalues = array(); + $this->summary = []; + $noofvalues = []; foreach ($this->results as $slot => $res) { foreach ($res as $key => $value) { if (array_key_exists($key, $this->summary)) { @@ -60,12 +60,12 @@ class RatioDataset extends StatDataset public function combine($result1, $result2) { - $combined = array(); + $combined = []; foreach ($result2 as $tick => $val) { - $combined[$tick] = array(); + $combined[$tick] = []; foreach ($val as $index => $num) { - $combined[$tick][$index] = $this->divide( + $combined[$tick][$index] = $this->divide( $this->ag($index, $result1[$tick]), $this->ag($index, $result2[$tick]) ); @@ -79,4 +79,3 @@ class RatioDataset extends StatDataset return null; } } - diff --git a/modules/statistics/lib/Ruleset.php b/modules/statistics/lib/Ruleset.php index d94ee7c03ce89f31f769e6f18bed9e22b602dc5f..9d8c67d058ec3eb28a3717eaf8f5878c3e23e177 100644 --- a/modules/statistics/lib/Ruleset.php +++ b/modules/statistics/lib/Ruleset.php @@ -36,7 +36,7 @@ class Ruleset throw new \Exception('Statisics output directory ['.$statdir.'] does not exists.'); } $filelist = scandir($statdir); - $this->available = array(); + $this->available = []; foreach ($filelist as $file) { if (preg_match('/([a-z0-9_]+)-([a-z0-9_]+)-([0-9]+)\.stat/', $file, $matches)) { if (array_key_exists($matches[1], $statrules)) { @@ -54,9 +54,9 @@ class Ruleset * Create array with information about available rules.. */ $this->availrules = array_keys($statrules); - $available_rules = array(); + $available_rules = []; foreach ($this->availrules as $key) { - $available_rules[$key] = array('name' => $statrules[$key]['name'], 'descr' => $statrules[$key]['descr']); + $available_rules[$key] = ['name' => $statrules[$key]['name'], 'descr' => $statrules[$key]['descr']]; } $this->availrulenames = $available_rules; } @@ -91,9 +91,11 @@ class Ruleset $statrulesConfig = $this->statconfig->getConfigItem('statrules'); $statruleConfig = $statrulesConfig->getConfigItem($rule); - $presenterClass = \SimpleSAML\Module::resolveClass($statruleConfig->getValue('presenter', 'statistics:BaseRule'), 'Statistics_Rulesets'); + $presenterClass = \SimpleSAML\Module::resolveClass( + $statruleConfig->getValue('presenter', 'statistics:BaseRule'), + 'Statistics_Rulesets' + ); $statrule = new $presenterClass($this->statconfig, $statruleConfig, $rule, $this->available); return $statrule; } } - diff --git a/modules/statistics/lib/StatDataset.php b/modules/statistics/lib/StatDataset.php index 7d890848c81863672acff24e629a18121790f53b..70898bfbce7e04d49cda0b6646e37b4e77752b89 100644 --- a/modules/statistics/lib/StatDataset.php +++ b/modules/statistics/lib/StatDataset.php @@ -96,16 +96,16 @@ class StatDataset public function getDebugData() { - $debugdata = array(); + $debugdata = []; $slotsize = $this->timeresconfig->getValue('slot'); $dateformat_intra = $this->timeresconfig->getValue('dateformat-intra'); foreach ($this->results as $slot => &$res) { - $debugdata[$slot] = array( + $debugdata[$slot] = [ $this->datehandlerTick->prettyDateSlot($slot, $slotsize, $dateformat_intra), $res[$this->delimiter] - ); + ]; } return $debugdata; } @@ -113,7 +113,7 @@ class StatDataset public function aggregateSummary() { // aggregate summary table from dataset. To be used in the table view - $this->summary = array(); + $this->summary = []; foreach ($this->results as $slot => $res) { foreach ($res as $key => $value) { if (array_key_exists($key, $this->summary)) { @@ -130,7 +130,7 @@ class StatDataset public function getTopDelimiters() { // create a list of delimiter keys that has the highest total summary in this period - $topdelimiters = array(); + $topdelimiters = []; $maxdelimiters = 4; $i = 0; foreach ($this->summary as $key => $value) { @@ -146,7 +146,7 @@ class StatDataset public function availDelimiters() { - $availDelimiters = array(); + $availDelimiters = []; foreach ($this->summary as $key => $value) { $availDelimiters[$key] = 1; } @@ -155,7 +155,7 @@ class StatDataset public function getPieData() { - $piedata = array(); + $piedata = []; $sum = 0; $topdelimiters = $this->getTopDelimiters(); @@ -188,8 +188,8 @@ class StatDataset $dateformat_intra = $this->timeresconfig->getValue('dateformat-intra'); $axislabelint = $this->timeresconfig->getValue('axislabelint'); - $axis = array(); - $axispos = array(); + $axis = []; + $axispos = []; $xentries = count($this->results); $lastslot = 0; $i = 0; @@ -206,7 +206,7 @@ class StatDataset $axis[] = $this->datehandlerTick->prettyDateSlot($lastslot + 1, $slotsize, $dateformat_intra); - return array('axis' => $axis, 'axispos' => $axispos); + return ['axis' => $axis, 'axispos' => $axispos]; } /* @@ -215,7 +215,7 @@ class StatDataset public function getPercentValues() { $i = 0; - $dataset = array(); + $dataset = []; foreach ($this->results as $slot => $res) { if (array_key_exists($this->delimiter, $res)) { if ($res[$this->delimiter] === null) { @@ -254,7 +254,7 @@ class StatDataset return $presentationHandler->getPresentation(); } - return array(); + return []; } public function getDelimiterPresentationPie() @@ -262,7 +262,7 @@ class StatDataset $topdelimiters = $this->getTopDelimiters(); $delimiterPresentation = $this->getDelimiterPresentation(); - $pieaxis = array(); + $pieaxis = []; foreach ($topdelimiters as $key) { $keyName = $key; if (array_key_exists($key, $delimiterPresentation)) { @@ -277,7 +277,7 @@ class StatDataset public function loadData() { $statdir = $this->statconfig->getValue('statdir'); - $resarray = array(); + $resarray = []; $rules = \SimpleSAML\Utils\Arrays::arrayize($this->ruleid); foreach ($rules as $rule) { // Get file and extract results. @@ -306,4 +306,3 @@ class StatDataset $this->results = $combined; } } - diff --git a/modules/statistics/lib/Statistics/FieldPresentation/Base.php b/modules/statistics/lib/Statistics/FieldPresentation/Base.php index 591892b79871192d787c38acb4577ff8605bb49b..bb2568f1d6c8814acf4da00021d22ab7fb0ed8cb 100644 --- a/modules/statistics/lib/Statistics/FieldPresentation/Base.php +++ b/modules/statistics/lib/Statistics/FieldPresentation/Base.php @@ -17,6 +17,6 @@ class Base public function getPresentation() { - return array('_' => 'Total'); + return ['_' => 'Total']; } } diff --git a/modules/statistics/lib/Statistics/FieldPresentation/Entity.php b/modules/statistics/lib/Statistics/FieldPresentation/Entity.php index 15b4809cb068e5ee09a6fb8cfbe6fd8a741abe5a..624d215b7936cf16c4ce7fa5327742e08c71557a 100644 --- a/modules/statistics/lib/Statistics/FieldPresentation/Entity.php +++ b/modules/statistics/lib/Statistics/FieldPresentation/Entity.php @@ -9,7 +9,7 @@ class Entity extends Base $mh = \SimpleSAML\Metadata\MetaDataStorageHandler::getMetadataHandler(); $metadata = $mh->getList($this->config); - $translation = array('_' => 'All services'); + $translation = ['_' => 'All services']; foreach ($this->fields as $field) { if (array_key_exists($field, $metadata)) { if (array_key_exists('name', $metadata[$field])) { diff --git a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php index 5ceca8590c7a6a7f8f278909ac25a4ddabfcd3e5..875557bc8dab7c8a0896fe196208d9d57abf1e5b 100644 --- a/modules/statistics/lib/Statistics/Rulesets/BaseRule.php +++ b/modules/statistics/lib/Statistics/Rulesets/BaseRule.php @@ -27,7 +27,7 @@ class BaseRule $this->available = null; if (array_key_exists($ruleid, $available)) { - $this->available = $available[$ruleid]; + $this->available = $available[$ruleid]; } } @@ -39,7 +39,7 @@ class BaseRule public function availableTimeRes() { $timeresConfigs = $this->statconfig->getValue('timeres'); - $available_times = array(); + $available_times = []; foreach ($timeresConfigs as $tres => $tresconfig) { if (array_key_exists($tres, $this->available)) { $available_times[$tres] = $tresconfig['name']; @@ -62,9 +62,14 @@ class BaseRule /* * Get list of avaiable times in current file (rule) */ - $available_times = array(); + $available_times = []; foreach ($this->available[$timeres] as $slot) { - $available_times[$slot] = $datehandler->prettyHeader($slot, $slot + 1, $timeresConfig['fileslot'], $timeresConfig['dateformat-period']); + $available_times[$slot] = $datehandler->prettyHeader( + $slot, + $slot + 1, + $timeresConfig['fileslot'], + $timeresConfig['dateformat-period'] + ); } return $available_times; } @@ -110,15 +115,20 @@ class BaseRule if ($timeslotindex[$fileslot] < (count($timeslotindex) - 1)) { $available_times_next = $timeslots[$timeslotindex[$fileslot] + 1]; } - return array('prev' => $available_times_prev, 'next' => $available_times_next); + return ['prev' => $available_times_prev, 'next' => $available_times_next]; } public function getDataSet($preferTimeRes, $preferTime) { $timeres = $this->resolveTimeRes($preferTimeRes); $fileslot = $this->resolveFileSlot($timeres, $preferTime); - $dataset = new \SimpleSAML\Module\statistics\StatDataset($this->statconfig, $this->ruleconfig, $this->ruleid, $timeres, $fileslot); + $dataset = new \SimpleSAML\Module\statistics\StatDataset( + $this->statconfig, + $this->ruleconfig, + $this->ruleid, + $timeres, + $fileslot + ); return $dataset; } } - diff --git a/modules/statistics/lib/Statistics/Rulesets/Ratio.php b/modules/statistics/lib/Statistics/Rulesets/Ratio.php index 89d9f1c78fbeaf796627e3e110b2150361f4d8b0..1f76f6b4709791447db69970aafcf7d666e02175 100644 --- a/modules/statistics/lib/Statistics/Rulesets/Ratio.php +++ b/modules/statistics/lib/Statistics/Rulesets/Ratio.php @@ -65,8 +65,13 @@ class Ratio extends BaseRule $refNames = $this->ruleconfig->getArray('ref'); - $dataset = new \SimpleSAML\Module\statistics\RatioDataset($this->statconfig, $this->ruleconfig, $refNames, $timeres, $fileslot); + $dataset = new \SimpleSAML\Module\statistics\RatioDataset( + $this->statconfig, + $this->ruleconfig, + $refNames, + $timeres, + $fileslot + ); return $dataset; } } - diff --git a/modules/statistics/templates/statistics.tpl.php b/modules/statistics/templates/statistics.tpl.php index 91cca855098d7deb8898e2f7c949dafde2e1e118..2e111451f1347d1887aa2cda3f8e28f2e3f4e544 100644 --- a/modules/statistics/templates/statistics.tpl.php +++ b/modules/statistics/templates/statistics.tpl.php @@ -1,35 +1,38 @@ <?php $this->data['header'] = 'SimpleSAMLphp Statistics'; -$this->data['jquery'] = array('core' => true, 'ui' => true, 'css' => true); +$this->data['jquery'] = ['core' => true, 'ui' => true, 'css' => true]; -$this->data['head'] = '<link rel="stylesheet" type="text/css" href="' . SimpleSAML\Module::getModuleURL("statistics/assets/statistics.css") . '" />' . "\n"; -$this->data['head'] .= '<script type="text/javascript" src="' . SimpleSAML\Module::getModuleURL("statistics/assets/statistics.js") . '"></script>' . "\n"; +$this->data['head'] = '<link rel="stylesheet" type="text/css" href="'. + SimpleSAML\Module::getModuleURL("statistics/assets/css/statistics.css").'" />'."\n"; +$this->data['head'] .= '<script type="text/javascript" src="'. + SimpleSAML\Module::getModuleURL("statistics/assets/js/statistics.js").'"></script>'."\n"; $this->includeAtTemplateBase('includes/header.php'); -echo '<h1>'. $this->data['available.rules'][$this->data['selected.rule']]['name'] . '</h1>'; -echo '<p>' . $this->data['available.rules'][$this->data['selected.rule']]['descr'] . '</p>'; +echo '<h1>'.$this->data['available.rules'][$this->data['selected.rule']]['name'].'</h1>'; +echo '<p>'.$this->data['available.rules'][$this->data['selected.rule']]['descr'].'</p>'; // Report settings echo '<table class="selecttime">'; -echo '<tr><td class="selecttime_icon"><img src="' . SimpleSAML\Utils\HTTP::getBaseUrl() . 'resources/icons/crystal_project/kchart.32x32.png" alt="Report settings" /></td>'; +echo '<tr><td class="selecttime_icon"><img src="'.SimpleSAML\Utils\HTTP::getBaseURL(). + 'resources/icons/crystal_project/kchart.32x32.png" alt="Report settings" /></td>'; // Select report echo '<td>'; echo '<form action="#">'; foreach ($this->data['post_rule'] as $k => $v) { - echo '<input type="hidden" name="' . $k . '" value="'. htmlspecialchars($v) . '" />' . "\n"; + echo '<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'" />'."\n"; } if (!empty($this->data['available_rules'])) { echo '<select onchange="submit();" name="rule">'; foreach ($this->data['available_rules'] as $key => $rule) { if ($key === $this->data['selected_rule']) { - echo '<option selected="selected" value="' . $key . '">' . $rule['name'] . '</option>'; + echo '<option selected="selected" value="'.$key.'">'.$rule['name'].'</option>'; } else { - echo '<option value="' . $key . '">' . $rule['name'] . '</option>'; + echo '<option value="'.$key.'">'.$rule['name'].'</option>'; } } echo '</select>'; @@ -40,8 +43,8 @@ echo '</form></td>'; echo '<td class="td_right">'; echo '<form action="#">'; -foreach($this->data['post_d'] as $k => $v) { - echo '<input type="hidden" name="' . $k . '" value="'. htmlspecialchars($v) . '" />' . "\n"; +foreach ($this->data['post_d'] as $k => $v) { + echo '<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'" />'."\n"; } if (!empty($this->data['availdelimiters'])) { @@ -55,9 +58,10 @@ if (!empty($this->data['availdelimiters'])) { if ($key == '_') { echo '<option value="_">Total</option>'; } elseif (isset($_REQUEST['d']) && $delim == $_REQUEST['d']) { - echo '<option selected="selected" value="' . htmlspecialchars($delim) . '">' . htmlspecialchars($delimName) . '</option>'; + echo '<option selected="selected" value="'.htmlspecialchars($delim).'">'. + htmlspecialchars($delimName).'</option>'; } else { - echo '<option value="' . htmlspecialchars($delim) . '">' . htmlspecialchars($delimName) . '</option>'; + echo '<option value="'.htmlspecialchars($delim).'">'.htmlspecialchars($delimName).'</option>'; } } echo '</select>'; @@ -71,10 +75,11 @@ echo '</table>'; // Select time and date echo '<table class="selecttime">'; -echo '<tr><td class="selecttime_icon"><img src="' . SimpleSAML\Utils\HTTP::getBaseUrl() . 'resources/icons/crystal_project/date.32x32.png" alt="Select date and time" /></td>'; +echo '<tr><td class="selecttime_icon"><img src="'.SimpleSAML\Utils\HTTP::getBaseURL(). + 'resources/icons/crystal_project/date.32x32.png" alt="Select date and time" /></td>'; if (isset($this->data['available.times.prev'])) { - echo '<td><a href="' . $this->data['get_times_prev'] . '">« Previous</a></td>'; + echo '<td><a href="'.$this->data['get_times_prev'].'">« Previous</a></td>'; } else { echo '<td class="selecttime_link_grey">« Previous</td>'; } @@ -83,16 +88,16 @@ echo '<td class="td_right">'; echo '<form action="#">'; foreach ($this->data['post_res'] as $k => $v) { - echo '<input type="hidden" name="' . $k . '" value="'. htmlspecialchars($v) . '" />' . "\n"; + echo '<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'" />'."\n"; } if (!empty($this->data['available.timeres'])) { echo '<select onchange="submit();" name="res">'; foreach ($this->data['available.timeres'] as $key => $timeresname) { if ($key == $this->data['selected.timeres']) { - echo '<option selected="selected" value="' . $key . '">' . $timeresname . '</option>'; + echo '<option selected="selected" value="'.$key.'">'.$timeresname.'</option>'; } else { - echo '<option value="' . $key . '">' . $timeresname . '</option>'; + echo '<option value="'.$key.'">'.$timeresname.'</option>'; } } echo '</select>'; @@ -103,16 +108,16 @@ echo '<td class="td_left">'; echo '<form action="#">'; foreach ($this->data['post_time'] as $k => $v) { - echo '<input type="hidden" name="' . $k . '" value="'. htmlspecialchars($v) . '" />' . "\n"; + echo '<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'" />'."\n"; } if (!empty($this->data['available.times'])) { echo '<select onchange="submit();" name="time">'; foreach ($this->data['available.times'] as $key => $timedescr) { if ($key == $this->data['selected.time']) { - echo '<option selected="selected" value="' . $key . '">' . $timedescr . '</option>'; + echo '<option selected="selected" value="'.$key.'">'.$timedescr.'</option>'; } else { - echo '<option value="' . $key . '">' . $timedescr . '</option>'; + echo '<option value="'.$key.'">'.$timedescr.'</option>'; } } echo '</select>'; @@ -120,14 +125,14 @@ if (!empty($this->data['available.times'])) { echo '</form></td>'; if (isset($this->data['available.times.next'])) { - echo '<td class="td_right td_next_right"><a href="' . $this->data['get_times_next'] . '">Next »</a></td>'; + echo '<td class="td_right td_next_right"><a href="'.$this->data['get_times_next'].'">Next »</a></td>'; } else { echo '<td class="td_right selecttime_link_grey td_next_right">Next »</td>'; } echo '</tr></table>'; echo '<div id="tabdiv">'; -if (!empty($this->data['results'])){ +if (!empty($this->data['results'])) { echo '<ul class="tabset_tabs"> <li><a href="#graph">Graph</a></li> <li><a href="#table">Summary table</a></li> @@ -137,22 +142,22 @@ if (!empty($this->data['results'])){ <div id="graph" class="tabset_content">'; - echo '<img src="' . htmlspecialchars($this->data['imgurl']) . '" alt="Graph" />'; + echo '<img src="'.htmlspecialchars($this->data['imgurl']).'" alt="Graph" />'; echo '<form action="#">'; echo '<p class="p_right">Compare with total from this dataset '; foreach ($this->data['post_rule2'] as $k => $v) { - echo '<input type="hidden" name="' . $k . '" value="'. htmlspecialchars($v) . '" />' . "\n"; + echo '<input type="hidden" name="'.$k.'" value="'.htmlspecialchars($v).'" />'."\n"; } echo '<select onchange="submit();" name="rule2">'; echo ' <option value="_">None</option>'; foreach ($this->data['available_rules'] as $key => $rule) { if ($key === $this->data['selected.rule2']) { - echo '<option selected="selected" value="' . $key . '">' . $rule['name'] . '</option>'; + echo '<option selected="selected" value="'.$key.'">'.$rule['name'].'</option>'; } else { - echo '<option value="' . $key . '">' . $rule['name'] . '</option>'; + echo '<option value="'.$key.'">'.$rule['name'].'</option>'; } } echo '</select></p></form>'; @@ -160,13 +165,14 @@ if (!empty($this->data['results'])){ echo '</div>'; // end graph content. /** - * Handle table view - - - - - - + * Handle table view - - - - - - */ - $classint = array('odd', 'even'); $i = 0; + $classint = ['odd', 'even']; + $i = 0; echo '<div id="table" class="tabset_content">'; if (isset($this->data['pieimgurl'])) { - echo '<img src="' . $this->data['pieimgurl'] . '" alt="Pie chart" />'; + echo '<img src="'.$this->data['pieimgurl'].'" alt="Pie chart" />'; } echo '<table class="tableview"><tr><th class="value">Value</th><th class="category">Data range</th></tr>'; @@ -179,14 +185,16 @@ if (!empty($this->data['results'])){ } if ($key === '_') { - echo '<tr class="total ' . $clint . '"><td class="value">' . $value . '</td><td class="category">' . $keyName . '</td></tr>'; + echo '<tr class="total '.$clint.'"><td class="value">'. + $value.'</td><td class="category">'.$keyName.'</td></tr>'; } else { - echo '<tr class="' . $clint . '"><td class="value">' . $value . '</td><td class="category">' . $keyName . '</td></tr>'; + echo '<tr class="'.$clint.'"><td class="value">'.$value. + '</td><td class="category">'.$keyName.'</td></tr>'; } } echo '</table></div>'; - // - - - - - - - End table view - - - - - - - + // - - - - - - - End table view - - - - - - - echo '<div id="debug" >'; echo '<table class="timeseries">'; @@ -196,19 +204,19 @@ if (!empty($this->data['results'])){ if (array_key_exists($key, $this->data['delimiterPresentation'])) { $keyName = $this->data['delimiterPresentation'][$key]; } - echo'<th>' . $keyName . '</th>'; + echo'<th>'.$keyName.'</th>'; } echo '</tr>'; $i = 0; foreach ($this->data['debugdata'] as $slot => $dd) { - echo '<tr class="' . ((++$i % 2) == 0 ? 'odd' : 'even') . '">'; - echo '<td>' . $dd[0] . '</td>'; - echo '<td class="datacontent">' . $dd[1] . '</td>'; + echo '<tr class="'.((++$i % 2) == 0 ? 'odd' : 'even').'">'; + echo '<td>'.$dd[0].'</td>'; + echo '<td class="datacontent">'.$dd[1].'</td>'; foreach ($this->data['topdelimiters'] as $key) { - echo '<td class="datacontent">' . (array_key_exists($key, $this->data['results'][$slot]) ? - $this->data['results'][$slot][$key] : ' ') . '</td>'; + echo '<td class="datacontent">'.(array_key_exists($key, $this->data['results'][$slot]) ? + $this->data['results'][$slot][$key] : ' ').'</td>'; } echo '</tr>'; } diff --git a/modules/statistics/templates/statistics.twig b/modules/statistics/templates/statistics.twig index f3031f5c4cc8dead578cf072ae984582b21dd832..e9f8946f936271139fa4f7c11609439ff53c0c51 100644 --- a/modules/statistics/templates/statistics.twig +++ b/modules/statistics/templates/statistics.twig @@ -2,11 +2,11 @@ {% extends "base.twig" %} {% block preload %} - <link href="{{ baseurlpath }}assets/statistics.css" rel="stylesheet" /> + <link href="{{ baseurlpath }}assets/css/statistics.css" rel="stylesheet" /> {% endblock %} {% block postload %} -<script type="text/javascript" src="{{ baseurlpath }}assets/statistics.js"></script> +<script type="text/javascript" src="{{ baseurlpath }}assets/js/statistics.js"></script> {% endblock %} {% block content %} @@ -16,7 +16,7 @@ <table class="selecttime"> <tr> <td class="selecttime_icon"> - <img src="/{{ baseurlpath }}resources/icons/crystal_project/kchart.32x32.png" alt="Report settings" /> + <i class="fa fa-pie-chart"></i> </td> <td> <form action="#"> @@ -66,7 +66,7 @@ <table class="selecttime"> <tr> <td class="selecttime_icon"> - <img src="/{{ baseurlpath }}resources/icons/crystal_project/date.32x32.png" alt="Select date and time" /> + <i class="fa fa-calendar"></i> </td> {% if available_times_prev %} <td><a href="{{ get_times_prev }}">« Previous</a></td> @@ -154,7 +154,7 @@ <th class="category">Data range</th> </tr> {% for key, value in summaryDataset %} - {% if loop.index0 % 2 == 0 %} + {% if loop.index0 is even %} {% set class = 'even' %} {% else %} {% set class = 'odd' %} @@ -186,17 +186,16 @@ <th>Time</th> <th>Total</th> {% for key, value in topdelimiters %} - {% set keyName = key %} - {% if delimiterPresentation[key] is defined %} - {% set keyName = delimiterPresentation[key] %} + {% set keyName = value %} + {% if delimiterPresentation[value] is defined %} + {% set keyName = delimiterPresentation[value] %} {% endif %} <th>{{ keyName }}</th> {% endfor %} </tr> - {% set i = 0 %} {% for slot, dd in debugdata %} - {% if i % 2 == 0 %} + {% if loop.index0 is even %} {% set class = 'even' %} {% else %} {% set class = 'odd' %} @@ -206,8 +205,8 @@ <td>{{ dd[0] }}</td> <td class="datacontent">{{ dd[1] }}</td> {% for key, value in topdelimiters %} - {% if results.slot is defined %} - <td class="datacontent">{{ results.slot.key }}</td> + {% if results[slot] is defined %} + <td class="datacontent">{{ results[slot][value] }}</td> {% else %} <td class="datacontent"> </td> {% endif %} diff --git a/modules/statistics/templates/statmeta.tpl.php b/modules/statistics/templates/statmeta.tpl.php index 9af5a032ef3ce5b9caf74256de5bbb8c9ca6b885..324b4e0c5c2ad26a0abf5e3b3c2ee82d98ec3a0b 100644 --- a/modules/statistics/templates/statmeta.tpl.php +++ b/modules/statistics/templates/statmeta.tpl.php @@ -1,6 +1,7 @@ <?php $this->data['header'] = 'SimpleSAMLphp Statistics Metadata'; -$this->data['head'] = '<link rel="stylesheet" type="text/css" href="' . SimpleSAML\Module::getModuleURL("statistics/style.css") . '" />'; +$this->data['head'] = '<link rel="stylesheet" type="text/css" href="'. + SimpleSAML\Module::getModuleURL("statistics/assets/css/statistics.css").'" />'; $this->includeAtTemplateBase('includes/header.php'); echo '<table id="statmeta">' ; @@ -9,34 +10,33 @@ if (isset($this->data['metadata'])) { $metadata = $this->data['metadata']; if (isset($metadata['lastrun'])) { - echo '<tr><td>Aggregator last run at</td><td>' . $metadata['lastrun'] . '</td></tr>'; + echo '<tr><td>Aggregator last run at</td><td>'.$metadata['lastrun'].'</td></tr>'; } if (isset($metadata['notBefore'])) { - echo '<tr><td>Aggregated data until</td><td>' . $metadata['notBefore'] . '</td></tr>'; + echo '<tr><td>Aggregated data until</td><td>'.$metadata['notBefore'].'</td></tr>'; } if (isset($metadata['memory'])) { - echo '<tr><td>Memory usage</td><td>' . $metadata['memory'] . ' MB' . '</td></tr>'; + echo '<tr><td>Memory usage</td><td>'.$metadata['memory'].' MB'.'</td></tr>'; } if (isset($metadata['time'])) { - echo '<tr><td>Execution time</td><td>' . $metadata['time'] . ' seconds' . '</td></tr>'; + echo '<tr><td>Execution time</td><td>'.$metadata['time'].' seconds'.'</td></tr>'; } - if (isset($metadata['lastlinehash'] )) { - echo '<tr><td>SHA1 of last processed logline</td><td>' . $metadata['lastlinehash'] . '</td></tr>'; + if (isset($metadata['lastlinehash'])) { + echo '<tr><td>SHA1 of last processed logline</td><td>'.$metadata['lastlinehash'].'</td></tr>'; } - if (isset($metadata['lastline'] )) { - echo '<tr><td>Last processed logline</td><td>' . $metadata['lastline'] . '</td></tr>'; + if (isset($metadata['lastline'])) { + echo '<tr><td>Last processed logline</td><td>'.$metadata['lastline'].'</td></tr>'; } } else { echo '<tr><td>No metadata found</td></tr>'; } echo '</table>'; -echo '<p>[ <a href="' . SimpleSAML\Module::getModuleURL("statistics/showstats.php") . '">Show statistics</a> ] </p>'; +echo '<p>[ <a href="'.SimpleSAML\Module::getModuleURL("statistics/showstats.php").'">Show statistics</a> ] </p>'; $this->includeAtTemplateBase('includes/footer.php'); - diff --git a/modules/statistics/templates/statmeta.twig b/modules/statistics/templates/statmeta.twig index dd2c475c552376eb815c69729eef252f222ab9b4..09808e837a0d97818e143582d9915199cfe24d43 100644 --- a/modules/statistics/templates/statmeta.twig +++ b/modules/statistics/templates/statmeta.twig @@ -2,7 +2,7 @@ {% extends "base.twig" %} {% block preload %} - <link href="{{ baseurlpath }}style.css" rel="stylesheet" /> + <link href="{{ baseurlpath }}assets/css/statistics.css" rel="stylesheet" /> {% endblock %} {% block content %} diff --git a/modules/statistics/www/assets/css/statistics.css b/modules/statistics/www/assets/css/statistics.css new file mode 100644 index 0000000000000000000000000000000000000000..4d0d163d600681ffe26fa34cee7cd7cbd9505bc4 --- /dev/null +++ b/modules/statistics/www/assets/css/statistics.css @@ -0,0 +1,127 @@ +@media all { + div#content { + margin: .4em ! important; + } + + .tableview { + border-collapse: collapse; + border: 1px solid #ccc; + margin: 1em; + width: 80%; + } + + .tableview th, .tableview td { + border: 1px solid #ccc; + padding: 0px 5px; + } + + .tableview th { + background: #e5e5e5; + } + + .tableview tr.total td { + color: #500; font-weight: bold; + } + + .tableview tr.even td { + background: #f5f5f5; + border-top: 1px solid #e0e0e0; + border-bottom: 1px solid #e0e0e0; + } + + .tableview th.value, .tableview td.value { + text-align: right; + } + + table.timeseries tr.odd td { + background-color: #f4f4f4; + } + + table.timeseries td { + padding-right: 2em; border: 1px solid #ccc + } + + td.datacontent { + text-align: right; + } + + table.selecttime { + width: 100%; + border: 1px solid #ccc; + background: #eee; + margin: 1px 0px; padding: 0px; + } + + td.selecttime_icon { + width: 50px; + padding: 0px; + } + + td.selecttime_icon img { + margin: 0px; + } + + td.selecttime_link_grey { + color: #ccc; + } + + td.td_right { + text-align: right; + } + td.td_next_right { + padding-right: 4px; + } + td.td_left { + text-align: left; + } + + p.p_right { + text-align: right; + } + + form { + display: inline; + } + + table#statmeta { + width: 100%; + } + + ul.tabset_tabs { + margin: 0px; + padding: 0px; + list-style: none; + } + + ul.tabset_tabs li { + background: none; + color: #222; + display: inline-block; + padding: 10px 15px; + cursor: pointer; + } + + ul.tabset_tabs li.current { + background: #ededed; + color: #222; + } + + .tabset_content { + display: none; + background: #ededed; + padding: 15px; + } + + .tabset_content.current { + display: inherit; + } + + #graph img { + max-width: 77%; + height: auto; + } + #table img { + max-width: 77%; + height: auto; + } +} diff --git a/modules/statistics/www/assets/js/statistics.js b/modules/statistics/www/assets/js/statistics.js new file mode 100644 index 0000000000000000000000000000000000000000..54a72551d90bc1b501e5c2d01f0b83879af7efcc --- /dev/null +++ b/modules/statistics/www/assets/js/statistics.js @@ -0,0 +1,8 @@ +$(document).ready(function () { + $("#tabdiv").tabs(); + $('ul.tabset_tabs li').click( + function () { + $("html, body").animate({ scrollTop: 0 }, "slow"); + } + ) +}); diff --git a/modules/statistics/www/assets/statistics.js b/modules/statistics/www/assets/statistics.js index d7faf312f3381f85c80dce9ff96bdf2c9ddbc982..54a72551d90bc1b501e5c2d01f0b83879af7efcc 100644 --- a/modules/statistics/www/assets/statistics.js +++ b/modules/statistics/www/assets/statistics.js @@ -1,7 +1,7 @@ -$(document).ready(function() { +$(document).ready(function () { $("#tabdiv").tabs(); $('ul.tabset_tabs li').click( - function() { + function () { $("html, body").animate({ scrollTop: 0 }, "slow"); } ) diff --git a/modules/statistics/www/showstats.php b/modules/statistics/www/showstats.php index 4a38467cec9d475cae7eab87bf81aaff96443d00..a8a2f247b7c87014fa225b465535b1ef12918e7f 100644 --- a/modules/statistics/www/showstats.php +++ b/modules/statistics/www/showstats.php @@ -51,7 +51,7 @@ $t->data['selected_rule'] = $rule; $t->data['selected_rule2'] = $preferRule2; $t->data['post_d'] = getBaseURL($t, 'post', 'd'); - + try { $dataset = $statrule->getDataset($preferTimeRes, $preferTime); $dataset->setDelimiter($delimiter); @@ -69,7 +69,6 @@ try { } exit; } - } catch (\Exception $e) { $t->data['error'] = "No data available"; $t->show(); @@ -86,12 +85,12 @@ $timeNavigation = $statrule->getTimeNavigation($timeres, $preferTime); $piedata = $dataset->getPieData(); -$datasets = array(); +$datasets = []; $datasets[] = $dataset->getPercentValues(); $axis = $dataset->getAxis(); -$maxes = array(); +$maxes = []; $maxes[] = $dataset->getMax(); @@ -149,17 +148,17 @@ $t->data['get_times_next'] = getBaseURL($t, 'get', 'time', $t->data['available_t $t->data['availdelimiters'] = $dataset->availDelimiters(); $t->data['delimiterPresentation'] = $dataset->getDelimiterPresentation(); -$t->data['jquery'] = array('core' => false, 'ui' => true, 'css' => true); +$t->data['jquery'] = ['core' => false, 'ui' => true, 'css' => true]; $t->show(); function getBaseURL($t, $type = 'get', $key = null, $value = null) { - $vars = array( + $vars = [ 'rule' => $t->data['selected_rule'], 'time' => $t->data['selected_time'], 'res' => $t->data['selected_timeres'], - ); + ]; if (isset($t->data['selected_delimiter'])) { $vars['d'] = $t->data['selected_delimiter']; } diff --git a/modules/statistics/www/statmeta.php b/modules/statistics/www/statmeta.php index 442723d0bd8961c0ab94b85bc2db59167fed57a8..dd252bb26e1b66f21b21e5c63ca3b9067be4c8c3 100644 --- a/modules/statistics/www/statmeta.php +++ b/modules/statistics/www/statmeta.php @@ -25,4 +25,3 @@ if ($metadata !== null) { } $t->show(); - diff --git a/schemas/oasis-sstc-saml-schema-assertion-1.1.xsd b/schemas/oasis-sstc-saml-schema-assertion-1.1.xsd index dee3a3e261a6a2bb4b64a05b48d4fdf4221b7bbf..1516399bf93cd77f3d129f892c08b8f3094f5988 100644 --- a/schemas/oasis-sstc-saml-schema-assertion-1.1.xsd +++ b/schemas/oasis-sstc-saml-schema-assertion-1.1.xsd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="1.1"> - <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/> + <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/> <annotation> <documentation> Document identifier: oasis-sstc-saml-schema-assertion-1.1 diff --git a/schemas/oasis-sstc-saml-schema-protocol-1.1.xsd b/schemas/oasis-sstc-saml-schema-protocol-1.1.xsd index 8bea3a9444e892105c01cb33fa5f41ee153c3199..ea440772588bb1120a8cd281f8d0611c41f43854 100644 --- a/schemas/oasis-sstc-saml-schema-protocol-1.1.xsd +++ b/schemas/oasis-sstc-saml-schema-protocol-1.1.xsd @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="1.1"> <import namespace="urn:oasis:names:tc:SAML:1.0:assertion" schemaLocation="oasis-sstc-saml-schema-assertion-1.1.xsd"/> - <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/> + <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/> <annotation> <documentation> Document identifier: oasis-sstc-saml-schema-protocol-1.1 diff --git a/schemas/saml-schema-assertion-2.0.xsd b/schemas/saml-schema-assertion-2.0.xsd index 9bbfa26e316d2328666d3ed4b9d530f4fd37aff3..2b2f7b8018a7390584352c42a5db5654d6bd6033 100644 --- a/schemas/saml-schema-assertion-2.0.xsd +++ b/schemas/saml-schema-assertion-2.0.xsd @@ -10,9 +10,9 @@ blockDefault="substitution" version="2.0"> <import namespace="http://www.w3.org/2000/09/xmldsig#" - schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/> + schemaLocation="xmldsig-core-schema.xsd"/> <import namespace="http://www.w3.org/2001/04/xmlenc#" - schemaLocation="http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd"/> + schemaLocation="xenc-schema.xsd"/> <annotation> <documentation> Document identifier: saml-schema-assertion-2.0 diff --git a/schemas/saml-schema-metadata-2.0.xsd b/schemas/saml-schema-metadata-2.0.xsd index 923b598bf890348da4a064762550b3417815ed1c..b656d4f414dcbcac4bb98ccb729af280ea7b2a48 100644 --- a/schemas/saml-schema-metadata-2.0.xsd +++ b/schemas/saml-schema-metadata-2.0.xsd @@ -11,13 +11,13 @@ blockDefault="substitution" version="2.0"> <import namespace="http://www.w3.org/2000/09/xmldsig#" - schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/> + schemaLocation="xmldsig-core-schema.xsd"/> <import namespace="http://www.w3.org/2001/04/xmlenc#" - schemaLocation="http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd"/> + schemaLocation="xenc-schema.xsd"/> <import namespace="urn:oasis:names:tc:SAML:2.0:assertion" schemaLocation="saml-schema-assertion-2.0.xsd"/> <import namespace="http://www.w3.org/XML/1998/namespace" - schemaLocation="http://www.w3.org/2001/xml.xsd"/> + schemaLocation="xml.xsd"/> <annotation> <documentation> Document identifier: saml-schema-metadata-2.0 diff --git a/schemas/saml-schema-protocol-2.0.xsd b/schemas/saml-schema-protocol-2.0.xsd index 13656b18ae222ce83d2d2a7973ccacd6133bc693..7fa6f489d684a7375e0581bcf53ca9e34a4e6d10 100644 --- a/schemas/saml-schema-protocol-2.0.xsd +++ b/schemas/saml-schema-protocol-2.0.xsd @@ -12,7 +12,7 @@ <import namespace="urn:oasis:names:tc:SAML:2.0:assertion" schemaLocation="saml-schema-assertion-2.0.xsd"/> <import namespace="http://www.w3.org/2000/09/xmldsig#" - schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/> + schemaLocation="xmldsig-core-schema.xsd"/> <annotation> <documentation> Document identifier: saml-schema-protocol-2.0 diff --git a/schemas/xenc-schema.xsd b/schemas/xenc-schema.xsd new file mode 100644 index 0000000000000000000000000000000000000000..d61229fd50c3da59409a86aebbee2ca83df4cb58 --- /dev/null +++ b/schemas/xenc-schema.xsd @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE schema PUBLIC "-//W3C//DTD XMLSchema 200102//EN" + "http://www.w3.org/2001/XMLSchema.dtd" + [ + <!ATTLIST schema + xmlns:xenc CDATA #FIXED 'http://www.w3.org/2001/04/xmlenc#' + xmlns:ds CDATA #FIXED 'http://www.w3.org/2000/09/xmldsig#'> + <!ENTITY xenc 'http://www.w3.org/2001/04/xmlenc#'> + <!ENTITY % p ''> + <!ENTITY % s ''> + ]> + +<schema xmlns='http://www.w3.org/2001/XMLSchema' version='1.0' + xmlns:xenc='http://www.w3.org/2001/04/xmlenc#' + xmlns:ds='http://www.w3.org/2000/09/xmldsig#' + targetNamespace='http://www.w3.org/2001/04/xmlenc#' + elementFormDefault='qualified'> + + <import namespace='http://www.w3.org/2000/09/xmldsig#' + schemaLocation='xmldsig-core-schema.xsd'/> + + <complexType name='EncryptedType' abstract='true'> + <sequence> + <element name='EncryptionMethod' type='xenc:EncryptionMethodType' + minOccurs='0'/> + <element ref='ds:KeyInfo' minOccurs='0'/> + <element ref='xenc:CipherData'/> + <element ref='xenc:EncryptionProperties' minOccurs='0'/> + </sequence> + <attribute name='Id' type='ID' use='optional'/> + <attribute name='Type' type='anyURI' use='optional'/> + <attribute name='MimeType' type='string' use='optional'/> + <attribute name='Encoding' type='anyURI' use='optional'/> + </complexType> + + <complexType name='EncryptionMethodType' mixed='true'> + <sequence> + <element name='KeySize' minOccurs='0' type='xenc:KeySizeType'/> + <element name='OAEPparams' minOccurs='0' type='base64Binary'/> + <any namespace='##other' minOccurs='0' maxOccurs='unbounded'/> + </sequence> + <attribute name='Algorithm' type='anyURI' use='required'/> + </complexType> + + <simpleType name='KeySizeType'> + <restriction base="integer"/> + </simpleType> + + <element name='CipherData' type='xenc:CipherDataType'/> + <complexType name='CipherDataType'> + <choice> + <element name='CipherValue' type='base64Binary'/> + <element ref='xenc:CipherReference'/> + </choice> + </complexType> + + <element name='CipherReference' type='xenc:CipherReferenceType'/> + <complexType name='CipherReferenceType'> + <choice> + <element name='Transforms' type='xenc:TransformsType' minOccurs='0'/> + </choice> + <attribute name='URI' type='anyURI' use='required'/> + </complexType> + + <complexType name='TransformsType'> + <sequence> + <element ref='ds:Transform' maxOccurs='unbounded'/> + </sequence> + </complexType> + + + <element name='EncryptedData' type='xenc:EncryptedDataType'/> + <complexType name='EncryptedDataType'> + <complexContent> + <extension base='xenc:EncryptedType'> + </extension> + </complexContent> + </complexType> + + <!-- Children of ds:KeyInfo --> + + <element name='EncryptedKey' type='xenc:EncryptedKeyType'/> + <complexType name='EncryptedKeyType'> + <complexContent> + <extension base='xenc:EncryptedType'> + <sequence> + <element ref='xenc:ReferenceList' minOccurs='0'/> + <element name='CarriedKeyName' type='string' minOccurs='0'/> + </sequence> + <attribute name='Recipient' type='string' + use='optional'/> + </extension> + </complexContent> + </complexType> + + <element name="AgreementMethod" type="xenc:AgreementMethodType"/> + <complexType name="AgreementMethodType" mixed="true"> + <sequence> + <element name="KA-Nonce" minOccurs="0" type="base64Binary"/> + <!-- <element ref="ds:DigestMethod" minOccurs="0"/> --> + <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/> + <element name="OriginatorKeyInfo" minOccurs="0" type="ds:KeyInfoType"/> + <element name="RecipientKeyInfo" minOccurs="0" type="ds:KeyInfoType"/> + </sequence> + <attribute name="Algorithm" type="anyURI" use="required"/> + </complexType> + + <!-- End Children of ds:KeyInfo --> + + <element name='ReferenceList'> + <complexType> + <choice minOccurs='1' maxOccurs='unbounded'> + <element name='DataReference' type='xenc:ReferenceType'/> + <element name='KeyReference' type='xenc:ReferenceType'/> + </choice> + </complexType> + </element> + + <complexType name='ReferenceType'> + <sequence> + <any namespace='##other' minOccurs='0' maxOccurs='unbounded'/> + </sequence> + <attribute name='URI' type='anyURI' use='required'/> + </complexType> + + + <element name='EncryptionProperties' type='xenc:EncryptionPropertiesType'/> + <complexType name='EncryptionPropertiesType'> + <sequence> + <element ref='xenc:EncryptionProperty' maxOccurs='unbounded'/> + </sequence> + <attribute name='Id' type='ID' use='optional'/> + </complexType> + + <element name='EncryptionProperty' type='xenc:EncryptionPropertyType'/> + <complexType name='EncryptionPropertyType' mixed='true'> + <choice maxOccurs='unbounded'> + <any namespace='##other' processContents='lax'/> + </choice> + <attribute name='Target' type='anyURI' use='optional'/> + <attribute name='Id' type='ID' use='optional'/> + <anyAttribute namespace="http://www.w3.org/XML/1998/namespace"/> + </complexType> + +</schema> + diff --git a/schemas/xml.xsd b/schemas/xml.xsd new file mode 100644 index 0000000000000000000000000000000000000000..aea7d0db0a423b962247aa2b4d3d48fc73cda659 --- /dev/null +++ b/schemas/xml.xsd @@ -0,0 +1,287 @@ +<?xml version='1.0'?> +<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?> +<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns ="http://www.w3.org/1999/xhtml" + xml:lang="en"> + + <xs:annotation> + <xs:documentation> + <div> + <h1>About the XML namespace</h1> + + <div class="bodytext"> + <p> + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + </p> + <p> + See <a href="http://www.w3.org/XML/1998/namespace.html"> + http://www.w3.org/XML/1998/namespace.html</a> and + <a href="http://www.w3.org/TR/REC-xml"> + http://www.w3.org/TR/REC-xml</a> for information + about this namespace. + </p> + <p> + Note that local names in this namespace are intended to be + defined only by the World Wide Web Consortium or its subgroups. + The names currently defined in this namespace are listed below. + They should not be used with conflicting semantics by any Working + Group, specification, or document instance. + </p> + <p> + See further below in this document for more information about <a + href="#usage">how to refer to this schema document from your own + XSD schema documents</a> and about <a href="#nsversioning">the + namespace-versioning policy governing this schema document</a>. + </p> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:attribute name="lang"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>lang (as an attribute name)</h3> + <p> + denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification.</p> + + </div> + <div> + <h4>Notes</h4> + <p> + Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. + </p> + <p> + See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt"> + http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a> + and the IANA language subtag registry at + <a href="http://www.iana.org/assignments/language-subtag-registry"> + http://www.iana.org/assignments/language-subtag-registry</a> + for further information. + </p> + <p> + The union allows for the 'un-declaration' of xml:lang with + the empty string. + </p> + </div> + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:union memberTypes="xs:language"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value=""/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="space"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>space (as an attribute name)</h3> + <p> + denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification.</p> + + </div> + </xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:restriction base="xs:NCName"> + <xs:enumeration value="default"/> + <xs:enumeration value="preserve"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="base" type="xs:anyURI"> <xs:annotation> + <xs:documentation> + <div> + + <h3>base (as an attribute name)</h3> + <p> + denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification.</p> + + <p> + See <a + href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a> + for information about this attribute. + </p> + </div> + </xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attribute name="id" type="xs:ID"> + <xs:annotation> + <xs:documentation> + <div> + + <h3>id (as an attribute name)</h3> + <p> + denotes an attribute whose value + should be interpreted as if declared to be of type ID. + This name is reserved by virtue of its definition in the + xml:id specification.</p> + + <p> + See <a + href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a> + for information about this attribute. + </p> + </div> + </xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attributeGroup name="specialAttrs"> + <xs:attribute ref="xml:base"/> + <xs:attribute ref="xml:lang"/> + <xs:attribute ref="xml:space"/> + <xs:attribute ref="xml:id"/> + </xs:attributeGroup> + + <xs:annotation> + <xs:documentation> + <div> + + <h3>Father (in any context at all)</h3> + + <div class="bodytext"> + <p> + denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + </p> + <blockquote> + <p> + In appreciation for his vision, leadership and + dedication the W3C XML Plenary on this 10th day of + February, 2000, reserves for Jon Bosak in perpetuity + the XML name "xml:Father". + </p> + </blockquote> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation> + <div xml:id="usage" id="usage"> + <h2><a name="usage">About this schema document</a></h2> + + <div class="bodytext"> + <p> + This schema defines attributes and an attribute group suitable + for use by schemas wishing to allow <code>xml:base</code>, + <code>xml:lang</code>, <code>xml:space</code> or + <code>xml:id</code> attributes on elements they define. + </p> + <p> + To enable this, such a schema must import this schema for + the XML namespace, e.g. as follows: + </p> + <pre> + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/xml.xsd"/> + </pre> + <p> + or + </p> + <pre> + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2009/01/xml.xsd"/> + </pre> + <p> + Subsequently, qualified reference to any of the attributes or the + group defined below will have the desired effect, e.g. + </p> + <pre> + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + </pre> + <p> + will define a type which will schema-validate an instance element + with any of those attributes. + </p> + </div> + </div> + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation> + <div id="nsversioning" xml:id="nsversioning"> + <h2><a name="nsversioning">Versioning policy for this schema document</a></h2> + <div class="bodytext"> + <p> + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + <a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd</a>. + </p> + <p> + At the date of issue it can also be found at + <a href="http://www.w3.org/2001/xml.xsd"> + http://www.w3.org/2001/xml.xsd</a>. + </p> + <p> + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML + Schema itself, or with the XML namespace itself. In other words, + if the XML Schema or XML namespaces change, the version of this + document at <a href="http://www.w3.org/2001/xml.xsd"> + http://www.w3.org/2001/xml.xsd + </a> + will change accordingly; the version at + <a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd + </a> + will not change. + </p> + <p> + Previous dated (and unchanging) versions of this schema + document are at: + </p> + <ul> + <li><a href="http://www.w3.org/2009/01/xml.xsd"> + http://www.w3.org/2009/01/xml.xsd</a></li> + <li><a href="http://www.w3.org/2007/08/xml.xsd"> + http://www.w3.org/2007/08/xml.xsd</a></li> + <li><a href="http://www.w3.org/2004/10/xml.xsd"> + http://www.w3.org/2004/10/xml.xsd</a></li> + <li><a href="http://www.w3.org/2001/03/xml.xsd"> + http://www.w3.org/2001/03/xml.xsd</a></li> + </ul> + </div> + </div> + </xs:documentation> + </xs:annotation> + +</xs:schema> + diff --git a/schemas/xmldsig-core-schema.xsd b/schemas/xmldsig-core-schema.xsd new file mode 100644 index 0000000000000000000000000000000000000000..df126b30e684091b32a748cd2e408f5fb9d651a9 --- /dev/null +++ b/schemas/xmldsig-core-schema.xsd @@ -0,0 +1,318 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE schema + PUBLIC "-//W3C//DTD XMLSchema 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd" + [ + <!ATTLIST schema + xmlns:ds CDATA #FIXED "http://www.w3.org/2000/09/xmldsig#"> + <!ENTITY dsig 'http://www.w3.org/2000/09/xmldsig#'> + <!ENTITY % p ''> + <!ENTITY % s ''> + ]> + +<!-- Schema for XML Signatures + http://www.w3.org/2000/09/xmldsig# + $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $ + + Copyright 2001 The Internet Society and W3C (Massachusetts Institute + of Technology, Institut National de Recherche en Informatique et en + Automatique, Keio University). All Rights Reserved. + http://www.w3.org/Consortium/Legal/ + + This document is governed by the W3C Software License [1] as described + in the FAQ [2]. + + [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720 + [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD +--> + + +<schema xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" + targetNamespace="http://www.w3.org/2000/09/xmldsig#" + version="0.1" elementFormDefault="qualified"> + +<!-- Basic Types Defined for Signatures --> + +<simpleType name="CryptoBinary"> + <restriction base="base64Binary"> + </restriction> +</simpleType> + +<!-- Start Signature --> + +<element name="Signature" type="ds:SignatureType"/> +<complexType name="SignatureType"> + <sequence> + <element ref="ds:SignedInfo"/> + <element ref="ds:SignatureValue"/> + <element ref="ds:KeyInfo" minOccurs="0"/> + <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="SignatureValue" type="ds:SignatureValueType"/> + <complexType name="SignatureValueType"> + <simpleContent> + <extension base="base64Binary"> + <attribute name="Id" type="ID" use="optional"/> + </extension> + </simpleContent> + </complexType> + +<!-- Start SignedInfo --> + +<element name="SignedInfo" type="ds:SignedInfoType"/> +<complexType name="SignedInfoType"> + <sequence> + <element ref="ds:CanonicalizationMethod"/> + <element ref="ds:SignatureMethod"/> + <element ref="ds:Reference" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/> + <complexType name="CanonicalizationMethodType" mixed="true"> + <sequence> + <any namespace="##any" minOccurs="0" maxOccurs="unbounded"/> + <!-- (0,unbounded) elements from (1,1) namespace --> + </sequence> + <attribute name="Algorithm" type="anyURI" use="required"/> + </complexType> + + <element name="SignatureMethod" type="ds:SignatureMethodType"/> + <complexType name="SignatureMethodType" mixed="true"> + <sequence> + <element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/> + <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/> + <!-- (0,unbounded) elements from (1,1) external namespace --> + </sequence> + <attribute name="Algorithm" type="anyURI" use="required"/> + </complexType> + +<!-- Start Reference --> + +<element name="Reference" type="ds:ReferenceType"/> +<complexType name="ReferenceType"> + <sequence> + <element ref="ds:Transforms" minOccurs="0"/> + <element ref="ds:DigestMethod"/> + <element ref="ds:DigestValue"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> + <attribute name="URI" type="anyURI" use="optional"/> + <attribute name="Type" type="anyURI" use="optional"/> +</complexType> + + <element name="Transforms" type="ds:TransformsType"/> + <complexType name="TransformsType"> + <sequence> + <element ref="ds:Transform" maxOccurs="unbounded"/> + </sequence> + </complexType> + + <element name="Transform" type="ds:TransformType"/> + <complexType name="TransformType" mixed="true"> + <choice minOccurs="0" maxOccurs="unbounded"> + <any namespace="##other" processContents="lax"/> + <!-- (1,1) elements from (0,unbounded) namespaces --> + <element name="XPath" type="string"/> + </choice> + <attribute name="Algorithm" type="anyURI" use="required"/> + </complexType> + +<!-- End Reference --> + +<element name="DigestMethod" type="ds:DigestMethodType"/> +<complexType name="DigestMethodType" mixed="true"> + <sequence> + <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <attribute name="Algorithm" type="anyURI" use="required"/> +</complexType> + +<element name="DigestValue" type="ds:DigestValueType"/> +<simpleType name="DigestValueType"> + <restriction base="base64Binary"/> +</simpleType> + +<!-- End SignedInfo --> + +<!-- Start KeyInfo --> + +<element name="KeyInfo" type="ds:KeyInfoType"/> +<complexType name="KeyInfoType" mixed="true"> + <choice maxOccurs="unbounded"> + <element ref="ds:KeyName"/> + <element ref="ds:KeyValue"/> + <element ref="ds:RetrievalMethod"/> + <element ref="ds:X509Data"/> + <element ref="ds:PGPData"/> + <element ref="ds:SPKIData"/> + <element ref="ds:MgmtData"/> + <any processContents="lax" namespace="##other"/> + <!-- (1,1) elements from (0,unbounded) namespaces --> + </choice> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="KeyName" type="string"/> + <element name="MgmtData" type="string"/> + + <element name="KeyValue" type="ds:KeyValueType"/> + <complexType name="KeyValueType" mixed="true"> + <choice> + <element ref="ds:DSAKeyValue"/> + <element ref="ds:RSAKeyValue"/> + <any namespace="##other" processContents="lax"/> + </choice> + </complexType> + + <element name="RetrievalMethod" type="ds:RetrievalMethodType"/> + <complexType name="RetrievalMethodType"> + <sequence> + <element ref="ds:Transforms" minOccurs="0"/> + </sequence> + <attribute name="URI" type="anyURI"/> + <attribute name="Type" type="anyURI" use="optional"/> + </complexType> + +<!-- Start X509Data --> + +<element name="X509Data" type="ds:X509DataType"/> +<complexType name="X509DataType"> + <sequence maxOccurs="unbounded"> + <choice> + <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/> + <element name="X509SKI" type="base64Binary"/> + <element name="X509SubjectName" type="string"/> + <element name="X509Certificate" type="base64Binary"/> + <element name="X509CRL" type="base64Binary"/> + <any namespace="##other" processContents="lax"/> + </choice> + </sequence> +</complexType> + +<complexType name="X509IssuerSerialType"> + <sequence> + <element name="X509IssuerName" type="string"/> + <element name="X509SerialNumber" type="integer"/> + </sequence> +</complexType> + +<!-- End X509Data --> + +<!-- Begin PGPData --> + +<element name="PGPData" type="ds:PGPDataType"/> +<complexType name="PGPDataType"> + <choice> + <sequence> + <element name="PGPKeyID" type="base64Binary"/> + <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/> + <any namespace="##other" processContents="lax" minOccurs="0" + maxOccurs="unbounded"/> + </sequence> + <sequence> + <element name="PGPKeyPacket" type="base64Binary"/> + <any namespace="##other" processContents="lax" minOccurs="0" + maxOccurs="unbounded"/> + </sequence> + </choice> +</complexType> + +<!-- End PGPData --> + +<!-- Begin SPKIData --> + +<element name="SPKIData" type="ds:SPKIDataType"/> +<complexType name="SPKIDataType"> + <sequence maxOccurs="unbounded"> + <element name="SPKISexp" type="base64Binary"/> + <any namespace="##other" processContents="lax" minOccurs="0"/> + </sequence> +</complexType> + +<!-- End SPKIData --> + +<!-- End KeyInfo --> + +<!-- Start Object (Manifest, SignatureProperty) --> + +<element name="Object" type="ds:ObjectType"/> +<complexType name="ObjectType" mixed="true"> + <sequence minOccurs="0" maxOccurs="unbounded"> + <any namespace="##any" processContents="lax"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> + <attribute name="MimeType" type="string" use="optional"/> <!-- add a grep facet --> + <attribute name="Encoding" type="anyURI" use="optional"/> +</complexType> + +<element name="Manifest" type="ds:ManifestType"/> +<complexType name="ManifestType"> + <sequence> + <element ref="ds:Reference" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + +<element name="SignatureProperties" type="ds:SignaturePropertiesType"/> +<complexType name="SignaturePropertiesType"> + <sequence> + <element ref="ds:SignatureProperty" maxOccurs="unbounded"/> + </sequence> + <attribute name="Id" type="ID" use="optional"/> +</complexType> + + <element name="SignatureProperty" type="ds:SignaturePropertyType"/> + <complexType name="SignaturePropertyType" mixed="true"> + <choice maxOccurs="unbounded"> + <any namespace="##other" processContents="lax"/> + <!-- (1,1) elements from (1,unbounded) namespaces --> + </choice> + <attribute name="Target" type="anyURI" use="required"/> + <attribute name="Id" type="ID" use="optional"/> + </complexType> + +<!-- End Object (Manifest, SignatureProperty) --> + +<!-- Start Algorithm Parameters --> + +<simpleType name="HMACOutputLengthType"> + <restriction base="integer"/> +</simpleType> + +<!-- Start KeyValue Element-types --> + +<element name="DSAKeyValue" type="ds:DSAKeyValueType"/> +<complexType name="DSAKeyValueType"> + <sequence> + <sequence minOccurs="0"> + <element name="P" type="ds:CryptoBinary"/> + <element name="Q" type="ds:CryptoBinary"/> + </sequence> + <element name="G" type="ds:CryptoBinary" minOccurs="0"/> + <element name="Y" type="ds:CryptoBinary"/> + <element name="J" type="ds:CryptoBinary" minOccurs="0"/> + <sequence minOccurs="0"> + <element name="Seed" type="ds:CryptoBinary"/> + <element name="PgenCounter" type="ds:CryptoBinary"/> + </sequence> + </sequence> +</complexType> + +<element name="RSAKeyValue" type="ds:RSAKeyValueType"/> +<complexType name="RSAKeyValueType"> + <sequence> + <element name="Modulus" type="ds:CryptoBinary"/> + <element name="Exponent" type="ds:CryptoBinary"/> + </sequence> +</complexType> + +<!-- End KeyValue Element-types --> + +<!-- End Signature --> + +</schema> diff --git a/templates/_footer.twig b/templates/_footer.twig index 8b9e730222779f9a58f446997dee3a891c5e8283..432e1daef212cf028e84b84318bf77fe0a9f4dc5 100644 --- a/templates/_footer.twig +++ b/templates/_footer.twig @@ -2,8 +2,7 @@ <div class="wrap"> <div class="center copyrights dark-bg"> <br>Copyright © 2007-2018 - <br> - <i class="fa fa-github" aria-hidden="true"></i> <a href="https://github.com/simplesamlphp/simplesamlphp">SimpleSAMLphp</a> + <a href="https://simplesamlphp.org/">SimpleSAMLphp</a> </div> <div class="logo-footer-right"> <div class="logo-footer"> diff --git a/templates/_table.twig b/templates/_table.twig index 5d8d4aff6fc954ecbfe1d78978f958a739c55095..6af434995d808f3d2ca72ff0f279d6a94b91fcd5 100644 --- a/templates/_table.twig +++ b/templates/_table.twig @@ -1,5 +1,5 @@ -<table id="table_with_attributes" class="attributes pure-table pure-table-striped pure-table-attributes" summary="attribute overview"> +<table id="table_with_attributes" class="attributes pure-table pure-table-striped pure-table-attributes" summary="attribute overview"> {% for name, values in items %} <tr class="{{ cycle(['odd', 'even'], loop.index0) }}"> @@ -21,4 +21,4 @@ </td> </tr> {% endfor %} -</table><br> \ No newline at end of file +</table><br> diff --git a/templates/base.twig b/templates/base.twig index 02fdc60d3ee36f425bbf099c470092c9f282a638..e366f37522b22418abf8947615ba2f587e22dfa3 100644 --- a/templates/base.twig +++ b/templates/base.twig @@ -12,7 +12,7 @@ {% if jquery and jquery.css %} <link rel="stylesheet" media="screen" type="text/css" href="/{{ baseurlpath }}resources/uitheme1.8/jquery-ui.css" /> {% endif %} - {% if isRTL %}<link rel="stylesheet" type="text/css" href="/{{ baseurlpath }}assets/css/src/default-rtl.css" />{% endif %} + {%- if isRTL %}<link rel="stylesheet" type="text/css" href="/{{ baseurlpath }}assets/css/src/default-rtl.css" />{% endif -%} <meta name="robots" content="noindex, nofollow"> {% block preload %}{% endblock %} </head> diff --git a/templates/error.twig b/templates/error.twig index 0f42558804cc0988b999d9214322ea849dae8fad..311aa2925e979d05b9c89068b038a40019b9d79f 100644 --- a/templates/error.twig +++ b/templates/error.twig @@ -41,7 +41,6 @@ <p>{{ '{errors:report_text}' | trans }}</p> <label for="email">{{ '{errors:report_email}' | trans }}</label> <input type="email" name="email" id="email" class="edge" value="{{ email }}" /> - </p> <textarea class="text-area edge" name="text" rows="6" cols="50" placeholder="{{ '{errors:report_explain}' | trans }}" required></textarea> <p class="center"> diff --git a/templates/includes/attributes.php b/templates/includes/attributes.php index 3d80a035a50ac0e432ef1712ea6f05521e9d5d23..78b862f48aa582c928b4079b55661307950c28ab 100644 --- a/templates/includes/attributes.php +++ b/templates/includes/attributes.php @@ -33,27 +33,27 @@ function present_assoc($attr) function present_eptid(\SimpleSAML\Locale\Translate $t, \SAML2\XML\saml\NameID $nameID) { - $eptid = array( - 'NameID' => array($nameID->value), - ); + $eptid = [ + 'NameID' => [$nameID->value], + ]; if (!empty($nameID->Format)) { - $eptid[$t->t('{status:subject_format}')] = array($nameID->Format); + $eptid[$t->t('{status:subject_format}')] = [$nameID->Format]; } if (!empty($nameID->NameQualifier)) { - $eptid['NameQualifier'] = array($nameID->NameQualifier); + $eptid['NameQualifier'] = [$nameID->NameQualifier]; } if (!empty($nameID->SPNameQualifier)) { - $eptid['SPNameQualifier'] = array($nameID->SPNameQualifier); + $eptid['SPNameQualifier'] = [$nameID->SPNameQualifier]; } if (!empty($nameID->SPProvidedID)) { - $eptid['SPProvidedID'] = array($nameID->SPProvidedID); + $eptid['SPProvidedID'] = [$nameID->SPProvidedID]; } return '<td class="attrvalue">'.present_assoc($eptid); } function present_attributes(\SimpleSAML\XHTML\Template $t, $attributes, $nameParent) { - $alternate = array('odd', 'even'); + $alternate = ['odd', 'even']; $i = 0; $parentStr = (strlen($nameParent) > 0) ? strtolower($nameParent).'_' : ''; @@ -78,7 +78,7 @@ function present_attributes(\SimpleSAML\XHTML\Template $t, $attributes, $namePar if ($nameraw !== $name) { $str .= htmlspecialchars($name).'<br/>'; } - $str .= '<tt>'.htmlspecialchars($nameraw).'</tt>'; + $str .= '<code>'.htmlspecialchars($nameraw).'</code>'; $str .= '</td><td class="attrvalue"><ul>'; foreach ($value as $listitem) { if ($nameraw === 'jpegPhoto') { @@ -93,7 +93,7 @@ function present_attributes(\SimpleSAML\XHTML\Template $t, $attributes, $namePar if ($nameraw !== $name) { $str .= htmlspecialchars($name).'<br/>'; } - $str .= '<tt>'.htmlspecialchars($nameraw).'</tt>'; + $str .= '<code>'.htmlspecialchars($nameraw).'</code>'; $str .= '</td>'; if ($nameraw === 'jpegPhoto') { $str .= '<td class="attrvalue"><img src="data:image/jpeg;base64,'.htmlspecialchars($value[0]). diff --git a/templates/includes/header.php b/templates/includes/header.php index d79b006e1b5c76aae12633d2e5bcef35d81e8faf..82c894fb9246bfd994e7f177a9499993eeccd1fd 100644 --- a/templates/includes/header.php +++ b/templates/includes/header.php @@ -1,7 +1,5 @@ <?php - - /** * Support the htmlinject hook, which allows modules to change header, pre and post body on all pages. */ @@ -11,7 +9,6 @@ $this->data['htmlinject'] = [ 'htmlContentHead' => [], ]; - $jquery = []; if (array_key_exists('jquery', $this->data)) { $jquery = $this->data['jquery']; @@ -68,23 +65,22 @@ if (!empty($jquery)) { if ($version == '1.8') { if (isset($jquery['core']) && $jquery['core']) { - echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-1.8.js"></script>' . "\n"); + echo '<script type="text/javascript" src="/'.$this->data['baseurlpath'].'resources/jquery-1.8.js"></script>'."\n"; } if (isset($jquery['ui']) && $jquery['ui']) { - echo('<script type="text/javascript" src="/' . $this->data['baseurlpath'] . 'resources/jquery-ui-1.8.js"></script>' . "\n"); + echo '<script type="text/javascript" src="/'.$this->data['baseurlpath'].'resources/jquery-ui-1.8.js"></script>'."\n"; } if (isset($jquery['css']) && $jquery['css']) { - echo('<link rel="stylesheet" media="screen" type="text/css" href="/' . $this->data['baseurlpath'] . - 'resources/uitheme1.8/jquery-ui.css" />' . "\n"); + echo '<link rel="stylesheet" media="screen" type="text/css" href="/'.$this->data['baseurlpath']. + 'resources/uitheme1.8/jquery-ui.css" />'."\n"; } } } if (isset($this->data['clipboard.js'])) { - echo '<script type="text/javascript" src="/' . $this->data['baseurlpath'] . - 'resources/clipboard.min.js"></script>' . "\n"; + echo '<script type="text/javascript" src="/'.$this->data['baseurlpath'].'resources/clipboard.min.js"></script>'."\n"; } if (!empty($this->data['htmlinject']['htmlContentHead'])) { @@ -93,37 +89,24 @@ if (!empty($this->data['htmlinject']['htmlContentHead'])) { } } - - - if ($this->isLanguageRTL()) { ?> <link rel="stylesheet" type="text/css" href="/<?php echo $this->data['baseurlpath']; ?>resources/default-rtl.css" /> <?php } ?> - - <meta name="robots" content="noindex, nofollow" /> - <?php if (array_key_exists('head', $this->data)) { - echo '<!-- head -->' . $this->data['head'] . '<!-- /head -->'; + echo '<!-- head -->'.$this->data['head'].'<!-- /head -->'; } ?> </head> <?php $onLoad = ''; if (array_key_exists('autofocus', $this->data)) { - $onLoad .= 'SimpleSAML_focus(\'' . $this->data['autofocus'] . '\');'; -} -if (isset($this->data['onLoad'])) { - $onLoad .= $this->data['onLoad']; -} - -if ($onLoad !== '') { - $onLoad = ' onload="' . $onLoad . '"'; + $onLoad .= ' onload="SimpleSAML_focus(\''.$this->data['autofocus'].'\');"'; } ?> <body<?php echo $onLoad; ?>> @@ -198,13 +181,12 @@ if ($onLoad !== '') { if ($current) { $textarray[] = $langnames[$lang]; } else { - $textarray[] = '<a href="' . htmlspecialchars( + $textarray[] = '<a href="'.htmlspecialchars( \SimpleSAML\Utils\HTTP::addURLParameters( \SimpleSAML\Utils\HTTP::getSelfURL(), [$this->getTranslator()->getLanguage()->getLanguageParameterName() => $lang] ) - ) . '">' . - $langnames[$lang] . '</a>'; + ).'">'.$langnames[$lang].'</a>'; } } echo join(' | ', $textarray); @@ -212,13 +194,9 @@ if ($onLoad !== '') { } } - - ?> <div id="content"> - - <?php if (!empty($this->data['htmlinject']['htmlContentPre'])) { diff --git a/templates/index.twig b/templates/index.twig index 6f6f0518063bf61bd837f9295fcf36af0761f21d..e80a9ad701acc62fb8dffc2c41a2e57e55119419 100644 --- a/templates/index.twig +++ b/templates/index.twig @@ -6,16 +6,17 @@ <li class="ui-state-default ui-corner-top"><a href="/{{ baseurlpath }}module.php/core/frontpage_auth.php">Authentication</a></li> <li class="ui-state-default ui-corner-top"><a href="/{{ baseurlpath }}module.php/core/frontpage_federation.php">Federation</a></li> </ul> + <a class='float-r' href='{{ logouturl }}'>{{ '{core:frontpage:logout}'|trans }}</a> <div id="portalcontent" class="ui-tabs-panel ui-widget-content ui-corner-bottom"> <div style="clear: both" class="enablebox mini"> <table> <tr class="disabled"><td>SAML 2.0 IdP</td> - <td><img src="/{{ baseurlpath }}resources/icons/silk/delete.png" alt="disabled" /></td></tr> + <td><i class="fa fa-ban"></i></td></tr> <tr class="disabled"><td>Shib 1.3 IdP</td> - <td><img src="/{{ baseurlpath }}resources/icons/silk/delete.png" alt="disabled" /></td></tr> + <td><i class="fa fa-ban"></i></td></tr> </table> </div> diff --git a/templates/metadata.php b/templates/metadata.php index cda59b566a26134fded2a6f2e3ac9103a84a628f..c851afea27b49696fd6fecfd714ffddab3720402 100644 --- a/templates/metadata.php +++ b/templates/metadata.php @@ -4,7 +4,7 @@ $this->includeAtTemplateBase('includes/header.php'); ?> <h2><?php echo $this->data['header']; ?></h2> <p><?php echo $this->t('metadata_intro'); ?></p> <?php if (isset($this->data['metaurl'])) { ?> - <p><?php echo($this->t('metadata_xmlurl', array('%METAURL%' => htmlspecialchars($this->data['metaurl'])))); ?></p> + <p><?php echo($this->t('metadata_xmlurl', ['%METAURL%' => htmlspecialchars($this->data['metaurl'])])); ?></p> <div class="input-group"> <pre id="metadataurl" class="input-left"><?php echo htmlspecialchars($this->data['metaurl']); ?></pre> <button data-clipboard-target="#metadataurl" id="btnurl" class="btnaddonright"> diff --git a/templates/post.php b/templates/post.php index 8995523ddc7f09a706dfe9f79389ed57128a0363..643f08e7789a17da50b5bc5bb0498227647e59d6 100644 --- a/templates/post.php +++ b/templates/post.php @@ -31,10 +31,10 @@ if (array_key_exists('post', $this->data)) { assert(array_key_exists('response', $this->data)); assert(array_key_exists('RelayStateName', $this->data)); assert(array_key_exists('RelayState', $this->data)); - $post = array( + $post = [ 'SAMLResponse' => $this->data['response'], $this->data['RelayStateName'] => $this->data['RelayState'], - ); + ]; } /** diff --git a/templates/selectidp-dropdown.twig b/templates/selectidp-dropdown.twig new file mode 100644 index 0000000000000000000000000000000000000000..48f042d0ca057d1dd85a0ad585ca187182893124 --- /dev/null +++ b/templates/selectidp-dropdown.twig @@ -0,0 +1,27 @@ +{% set pagetitle = "Select your identity provider"|trans %} +{% extends "base.twig" %} + +{% block content %} + <h2>{{ pagetitle }}</h2> + + <p>{{ "Please select the identity provider where you want to authenticate:" | trans }}</p> + <form method="get" action="{{ urlpattern }}"> + <input type="hidden" name="entityID" value="{{ entityID }}"> + <input type="hidden" name="return" value="{{ return }}"> + <input type="hidden" name="returnIDParam" value="{{ returnIDParam }}"> + <select id="dropdownlist" name="idpentityid" autofocus> + {% for idpentry in idplist %} + <option value="{{ idpentry.entityid }}" + {% if idpentry.entityid == preferredidp %} + selected + {% endif %} + >{{ idpentry.name }}</option> + {% endfor %} + </select> + <button class="btn" type="submit">{{ 'Select' | trans }}</button> + {% if rememberenabled %} + <br/><input type="checkbox" name="remember" id="remember" value="1"> + <label for="remember">{{ 'Remember my choice' | trans }}</label> + {% endif %} + </form> +{% endblock %} diff --git a/templates/selectidp-links.twig b/templates/selectidp-links.twig new file mode 100644 index 0000000000000000000000000000000000000000..a7bf1103fdfe0b210988767bc99f69736edf4c26 --- /dev/null +++ b/templates/selectidp-links.twig @@ -0,0 +1,45 @@ +{% set pagetitle = "Select your identity provider"|trans %} +{% extends "base.twig" %} + +{% block content %} + <h2>{{ pagetitle }}</h2> + + <p>{{ "Please select the identity provider where you want to authenticate:" | trans }}</p> + <form method="get" action="{{ urlpattern }}"> + <input type="hidden" name="entityID" value="{{ entityID }}"> + <input type="hidden" name="return" value="{{ return }}"> + <input type="hidden" name="returnIDParam" value="{{ returnIDParam }}"> + {% if rememberenabled %} + <p><input type="checkbox" name="remember" id="remember" value="1"> + <label for="remember">{{ 'Remember my choice' | trans }}</label></p> + {% endif %} + + {% for idpentry in idplist %} + {% if idpentry.entityid == preferredidp %} + <div class="preferredidp"> + {% if idpentry.iconurl %} + <img class="float-l" src="{{ idpentry.iconurl }}"> + {% endif %} + <h3><i class="fa fa-star"></i> {{ idpentry.name }}</h3> + {% if idpentry.description %} + <p>{{ idpentry.description }}</p> + {% endif %} + <button type="submit" class="btn" name="idp_{{ idpentry.entityid }}">{{'Select'|trans}}</button> + </div> + {% endif %} + {% endfor %} + + {% for idpentry in idplist %} + {% if idpentry.entityid != preferredidp %} + {% if idpentry.iconurl %} + <img class="float-l" src="{{ idpentry.iconurl }}"> + {% endif %} + <h3>{{ idpentry.name }}</h3> + {% if idpentry.description %} + <p>{{ idpentry.description }}</p> + {% endif %} + <button type="submit" class="btn" name="idp_{{ idpentry.entityid }}">{{'Select'|trans}}</button> + {% endif %} + {% endfor %} + </form> +{% endblock %} diff --git a/templates/status.php b/templates/status.php index 7732cbc907a51c8597abd1582f65b60e7cf02566..6ddc5191123c188d1f7c33b8cbbd4e1d37bde1af 100644 --- a/templates/status.php +++ b/templates/status.php @@ -18,11 +18,11 @@ $this->includeAtTemplateBase('includes/attributes.php'); <?php if (isset($this->data['remaining'])) { - echo '<p>'.$this->t('{status:validfor}', array('%SECONDS%' => $this->data['remaining'])).'</p>'; + echo '<p>'.$this->t('{status:validfor}', ['%SECONDS%' => $this->data['remaining']]).'</p>'; } if (isset($this->data['sessionsize'])) { - echo '<p>'.$this->t('{status:sessionsize}', array('%SIZE%' => $this->data['sessionsize'])).'</p>'; + echo '<p>'.$this->t('{status:sessionsize}', ['%SIZE%' => $this->data['sessionsize']]).'</p>'; } ?> <h2><?php echo $this->t('{status:attributes_header}'); ?></h2> @@ -35,23 +35,23 @@ if ($nameid !== false) { /** @var \SAML2\XML\saml\NameID $nameid */ echo "<h2>".$this->t('{status:subject_header}')."</h2>"; if (is_null($nameid->value)) { - $list = array("NameID" => array($this->t('{status:subject_notset}'))); + $list = ["NameID" => [$this->t('{status:subject_notset}')]]; echo "<p>NameID: <span class=\"notset\">".$this->t('{status:subject_notset}')."</span></p>"; } else { - $list = array( - "NameId" => array($nameid->value), - ); + $list = [ + "NameId" => [$nameid->value], + ]; if (!is_null($nameid->Format)) { - $list[$this->t('{status:subject_format}')] = array($nameid->Format); + $list[$this->t('{status:subject_format}')] = [$nameid->Format]; } if (!is_null($nameid->NameQualifier)) { - $list['NameQualifier'] = array($nameid->NameQualifier); + $list['NameQualifier'] = [$nameid->NameQualifier]; } if (!is_null($nameid->SPNameQualifier)) { - $list['SPNameQualifier'] = array($nameid->SPNameQualifier); + $list['SPNameQualifier'] = [$nameid->SPNameQualifier]; } if (!is_null($nameid->SPProvidedID)) { - $list['SPProvidedID'] = array($nameid->SPProvidedID); + $list['SPProvidedID'] = [$nameid->SPProvidedID]; } } echo present_attributes($this, $list, ''); diff --git a/tests/BuiltInServer.php b/tests/BuiltInServer.php index 4f614f5116ec1774e9da58ff03564cf049c07f86..e98a4a61c43341ebdd426d964d1596f8ffda7408 100644 --- a/tests/BuiltInServer.php +++ b/tests/BuiltInServer.php @@ -89,7 +89,7 @@ class BuiltInServer ); // execute the command and store the process ID - $output = array(); + $output = []; exec($command, $output); $this->pid = (int) $output[0]; @@ -170,32 +170,32 @@ class BuiltInServer * * @return array|string The response obtained from the built-in server. */ - public function get($query, $parameters, $curlopts = array()) + public function get($query, $parameters, $curlopts = []) { $ch = curl_init(); $url = 'http://'.$this->address.$query; $url .= (!empty($parameters)) ? '?'.http_build_query($parameters) : ''; - curl_setopt_array($ch, array( + curl_setopt_array($ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 1, - )); + ]); curl_setopt_array($ch, $curlopts); $resp = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); list($header, $body) = explode("\r\n\r\n", $resp, 2); $raw_headers = explode("\r\n", $header); array_shift($raw_headers); - $headers = array(); + $headers = []; foreach ($raw_headers as $header) { list($name, $value) = explode(':', $header, 2); $headers[trim($name)] = trim($value); } curl_close($ch); - return array( + return [ 'code' => $code, 'headers' => $headers, 'body' => $body, - ); + ]; } } diff --git a/tests/Utils/ReduceSpillOverTest.php b/tests/Utils/ReduceSpillOverTest.php index 2f474576dd040e59e543cbfd05b1b8798221a12a..82f82da397dd832ccd2d30b05502851c3592fbbf 100644 --- a/tests/Utils/ReduceSpillOverTest.php +++ b/tests/Utils/ReduceSpillOverTest.php @@ -15,7 +15,7 @@ class ReduceSpillOverTest extends ClearStateTestCase public function testSetState() { $_SERVER['QUERY_STRING'] = 'a=b'; - \SimpleSAML\Configuration::loadFromArray(array('a' => 'b'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['a' => 'b'], '[ARRAY]', 'simplesaml'); $this->assertEquals('b', \SimpleSAML\Configuration::getInstance()->getString('a')); putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); } diff --git a/tests/Utils/StateClearer.php b/tests/Utils/StateClearer.php index db32db8e780bed71d522243d26ce4bfef8e9fcfd..ee2b686bf58af1f5a002e324efcc402833c64443 100644 --- a/tests/Utils/StateClearer.php +++ b/tests/Utils/StateClearer.php @@ -12,19 +12,19 @@ class StateClearer * Global state to restore between test runs * @var array */ - private $backups = array(); + private $backups = []; /** * Class that implement \SimpleSAML\Utils\ClearableState and should have clearInternalState called between tests * @var array */ - private $clearableState = array('SimpleSAML\Configuration'); + private $clearableState = ['SimpleSAML\Configuration']; /** * Environmental variables to unset * @var array */ - private $vars_to_unset = array('SIMPLESAMLPHP_CONFIG_DIR'); + private $vars_to_unset = ['SIMPLESAMLPHP_CONFIG_DIR']; public function backupGlobals() { @@ -36,7 +36,7 @@ class StateClearer $this->backups['$_GET'] = $_GET; $this->backups['$_POST'] = $_POST; $this->backups['$_SERVER'] = $_SERVER; - $this->backups['$_SESSION'] = isset($_SESSION) ? $_SESSION : array(); + $this->backups['$_SESSION'] = isset($_SESSION) ? $_SESSION : []; $this->backups['$_REQUEST'] = $_REQUEST; } diff --git a/tests/lib/SimpleSAML/Auth/SimpleTest.php b/tests/lib/SimpleSAML/Auth/SimpleTest.php index e0543b44be4d4ee8dae270ab564815e2d0f96ce5..7d667ab46269eb822fce4cb56e1bb8969030912a 100644 --- a/tests/lib/SimpleSAML/Auth/SimpleTest.php +++ b/tests/lib/SimpleSAML/Auth/SimpleTest.php @@ -21,68 +21,68 @@ class SimpleTest extends \SimpleSAML\Test\Utils\ClearStateTestCase $_SERVER['REQUEST_URI'] = '/'; // test merging configuration option with passed URL - \SimpleSAML\Configuration::loadFromArray(array( - 'application' => array( + \SimpleSAML\Configuration::loadFromArray([ + 'application' => [ 'baseURL' => 'https://example.org' - ) - ), '[ARRAY]', 'simplesaml'); + ] + ], '[ARRAY]', 'simplesaml'); $s = new \SimpleSAML\Auth\Simple(''); - $this->assertEquals('https://example.org/', $method->invokeArgs($s, array(null))); + $this->assertEquals('https://example.org/', $method->invokeArgs($s, [null])); // test a full URL passed as parameter $this->assertEquals( 'https://example.org/foo/bar?a=b#fragment', $method->invokeArgs( $s, - array('http://some.overridden.host/foo/bar?a=b#fragment') + ['http://some.overridden.host/foo/bar?a=b#fragment'] ) ); // test a full, current URL with no parameters $_SERVER['REQUEST_URI'] = '/foo/bar?a=b#fragment'; - $this->assertEquals('https://example.org/foo/bar?a=b#fragment', $method->invokeArgs($s, array(null))); + $this->assertEquals('https://example.org/foo/bar?a=b#fragment', $method->invokeArgs($s, [null])); // test ports are overridden by configuration $_SERVER['SERVER_PORT'] = '1234'; - $this->assertEquals('https://example.org/foo/bar?a=b#fragment', $method->invokeArgs($s, array(null))); + $this->assertEquals('https://example.org/foo/bar?a=b#fragment', $method->invokeArgs($s, [null])); // test config option with ending with / and port - \SimpleSAML\Configuration::loadFromArray(array( - 'application' => array( + \SimpleSAML\Configuration::loadFromArray([ + 'application' => [ 'baseURL' => 'http://example.org:8080/' - ) - ), '[ARRAY]', 'simplesaml'); + ] + ], '[ARRAY]', 'simplesaml'); $s = new \SimpleSAML\Auth\Simple(''); - $this->assertEquals('http://example.org:8080/foo/bar?a=b#fragment', $method->invokeArgs($s, array(null))); + $this->assertEquals('http://example.org:8080/foo/bar?a=b#fragment', $method->invokeArgs($s, [null])); // test again with a relative URL as a parameter $this->assertEquals( 'http://example.org:8080/something?foo=bar#something', - $method->invokeArgs($s, array('/something?foo=bar#something')) + $method->invokeArgs($s, ['/something?foo=bar#something']) ); // now test with no configuration $_SERVER['SERVER_NAME'] = 'example.org'; - \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); $s = new \SimpleSAML\Auth\Simple(''); - $this->assertEquals('http://example.org:1234/foo/bar?a=b#fragment', $method->invokeArgs($s, array(null))); + $this->assertEquals('http://example.org:1234/foo/bar?a=b#fragment', $method->invokeArgs($s, [null])); // no configuration, https and port $_SERVER['HTTPS'] = 'on'; - $this->assertEquals('https://example.org:1234/foo/bar?a=b#fragment', $method->invokeArgs($s, array(null))); + $this->assertEquals('https://example.org:1234/foo/bar?a=b#fragment', $method->invokeArgs($s, [null])); // no configuration and a relative URL as a parameter $this->assertEquals( 'https://example.org:1234/something?foo=bar#something', - $method->invokeArgs($s, array('/something?foo=bar#something')) + $method->invokeArgs($s, ['/something?foo=bar#something']) ); // finally, no configuration and full URL as a parameter $this->assertEquals( 'https://example.org/one/two/three?foo=bar#fragment', - $method->invokeArgs($s, array('https://example.org/one/two/three?foo=bar#fragment')) + $method->invokeArgs($s, ['https://example.org/one/two/three?foo=bar#fragment']) ); } } diff --git a/tests/lib/SimpleSAML/Auth/StateTest.php b/tests/lib/SimpleSAML/Auth/StateTest.php index b9bc2b5c4bb62ee399d0319546e13deb0a11e7a2..210d7ddfc9e22354890a0cfdf8e41f4aae23e757 100644 --- a/tests/lib/SimpleSAML/Auth/StateTest.php +++ b/tests/lib/SimpleSAML/Auth/StateTest.php @@ -13,14 +13,14 @@ class Auth_StateTest extends TestCase public function testGetPersistentAuthData() { - $mandatory = array( - 'Attributes' => array(), + $mandatory = [ + 'Attributes' => [], 'Expire' => 1234, 'LogoutState' => 'logoutState', 'AuthInstant' => 123456, 'RememberMe' => true, 'saml:sp:NameID' => 'nameID', - ); + ]; // check just mandatory parameters $state = $mandatory; @@ -42,10 +42,10 @@ class Auth_StateTest extends TestCase ); // check additional non-persistent parameters - $additional = array( + $additional = [ 'additional1' => 1, 'additional2' => 2, - ); + ]; $state = array_merge($mandatory, $additional); $expected = $mandatory; $this->assertEquals( @@ -55,7 +55,7 @@ class Auth_StateTest extends TestCase ); // check additional persistent parameters - $additional['PersistentAuthData'] = array('additional1'); + $additional['PersistentAuthData'] = ['additional1']; $state = array_merge($mandatory, $additional); $expected = $state; unset($expected['additional2']); diff --git a/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php b/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php index 782de37be6874d98132ae57f9ee3322da84860e0..710d3c2d3d53ac382516caf0e1d5f765513e569e 100644 --- a/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php +++ b/tests/lib/SimpleSAML/Auth/TimeLimitedTokenTest.php @@ -11,7 +11,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testMalformedToken() { - \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['secretsalt' => 'random'], '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(); $this->assertFalse($token->validate('malformed')); @@ -25,7 +25,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testValidToken() { - \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['secretsalt' => 'random'], '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(); $t = $token->generate(); @@ -38,7 +38,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testValidTokenWithData() { - \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['secretsalt' => 'random'], '[ARRAY]', 'simplesaml'); $tokenWithData = new TimeLimitedToken(); $tokenWithData->addVerificationData('some more random data'); @@ -55,7 +55,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testExpiredToken() { - \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['secretsalt' => 'random'], '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(); $this->assertFalse($token->validate('7-c0803e76fff1df0ceb222dee80aa1d73f35d84dd')); @@ -67,7 +67,7 @@ class TimeLimitedTokenTest extends \SimpleSAML\Test\Utils\ClearStateTestCase */ public function testManipulatedToken() { - \SimpleSAML\Configuration::loadFromArray(array('secretsalt' => 'random'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['secretsalt' => 'random'], '[ARRAY]', 'simplesaml'); $token = new TimeLimitedToken(1); $t = $token->generate(); diff --git a/tests/lib/SimpleSAML/ConfigurationTest.php b/tests/lib/SimpleSAML/ConfigurationTest.php index ea421b952d4ce7803c18836c39c013616fda8177..9f7d4dcd385d742bf94fa10e98280a7d7f38bc22 100644 --- a/tests/lib/SimpleSAML/ConfigurationTest.php +++ b/tests/lib/SimpleSAML/ConfigurationTest.php @@ -22,7 +22,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase */ public function testLoadDefaultInstance() { - Configuration::loadFromArray(array('key' => 'value'), '', 'dummy'); + Configuration::loadFromArray(['key' => 'value'], '', 'dummy'); Configuration::getInstance(); } @@ -72,7 +72,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase */ public function testGetValueRequired() { - $c = Configuration::loadFromArray(array()); + $c = Configuration::loadFromArray([]); $c->getValue('missing', Configuration::REQUIRED_OPTION); } @@ -81,10 +81,10 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase */ public function testHasValue() { - $c = Configuration::loadFromArray(array( + $c = Configuration::loadFromArray([ 'exists_true' => true, 'exists_null' => null, - )); + ]); $this->assertEquals($c->hasValue('missing'), false); $this->assertEquals($c->hasValue('exists_true'), true); $this->assertEquals($c->hasValue('exists_null'), true); @@ -95,59 +95,18 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase */ public function testHasValueOneOf() { - $c = Configuration::loadFromArray(array( + $c = Configuration::loadFromArray([ 'exists_true' => true, 'exists_null' => null, - )); - $this->assertEquals($c->hasValueOneOf(array()), false); - $this->assertEquals($c->hasValueOneOf(array('missing')), false); - $this->assertEquals($c->hasValueOneOf(array('exists_true')), true); - $this->assertEquals($c->hasValueOneOf(array('exists_null')), true); - - $this->assertEquals($c->hasValueOneOf(array('missing1', 'missing2')), false); - $this->assertEquals($c->hasValueOneOf(array('exists_true', 'missing')), true); - $this->assertEquals($c->hasValueOneOf(array('missing', 'exists_true')), true); - } - - /** - * Test \SimpleSAML\Configuration::getBaseURL() - */ - public function testGetBaseURL() - { - // Need to set a default configuration because the SSP Logger attempts to use it. - Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); - $c = Configuration::loadFromArray(array()); - $this->assertEquals($c->getBaseURL(), 'simplesaml/'); - - $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml/')); - $this->assertEquals($c->getBaseURL(), 'simplesaml/'); - - $c = Configuration::loadFromArray(array('baseurlpath' => '/simplesaml/')); - $this->assertEquals($c->getBaseURL(), 'simplesaml/'); - - $c = Configuration::loadFromArray(array('baseurlpath' => 'path/to/simplesaml/')); - $this->assertEquals($c->getBaseURL(), 'path/to/simplesaml/'); - - $c = Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml/')); - $this->assertEquals($c->getBaseURL(), 'path/to/simplesaml/'); - - $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/ssp/')); - $this->assertEquals($c->getBaseURL(), 'ssp/'); - - $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/')); - $this->assertEquals($c->getBaseURL(), ''); - - $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/')); - $this->assertEquals($c->getBaseURL(), 'ssp/'); - - $c = Configuration::loadFromArray(array('baseurlpath' => '')); - $this->assertEquals($c->getBaseURL(), ''); - - $c = Configuration::loadFromArray(array('baseurlpath' => '/')); - $this->assertEquals($c->getBaseURL(), ''); + ]); + $this->assertEquals($c->hasValueOneOf([]), false); + $this->assertEquals($c->hasValueOneOf(['missing']), false); + $this->assertEquals($c->hasValueOneOf(['exists_true']), true); + $this->assertEquals($c->hasValueOneOf(['exists_null']), true); - $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml')); - $this->assertEquals($c->getBaseURL(), 'simplesaml/'); + $this->assertEquals($c->hasValueOneOf(['missing1', 'missing2']), false); + $this->assertEquals($c->hasValueOneOf(['exists_true', 'missing']), true); + $this->assertEquals($c->hasValueOneOf(['missing', 'exists_true']), true); } /** @@ -155,55 +114,55 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase */ public function testGetBasePath() { - $c = Configuration::loadFromArray(array()); + $c = Configuration::loadFromArray([]); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml/')); + $c = Configuration::loadFromArray(['baseurlpath' => 'simplesaml/']); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => '/simplesaml/')); + $c = Configuration::loadFromArray(['baseurlpath' => '/simplesaml/']); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'simplesaml')); + $c = Configuration::loadFromArray(['baseurlpath' => 'simplesaml']); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => '/simplesaml')); + $c = Configuration::loadFromArray(['baseurlpath' => '/simplesaml']); $this->assertEquals($c->getBasePath(), '/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'path/to/simplesaml/')); + $c = Configuration::loadFromArray(['baseurlpath' => 'path/to/simplesaml/']); $this->assertEquals($c->getBasePath(), '/path/to/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml/')); + $c = Configuration::loadFromArray(['baseurlpath' => '/path/to/simplesaml/']); $this->assertEquals($c->getBasePath(), '/path/to/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => '/path/to/simplesaml')); + $c = Configuration::loadFromArray(['baseurlpath' => '/path/to/simplesaml']); $this->assertEquals($c->getBasePath(), '/path/to/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/ssp/')); + $c = Configuration::loadFromArray(['baseurlpath' => 'https://example.org/ssp/']); $this->assertEquals($c->getBasePath(), '/ssp/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org/')); + $c = Configuration::loadFromArray(['baseurlpath' => 'https://example.org/']); $this->assertEquals($c->getBasePath(), '/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/')); + $c = Configuration::loadFromArray(['baseurlpath' => 'http://example.org/ssp/']); $this->assertEquals($c->getBasePath(), '/ssp/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/simplesaml')); + $c = Configuration::loadFromArray(['baseurlpath' => 'http://example.org/ssp/simplesaml']); $this->assertEquals($c->getBasePath(), '/ssp/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'http://example.org/ssp/simplesaml/')); + $c = Configuration::loadFromArray(['baseurlpath' => 'http://example.org/ssp/simplesaml/']); $this->assertEquals($c->getBasePath(), '/ssp/simplesaml/'); - $c = Configuration::loadFromArray(array('baseurlpath' => '')); + $c = Configuration::loadFromArray(['baseurlpath' => '']); $this->assertEquals($c->getBasePath(), '/'); - $c = Configuration::loadFromArray(array('baseurlpath' => '/')); + $c = Configuration::loadFromArray(['baseurlpath' => '/']); $this->assertEquals($c->getBasePath(), '/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org:8443')); + $c = Configuration::loadFromArray(['baseurlpath' => 'https://example.org:8443']); $this->assertEquals($c->getBasePath(), '/'); - $c = Configuration::loadFromArray(array('baseurlpath' => 'https://example.org:8443/')); + $c = Configuration::loadFromArray(['baseurlpath' => 'https://example.org:8443/']); $this->assertEquals($c->getBasePath(), '/'); } @@ -256,9 +215,9 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase ]); $this->assertEquals($c->getBaseDir(), '/basedir/'); - $c = Configuration::loadFromArray(array( + $c = Configuration::loadFromArray([ 'basedir' => '/basedir/', - )); + ]); $this->assertEquals($c->getBaseDir(), '/basedir/'); } @@ -406,11 +365,11 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase * Test \SimpleSAML\Configuration::getValueValidate() */ public function testGetValueValidate() { - $c = Configuration::loadFromArray(array( + $c = Configuration::loadFromArray([ 'opt' => 'b', - )); - $this->assertEquals($c->getValueValidate('missing_opt', array('a', 'b', 'c'), '--missing--'), '--missing--'); - $this->assertEquals($c->getValueValidate('opt', array('a', 'b', 'c')), 'b'); + ]); + $this->assertEquals($c->getValueValidate('missing_opt', ['a', 'b', 'c'], '--missing--'), '--missing--'); + $this->assertEquals($c->getValueValidate('opt', ['a', 'b', 'c']), 'b'); } /** @@ -422,7 +381,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase $c = Configuration::loadFromArray([ 'opt' => 'd', ]); - $c->getValueValidate('opt', array('a', 'b', 'c')); + $c->getValueValidate('opt', ['a', 'b', 'c']); } /** @@ -431,10 +390,10 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetArray() { $c = Configuration::loadFromArray([ - 'opt' => array('a', 'b', 'c'), + 'opt' => ['a', 'b', 'c'], ]); $this->assertEquals($c->getArray('missing_opt', '--missing--'), '--missing--'); - $this->assertEquals($c->getArray('opt'), array('a', 'b', 'c')); + $this->assertEquals($c->getArray('opt'), ['a', 'b', 'c']); } /** @@ -455,14 +414,14 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetArrayize() { $c = Configuration::loadFromArray([ - 'opt' => array('a', 'b', 'c'), + 'opt' => ['a', 'b', 'c'], 'opt_int' => 42, 'opt_str' => 'string', ]); $this->assertEquals($c->getArrayize('missing_opt', '--missing--'), '--missing--'); - $this->assertEquals($c->getArrayize('opt'), array('a', 'b', 'c')); - $this->assertEquals($c->getArrayize('opt_int'), array(42)); - $this->assertEquals($c->getArrayize('opt_str'), array('string')); + $this->assertEquals($c->getArrayize('opt'), ['a', 'b', 'c']); + $this->assertEquals($c->getArrayize('opt_int'), [42]); + $this->assertEquals($c->getArrayize('opt_str'), ['string']); } /** @@ -471,12 +430,12 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetArrayizeString() { $c = Configuration::loadFromArray([ - 'opt' => array('a', 'b', 'c'), + 'opt' => ['a', 'b', 'c'], 'opt_str' => 'string', ]); $this->assertEquals($c->getArrayizeString('missing_opt', '--missing--'), '--missing--'); - $this->assertEquals($c->getArrayizeString('opt'), array('a', 'b', 'c')); - $this->assertEquals($c->getArrayizeString('opt_str'), array('string')); + $this->assertEquals($c->getArrayizeString('opt'), ['a', 'b', 'c']); + $this->assertEquals($c->getArrayizeString('opt_str'), ['string']); } /** @@ -486,7 +445,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetArrayizeStringWrongValue() { $c = Configuration::loadFromArray([ - 'opt' => array('a', 'b', 42), + 'opt' => ['a', 'b', 42], ]); $c->getArrayizeString('opt'); } @@ -497,7 +456,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetConfigItem() { $c = Configuration::loadFromArray([ - 'opt' => array('a' => 42), + 'opt' => ['a' => 42], ]); $this->assertEquals($c->getConfigItem('missing_opt', '--missing--'), '--missing--'); $opt = $c->getConfigItem('opt'); @@ -523,15 +482,15 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetConfigList() { $c = Configuration::loadFromArray([ - 'opts' => array( - 'a' => array('opt1' => 'value1'), - 'b' => array('opt2' => 'value2'), - ), + 'opts' => [ + 'a' => ['opt1' => 'value1'], + 'b' => ['opt2' => 'value2'], + ], ]); $this->assertEquals($c->getConfigList('missing_opt', '--missing--'), '--missing--'); $opts = $c->getConfigList('opts'); $this->assertInternalType('array', $opts); - $this->assertEquals(array_keys($opts), array('a', 'b')); + $this->assertEquals(array_keys($opts), ['a', 'b']); $this->assertInstanceOf('SimpleSAML\Configuration', $opts['a']); $this->assertEquals($opts['a']->getValue('opt1'), 'value1'); $this->assertInstanceOf('SimpleSAML\Configuration', $opts['b']); @@ -558,10 +517,10 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetConfigListWrongArrayValues() { $c = Configuration::loadFromArray([ - 'opts' => array( + 'opts' => [ 'a', 'b', - ), + ], ]); $c->getConfigList('opts'); } @@ -576,7 +535,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase 'a' => true, 'b' => null, ]); - $this->assertEquals($c->getOptions(), array('a', 'b')); + $this->assertEquals($c->getOptions(), ['a', 'b']); } /** @@ -588,7 +547,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase 'a' => true, 'b' => null, ]); - $this->assertEquals($c->toArray(), array('a' => true, 'b' => null)); + $this->assertEquals($c->toArray(), ['a' => true, 'b' => null]); } @@ -604,132 +563,132 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase * basically AssertionConsumerService and ArtifactResolutionService. Since both are the same, we just run the * tests for AssertionConsumerService. */ - $acs_eps = array( + $acs_eps = [ // just a string with the location 'https://example.com/endpoint.php', // an array of strings with location of different endpoints - array( + [ 'https://www1.example.com/endpoint.php', 'https://www2.example.com/endpoint.php', - ), + ], // define location and binding - array( - array( + [ + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, - ), - ), + ], + ], // define the ResponseLocation too - array( - array( + [ + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, 'ResponseLocation' => 'https://example.com/endpoint.php', - ), - ), + ], + ], // make sure indexes are NOT taken into account (they just identify endpoints) - array( - array( + [ + [ 'index' => 1, 'Location' => 'https://www1.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, - ), - array( + ], + [ 'index' => 2, 'Location' => 'https://www2.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, - ), - ), + ], + ], // make sure isDefault has priority over indexes - array( - array( + [ + [ 'index' => 1, 'Location' => 'https://www2.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, - ), - array( + ], + [ 'index' => 2, 'isDefault' => true, 'Location' => 'https://www1.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, - ), - ), + ], + ], // make sure endpoints with invalid bindings are ignored and those marked as NOT default are still used - array( - array( + [ + [ 'index' => 1, 'Location' => 'https://www1.example.com/endpoint.php', 'Binding' => 'invalid_binding', - ), - array( + ], + [ 'index' => 2, 'isDefault' => false, 'Location' => 'https://www2.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, - ), - ), - ); - $acs_expected_eps = array( + ], + ], + ]; + $acs_expected_eps = [ // output should be completed with the default binding (HTTP-POST for ACS) - array( + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, - ), + ], // we should just get the first endpoint with the default binding - array( + [ 'Location' => 'https://www1.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, - ), + ], // if we specify the binding, we should get it back - array( + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST - ), + ], // if we specify ResponseLocation, we should get it back too - array( + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, 'ResponseLocation' => 'https://example.com/endpoint.php', - ), + ], // indexes must NOT be taken into account, order is the only thing that matters here - array( + [ 'Location' => 'https://www1.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, 'index' => 1, - ), + ], // isDefault must have higher priority than indexes - array( + [ 'Location' => 'https://www1.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, 'isDefault' => true, 'index' => 2, - ), + ], // the first valid enpoint should be used even if it's marked as NOT default - array( + [ 'index' => 2, 'isDefault' => false, 'Location' => 'https://www2.example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_POST, - ) - ); + ] + ]; - $a = array( + $a = [ 'metadata-set' => 'saml20-sp-remote', 'ArtifactResolutionService' => 'https://example.com/ars', 'SingleSignOnService' => 'https://example.com/sso', - 'SingleLogoutService' => array( + 'SingleLogoutService' => [ 'Location' => 'https://example.com/slo', 'Binding' => 'valid_binding', // test unknown bindings if we don't specify a list of valid ones - ), - ); + ], + ]; - $valid_bindings = array( + $valid_bindings = [ \SAML2\Constants::BINDING_HTTP_POST, \SAML2\Constants::BINDING_HTTP_REDIRECT, \SAML2\Constants::BINDING_HOK_SSO, \SAML2\Constants::BINDING_HTTP_ARTIFACT. \SAML2\Constants::BINDING_SOAP, - ); + ]; // run all general tests with AssertionConsumerService endpoint type foreach ($acs_eps as $i => $ep) { @@ -745,26 +704,26 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase $a['metadata-set'] = 'shib13-idp-remote'; $c = Configuration::loadFromArray($a); $this->assertEquals( - array( + [ 'Location' => 'https://example.com/sso', 'Binding' => 'urn:mace:shibboleth:1.0:profiles:AuthnRequest', - ), + ], $c->getDefaultEndpoint('SingleSignOnService') ); $a['metadata-set'] = 'saml20-idp-remote'; $c = Configuration::loadFromArray($a); $this->assertEquals( - array( + [ 'Location' => 'https://example.com/ars', 'Binding' => \SAML2\Constants::BINDING_SOAP, - ), + ], $c->getDefaultEndpoint('ArtifactResolutionService') ); $this->assertEquals( - array( + [ 'Location' => 'https://example.com/slo', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, - ), + ], $c->getDefaultEndpoint('SingleLogoutService') ); @@ -773,21 +732,21 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase $a['AssertionConsumerService'] = 'https://example.com/endpoint.php'; $c = Configuration::loadFromArray($a); $this->assertEquals( - array( + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post', - ), + ], $c->getDefaultEndpoint('AssertionConsumerService') ); // test for no valid endpoints specified - $a['SingleLogoutService'] = array( - array( + $a['SingleLogoutService'] = [ + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => 'invalid_binding', 'isDefault' => true, - ), - ); + ], + ]; $c = Configuration::loadFromArray($a); try { $c->getDefaultEndpoint('SingleLogoutService', $valid_bindings); @@ -815,81 +774,81 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetEndpoints() { // test response location for old-style configurations - $c = Configuration::loadFromArray(array( + $c = Configuration::loadFromArray([ 'metadata-set' => 'saml20-idp-remote', 'SingleSignOnService' => 'https://example.com/endpoint.php', 'SingleSignOnServiceResponse' => 'https://example.com/response.php', - )); - $e = array( - array( + ]); + $e = [ + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, 'ResponseLocation' => 'https://example.com/response.php', - ) - ); + ] + ]; $this->assertEquals($e, $c->getEndpoints('SingleSignOnService')); // test for input failures // define a basic configuration array - $a = array( + $a = [ 'metadata-set' => 'saml20-idp-remote', 'SingleSignOnService' => null, - ); + ]; // define a set of tests - $tests = array( + $tests = [ // invalid endpoint definition 10, // invalid definition of endpoint inside the endpoints array - array( + [ 1234 - ), + ], // missing location - array( - array( + [ + [ 'foo' => 'bar', - ), - ), + ], + ], // invalid location - array( - array( + [ + [ 'Location' => 1234, - ) - ), + ] + ], // missing binding - array( - array( + [ + [ 'Location' => 'https://example.com/endpoint.php', - ), - ), + ], + ], // invalid binding - array( - array( + [ + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => 1234, - ), - ), + ], + ], // invalid response location - array( - array( + [ + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, 'ResponseLocation' => 1234, - ), - ), + ], + ], // invalid index - array( - array( + [ + [ 'Location' => 'https://example.com/endpoint.php', 'Binding' => \SAML2\Constants::BINDING_HTTP_REDIRECT, 'index' => 'string', - ), - ), - ); + ], + ], + ]; // define a set of exception messages to expect - $msgs = array( + $msgs = [ 'Expected array or string.', 'Expected a string or an array.', 'Missing Location.', @@ -898,7 +857,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase 'Binding must be a string.', 'ResponseLocation must be a string.', 'index must be an integer.', - ); + ]; // now run all the tests expecting the correct exception message foreach ($tests as $i => $test) { @@ -920,14 +879,14 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase { $c = Configuration::loadFromArray([ 'str_opt' => 'Hello World!', - 'str_array' => array( + 'str_array' => [ 'en' => 'Hello World!', 'no' => 'Hei Verden!', - ), + ], ]); $this->assertEquals($c->getLocalizedString('missing_opt', '--missing--'), '--missing--'); - $this->assertEquals($c->getLocalizedString('str_opt'), array('en' => 'Hello World!')); - $this->assertEquals($c->getLocalizedString('str_array'), array('en' => 'Hello World!', 'no' => 'Hei Verden!')); + $this->assertEquals($c->getLocalizedString('str_opt'), ['en' => 'Hello World!']); + $this->assertEquals($c->getLocalizedString('str_array'), ['en' => 'Hello World!', 'no' => 'Hei Verden!']); } /** @@ -949,7 +908,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetLocalizedStringNotStringKey() { $c = Configuration::loadFromArray([ - 'opt' => array(42 => 'text'), + 'opt' => [42 => 'text'], ]); $c->getLocalizedString('opt'); } @@ -961,7 +920,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetLocalizedStringNotStringValue() { $c = Configuration::loadFromArray([ - 'opt' => array('en' => 42), + 'opt' => ['en' => 42], ]); $c->getLocalizedString('opt'); } @@ -996,9 +955,9 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase */ public function testLoadInstanceFromArray() { - $c = array( + $c = [ 'key' => 'value' - ); + ]; // test loading a custom instance Configuration::loadFromArray($c, '', 'dummy'); $this->assertEquals('value', Configuration::getInstance('dummy')->getValue('key', null)); diff --git a/tests/lib/SimpleSAML/DatabaseTest.php b/tests/lib/SimpleSAML/DatabaseTest.php index b99575b66c556c191c0e198e5d05831adf91c36f..82f292c4dfb1415d067facba93eb42f92d135527 100644 --- a/tests/lib/SimpleSAML/DatabaseTest.php +++ b/tests/lib/SimpleSAML/DatabaseTest.php @@ -50,14 +50,14 @@ class DatabaseTest extends TestCase */ public function setUp() { - $config = array( + $config = [ 'database.dsn' => 'sqlite::memory:', 'database.username' => null, 'database.password' => null, 'database.prefix' => 'phpunit_', 'database.persistent' => true, - 'database.slaves' => array(), - ); + 'database.slaves' => [], + ]; $this->config = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); @@ -82,17 +82,17 @@ class DatabaseTest extends TestCase */ public function connectionFailure() { - $config = array( + $config = [ 'database.dsn' => 'mysql:host=localhost;dbname=saml', 'database.username' => 'notauser', 'database.password' => 'notausersinvalidpassword', 'database.prefix' => 'phpunit_', 'database.persistent' => true, - 'database.slaves' => array(), - ); + 'database.slaves' => [], + ]; $this->config = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); - $db = SimpleSAML\Database::getInstance($this->config); + SimpleSAML\Database::getInstance($this->config); } @@ -105,22 +105,22 @@ class DatabaseTest extends TestCase */ public function instances() { - $config = array( + $config = [ 'database.dsn' => 'sqlite::memory:', 'database.username' => null, 'database.password' => null, 'database.prefix' => 'phpunit_', 'database.persistent' => true, - 'database.slaves' => array(), - ); - $config2 = array( + 'database.slaves' => [], + ]; + $config2 = [ 'database.dsn' => 'sqlite::memory:', 'database.username' => null, 'database.password' => null, 'database.prefix' => 'phpunit2_', 'database.persistent' => true, - 'database.slaves' => array(), - ); + 'database.slaves' => [], + ]; $config1 = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); $config2 = new \SimpleSAML\Configuration($config2, "test/SimpleSAML/DatabaseTest.php"); @@ -132,9 +132,9 @@ class DatabaseTest extends TestCase $generateInstanceId = self::getMethod('generateInstanceId'); - $instance1 = $generateInstanceId->invokeArgs($db1, array($config1)); - $instance2 = $generateInstanceId->invokeArgs($db2, array($config2)); - $instance3 = $generateInstanceId->invokeArgs($db3, array($config3)); + $instance1 = $generateInstanceId->invokeArgs($db1, [$config1]); + $instance2 = $generateInstanceId->invokeArgs($db2, [$config2]); + $instance3 = $generateInstanceId->invokeArgs($db3, [$config3]); // Assert that $instance1 and $instance2 have different instance ids $this->assertNotEquals( @@ -177,30 +177,30 @@ class DatabaseTest extends TestCase $getSlave = self::getMethod('getSlave'); $master = spl_object_hash(PHPUnit_Framework_Assert::readAttribute($this->db, 'dbMaster')); - $slave = spl_object_hash($getSlave->invokeArgs($this->db, array())); + $slave = spl_object_hash($getSlave->invokeArgs($this->db, [])); $this->assertTrue(($master == $slave), "getSlave should have returned the master database object"); - $config = array( + $config = [ 'database.dsn' => 'sqlite::memory:', 'database.username' => null, 'database.password' => null, 'database.prefix' => 'phpunit_', 'database.persistent' => true, - 'database.slaves' => array( - array( + 'database.slaves' => [ + [ 'dsn' => 'sqlite::memory:', 'username' => null, 'password' => null, - ), - ), - ); + ], + ], + ]; $sspConfiguration = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); $msdb = \SimpleSAML\Database::getInstance($sspConfiguration); $slaves = PHPUnit_Framework_Assert::readAttribute($msdb, 'dbSlaves'); - $gotSlave = spl_object_hash($getSlave->invokeArgs($msdb, array())); + $gotSlave = spl_object_hash($getSlave->invokeArgs($msdb, [])); $this->assertEquals( spl_object_hash($slaves[0]), @@ -248,11 +248,11 @@ class DatabaseTest extends TestCase $ssp_value = md5(rand(0, 10000)); $stmt = $this->db->write( "INSERT INTO $table (ssp_key, ssp_value) VALUES (:ssp_key, :ssp_value)", - array('ssp_key' => array($ssp_key, PDO::PARAM_INT), 'ssp_value' => $ssp_value) + ['ssp_key' => [$ssp_key, PDO::PARAM_INT], 'ssp_value' => $ssp_value] ); $this->assertEquals(1, $stmt, "Could not insert data into $table."); - $query2 = $this->db->read("SELECT * FROM $table WHERE ssp_key = :ssp_key", array('ssp_key' => $ssp_key)); + $query2 = $this->db->read("SELECT * FROM $table WHERE ssp_key = :ssp_key", ['ssp_key' => $ssp_key]); $data = $query2->fetch(); $this->assertEquals($data['ssp_value'], $ssp_value, "Inserted data doesn't match what is in the database"); } diff --git a/tests/lib/SimpleSAML/Locale/LanguageTest.php b/tests/lib/SimpleSAML/Locale/LanguageTest.php index 09c53d760375c51d9c1fbb134580062b405bf711..708d6b60c068dd2ada46ff0daed70ef750198482 100644 --- a/tests/lib/SimpleSAML/Locale/LanguageTest.php +++ b/tests/lib/SimpleSAML/Locale/LanguageTest.php @@ -14,15 +14,15 @@ class LanguageTest extends TestCase public function testGetDefaultLanguage() { // test default - $c = Configuration::loadFromArray(array()); + $c = Configuration::loadFromArray([]); $l = new Language($c); $this->assertEquals('en', $l->getDefaultLanguage()); // test defaults coming from configuration - $c = Configuration::loadFromArray(array( - 'language.available' => array('en', 'es', 'nn'), + $c = Configuration::loadFromArray([ + 'language.available' => ['en', 'es', 'nn'], 'language.default' => 'es', - )); + ]); $l = new Language($c); $this->assertEquals('es', $l->getDefaultLanguage()); } @@ -34,19 +34,19 @@ class LanguageTest extends TestCase public function testGetLanguageCookie() { // test it works when no cookie is set - Configuration::loadFromArray(array(), '', 'simplesaml'); + Configuration::loadFromArray([], '', 'simplesaml'); $this->assertNull(Language::getLanguageCookie()); // test that it works fine with defaults - Configuration::loadFromArray(array(), '', 'simplesaml'); + Configuration::loadFromArray([], '', 'simplesaml'); $_COOKIE['language'] = 'en'; $this->assertEquals('en', Language::getLanguageCookie()); // test that it works with non-defaults - Configuration::loadFromArray(array( - 'language.available' => array('en', 'es', 'nn'), + Configuration::loadFromArray([ + 'language.available' => ['en', 'es', 'nn'], 'language.cookie.name' => 'xyz' - ), '', 'simplesaml'); + ], '', 'simplesaml'); $_COOKIE['xyz'] = 'Es'; // test values are converted to lowercase too $this->assertEquals('es', Language::getLanguageCookie()); } @@ -58,10 +58,10 @@ class LanguageTest extends TestCase public function testGetLanguageListNoConfig() { // test default - $c = Configuration::loadFromArray(array(), '', 'simplesaml'); + $c = Configuration::loadFromArray([], '', 'simplesaml'); $l = new Language($c); $l->setLanguage('en'); - $this->assertEquals(array('en' => true), $l->getLanguageList()); + $this->assertEquals(['en' => true], $l->getLanguageList()); } @@ -71,16 +71,16 @@ class LanguageTest extends TestCase public function testGetLanguageListCorrectConfig() { // test langs from from language_names - $c = Configuration::loadFromArray(array( - 'language.available' => array('en', 'nn', 'es'), - ), '', 'simplesaml'); + $c = Configuration::loadFromArray([ + 'language.available' => ['en', 'nn', 'es'], + ], '', 'simplesaml'); $l = new Language($c); $l->setLanguage('es'); - $this->assertEquals(array( + $this->assertEquals([ 'en' => false, 'es' => true, 'nn' => false, - ), $l->getLanguageList()); + ], $l->getLanguageList()); } @@ -90,12 +90,12 @@ class LanguageTest extends TestCase public function testGetLanguageListIncorrectConfig() { // test non-existent langs - $c = Configuration::loadFromArray(array( - 'language.available' => array('foo', 'bar'), - ), '', 'simplesaml'); + $c = Configuration::loadFromArray([ + 'language.available' => ['foo', 'bar'], + ], '', 'simplesaml'); $l = new Language($c); $l->setLanguage('foo'); - $this->assertEquals(array('en' => true), $l->getLanguageList()); + $this->assertEquals(['en' => true], $l->getLanguageList()); } @@ -105,14 +105,14 @@ class LanguageTest extends TestCase public function testGetLanguageParameterName() { // test for default configuration - $c = Configuration::loadFromArray(array(), '', 'simplesaml'); + $c = Configuration::loadFromArray([], '', 'simplesaml'); $l = new Language($c); $this->assertEquals('language', $l->getLanguageParameterName()); // test for valid configuration - $c = Configuration::loadFromArray(array( + $c = Configuration::loadFromArray([ 'language.parameter.name' => 'xyz' - ), '', 'simplesaml'); + ], '', 'simplesaml'); $l = new Language($c); $this->assertEquals('xyz', $l->getLanguageParameterName()); } @@ -124,24 +124,24 @@ class LanguageTest extends TestCase public function testIsLanguageRTL() { // test defaults - $c = Configuration::loadFromArray(array(), '', 'simplesaml'); + $c = Configuration::loadFromArray([], '', 'simplesaml'); $l = new Language($c); $l->setLanguage('en'); $this->assertFalse($l->isLanguageRTL()); // test non-defaults, non-RTL - $c = Configuration::loadFromArray(array( - 'language.rtl' => array('foo', 'bar'), - ), '', 'simplesaml'); + $c = Configuration::loadFromArray([ + 'language.rtl' => ['foo', 'bar'], + ], '', 'simplesaml'); $l = new Language($c); $l->setLanguage('en'); $this->assertFalse($l->isLanguageRTL()); // test non-defaults, RTL - $c = Configuration::loadFromArray(array( - 'language.available' => array('en', 'nn', 'es'), - 'language.rtl' => array('nn', 'es'), - ), '', 'simplesaml'); + $c = Configuration::loadFromArray([ + 'language.available' => ['en', 'nn', 'es'], + 'language.rtl' => ['nn', 'es'], + ], '', 'simplesaml'); $l = new Language($c); $l->setLanguage('es'); $this->assertTrue($l->isLanguageRTL()); @@ -154,11 +154,11 @@ class LanguageTest extends TestCase public function testSetLanguage() { // test with valid configuration, no cookies set - $c = Configuration::loadFromArray(array( - 'language.available' => array('en', 'nn', 'es'), + $c = Configuration::loadFromArray([ + 'language.available' => ['en', 'nn', 'es'], 'language.parameter.name' => 'xyz', 'language.parameter.setcookie' => false, - ), '', 'simplesaml'); + ], '', 'simplesaml'); $_GET['xyz'] = 'Es'; // test also that lang code is transformed to lower caps $l = new Language($c); $this->assertEquals('es', $l->getLanguage()); diff --git a/tests/lib/SimpleSAML/Locale/LocalizationTest.php b/tests/lib/SimpleSAML/Locale/LocalizationTest.php index c45eb0974f32b60651c45bfeae38fc1358957d72..0d67caa0ed42b785ec037f5204cd44d6187b9ff4 100644 --- a/tests/lib/SimpleSAML/Locale/LocalizationTest.php +++ b/tests/lib/SimpleSAML/Locale/LocalizationTest.php @@ -11,7 +11,7 @@ class LocalizationTest extends TestCase protected function setUp() { // Localization/Language code attempts to load a cookie, and looks in the config for a name of the cookie - Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); } @@ -22,7 +22,7 @@ class LocalizationTest extends TestCase { // The constructor should activate the default domain $c = Configuration::loadFromArray( - array('language.i18n.backend' => 'SimpleSAMLphp') + ['language.i18n.backend' => 'SimpleSAMLphp'] ); $l = new Localization($c); $this->assertTrue($l->isI18NBackendDefault()); @@ -35,7 +35,7 @@ class LocalizationTest extends TestCase public function testAddDomain() { $c = Configuration::loadFromArray( - array('language.i18n.backend' => 'gettext/gettext') + ['language.i18n.backend' => 'gettext/gettext'] ); $l = new Localization($c); $newDomain = 'test'; diff --git a/tests/lib/SimpleSAML/Locale/TranslateTest.php b/tests/lib/SimpleSAML/Locale/TranslateTest.php index 48d92377d19d942bd7ee5e9efc814ac4315a6843..b1266df4256afdb2f289603e3d82079090eadc6f 100644 --- a/tests/lib/SimpleSAML/Locale/TranslateTest.php +++ b/tests/lib/SimpleSAML/Locale/TranslateTest.php @@ -14,7 +14,7 @@ class TranslateTest extends TestCase public function testNoop() { // test default - $c = \SimpleSAML\Configuration::loadFromArray(array()); + $c = \SimpleSAML\Configuration::loadFromArray([]); $t = new Translate($c); $testString = 'Blablabla'; $this->assertEquals($testString, $t->noop($testString)); @@ -25,7 +25,7 @@ class TranslateTest extends TestCase */ public function testTFallback() { - $c = \SimpleSAML\Configuration::loadFromArray(array()); + $c = \SimpleSAML\Configuration::loadFromArray([]); $t = new Translate($c); $testString = 'Blablabla'; @@ -34,6 +34,6 @@ class TranslateTest extends TestCase $this->assertEquals($result, $t->t($testString)); // $fallbackdefault = false, should be a noop - $this->assertEquals($testString, $t->t($testString, array(), false)); + $this->assertEquals($testString, $t->t($testString, [], false)); } } diff --git a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php index 1a57bbab0a5bafaba0b752ad9a25ad3d461520e1..c06cb54672d07d53723fd2e24bb6b2e42a25a84a 100644 --- a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php +++ b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php @@ -18,17 +18,17 @@ class SAMLBuilderTest extends TestCase // test SP20 array parsing, no friendly name $set = 'saml20-sp-remote'; - $metadata = array( + $metadata = [ 'entityid' => $entityId, - 'name' => array('en' => 'Test SP'), + 'name' => ['en' => 'Test SP'], 'metadata-set' => $set, - 'attributes' => array( + 'attributes' => [ 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10', 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6', 'urn:oid:0.9.2342.19200300.100.1.3', 'urn:oid:2.5.4.3', - ), - ); + ], + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); @@ -47,17 +47,17 @@ class SAMLBuilderTest extends TestCase // test SP20 array parsing, no friendly name $set = 'saml20-sp-remote'; - $metadata = array( + $metadata = [ 'entityid' => $entityId, - 'name' => array('en' => 'Test SP'), + 'name' => ['en' => 'Test SP'], 'metadata-set' => $set, - 'attributes' => array( + 'attributes' => [ 'eduPersonTargetedID' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10', 'eduPersonPrincipalName' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6', 'eduPersonOrgDN' => 'urn:oid:0.9.2342.19200300.100.1.3', 'cn' => 'urn:oid:2.5.4.3', - ), - ); + ], + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); @@ -78,17 +78,17 @@ class SAMLBuilderTest extends TestCase // test SP13 array parsing, no friendly name $set = 'shib13-sp-remote'; - $metadata = array( + $metadata = [ 'entityid' => $entityId, - 'name' => array('en' => 'Test SP'), + 'name' => ['en' => 'Test SP'], 'metadata-set' => $set, - 'attributes' => array( + 'attributes' => [ 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10', 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6', 'urn:oid:0.9.2342.19200300.100.1.3', 'urn:oid:2.5.4.3', - ), - ); + ], + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); @@ -107,17 +107,17 @@ class SAMLBuilderTest extends TestCase // test SP20 array parsing, no friendly name $set = 'shib13-sp-remote'; - $metadata = array( + $metadata = [ 'entityid' => $entityId, - 'name' => array('en' => 'Test SP'), + 'name' => ['en' => 'Test SP'], 'metadata-set' => $set, - 'attributes' => array( + 'attributes' => [ 'eduPersonTargetedID' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10', 'eduPersonPrincipalName' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6', 'eduPersonOrgDN' => 'urn:oid:0.9.2342.19200300.100.1.3', 'cn' => 'urn:oid:2.5.4.3', - ), - ); + ], + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); @@ -145,15 +145,15 @@ class SAMLBuilderTest extends TestCase $entityId = 'https://entity.example.com/id'; $set = 'saml20-sp-remote'; - $metadata = array( + $metadata = [ 'entityid' => $entityId, - 'name' => array('en' => 'Test SP'), + 'name' => ['en' => 'Test SP'], 'metadata-set' => $set, - 'attributes' => array( + 'attributes' => [ 'eduPersonTargetedID' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10', 'eduPersonPrincipalName' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6', - ), - ); + ], + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); @@ -192,15 +192,15 @@ class SAMLBuilderTest extends TestCase $entityId = 'https://entity.example.com/id'; $set = 'saml20-sp-remote'; - $metadata = array( + $metadata = [ 'entityid' => $entityId, - 'name' => array('en' => 'Test SP'), + 'name' => ['en' => 'Test SP'], 'metadata-set' => $set, - 'attributes' => array( + 'attributes' => [ 'eduPersonTargetedID' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.10', 'eduPersonPrincipalName' => 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6', - ), - ); + ], + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); @@ -232,19 +232,19 @@ class SAMLBuilderTest extends TestCase $set = 'attributeauthority-remote'; // without protocolSupportEnumeration fallback to default: urn:oasis:names:tc:SAML:2.0:protocol - $metadata = array( + $metadata = [ 'entityid' => $entityId, - 'name' => array('en' => 'Test AA'), + 'name' => ['en' => 'Test AA'], 'metadata-set' => $set, 'AttributeService' => - array ( + [ 0 => - array ( + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP', 'Location' => 'https://entity.example.com:8443/idp/profile/SAML2/SOAP/AttributeQuery', - ), - ), - ); + ], + ], + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); @@ -257,10 +257,10 @@ class SAMLBuilderTest extends TestCase // explicit protocols $metadata['protocols'] = - array( + [ 0 => 'urn:oasis:names:tc:SAML:1.1:protocol', 1 => 'urn:oasis:names:tc:SAML:2.0:protocol', - ); + ]; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); $entityDescriptorXml = $samlBuilder->getEntityDescriptorText(); diff --git a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php index 0a82545981280a71cde2e2f4917b0e911c08947f..cfed7b198546d7e3c0a79b9d1840062afc2f9eb0 100644 --- a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php +++ b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php @@ -15,9 +15,9 @@ class SAMLParserTest extends TestCase */ public function testRegistrationInfo() { - $expected = array( + $expected = [ 'registrationAuthority' => 'https://incommon.org', - ); + ]; $document = \SAML2\DOMDocumentFactory::fromString( <<<XML @@ -47,9 +47,9 @@ XML */ public function testRegistrationInfoInheritance() { - $expected = array( + $expected = [ 'registrationAuthority' => 'https://incommon.org', - ); + ]; $document = \SAML2\DOMDocumentFactory::fromString( <<<XML @@ -125,8 +125,8 @@ XML $this->assertEquals("Example service", $metadata['name']['en']); $this->assertEquals("Dit is een voorbeeld voor de unittest.", $metadata['description']['nl']); - $expected_a = array("urn:mace:dir:attribute-def:eduPersonPrincipalName", "urn:mace:dir:attribute-def:mail", "urn:mace:dir:attribute-def:displayName"); - $expected_r = array("urn:mace:dir:attribute-def:eduPersonPrincipalName"); + $expected_a = ["urn:mace:dir:attribute-def:eduPersonPrincipalName", "urn:mace:dir:attribute-def:mail", "urn:mace:dir:attribute-def:displayName"]; + $expected_r = ["urn:mace:dir:attribute-def:eduPersonPrincipalName"]; $this->assertEquals($expected_a, $metadata['attributes']); $this->assertEquals($expected_r, $metadata['attributes.required']); diff --git a/tests/lib/SimpleSAML/ModuleTest.php b/tests/lib/SimpleSAML/ModuleTest.php index 8cb330896613f2ac69410072e5155007b871d6d2..a0c72b5f58d7ee4ab7a744b4dd6f58dab16e5a11 100644 --- a/tests/lib/SimpleSAML/ModuleTest.php +++ b/tests/lib/SimpleSAML/ModuleTest.php @@ -35,19 +35,19 @@ class ModuleTest extends TestCase */ public function testGetModuleURL() { - \SimpleSAML\Configuration::loadFromArray(array( + \SimpleSAML\Configuration::loadFromArray([ 'baseurlpath' => 'https://example.com/simplesaml/' - ), '', 'simplesaml'); + ], '', 'simplesaml'); $this->assertEquals( 'https://example.com/simplesaml/module.php/module/script.php', Module::getModuleURL('module/script.php') ); $this->assertEquals( 'https://example.com/simplesaml/module.php/module/script.php?param1=value1¶m2=value2', - Module::getModuleURL('module/script.php', array( + Module::getModuleURL('module/script.php', [ 'param1' => 'value1', 'param2' => 'value2', - )) + ]) ); } @@ -107,10 +107,13 @@ class ModuleTest extends TestCase $this->assertEquals('sspmod_core_ACL', Module::resolveClass('core:ACL', '')); // test for the $type parameter correctly translated into a path - $this->assertEquals('sspmod_core_Auth_Process_PHP', Module::resolveClass('core:PHP', 'Auth_Process')); + $this->assertEquals( + '\SimpleSAML\Module\core\Auth\Process\PHP', + Module::resolveClass('core:PHP', 'Auth_Process') + ); // test for valid subclasses - $this->assertEquals('sspmod_core_Auth_Process_PHP', Module::resolveClass( + $this->assertEquals('\SimpleSAML\Module\core\Auth\Process\PHP', Module::resolveClass( 'core:PHP', 'Auth\Process', '\SimpleSAML\Auth\ProcessingFilter' diff --git a/tests/lib/SimpleSAML/Store/RedisTest.php b/tests/lib/SimpleSAML/Store/RedisTest.php index fbe770522eabb591172cd33abbab108d6e6e5a1e..7774a5dd211cf72b069bd9535bdbb592a3110890 100644 --- a/tests/lib/SimpleSAML/Store/RedisTest.php +++ b/tests/lib/SimpleSAML/Store/RedisTest.php @@ -18,24 +18,24 @@ class RedisTest extends TestCase { protected function setUp() { - $this->config = array(); + $this->config = []; $this->mocked_redis = $this->getMockBuilder('Predis\Client') - ->setMethods(array('get', 'set', 'setex', 'del', 'disconnect')) + ->setMethods(['get', 'set', 'setex', 'del', 'disconnect']) ->disableOriginalConstructor() ->getMock(); $this->mocked_redis->method('get') - ->will($this->returnCallback(array($this, 'getMocked'))); + ->will($this->returnCallback([$this, 'getMocked'])); $this->mocked_redis->method('set') - ->will($this->returnCallback(array($this, 'setMocked'))); + ->will($this->returnCallback([$this, 'setMocked'])); $this->mocked_redis->method('setex') - ->will($this->returnCallback(array($this, 'setexMocked'))); + ->will($this->returnCallback([$this, 'setexMocked'])); $this->mocked_redis->method('del') - ->will($this->returnCallback(array($this, 'delMocked'))); + ->will($this->returnCallback([$this, 'delMocked'])); $nop = function () { return; @@ -75,10 +75,10 @@ class RedisTest extends TestCase */ public function testRedisInstance() { - $config = Configuration::loadFromArray(array( + $config = Configuration::loadFromArray([ 'store.type' => 'redis', 'store.redis.prefix' => 'phpunit_', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $store = Store::getInstance(); diff --git a/tests/lib/SimpleSAML/Store/SQLTest.php b/tests/lib/SimpleSAML/Store/SQLTest.php index 1321726d3493da40d3a2f7b23cccc4f1ae833c81..cda9dc2908bbdadd580ee2abaf2089380180b84d 100644 --- a/tests/lib/SimpleSAML/Store/SQLTest.php +++ b/tests/lib/SimpleSAML/Store/SQLTest.php @@ -19,11 +19,11 @@ class SQLTest extends TestCase { protected function setUp() { - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'store.type' => 'sql', 'store.sql.dsn' => 'sqlite::memory:', 'store.sql.prefix' => 'phpunit_', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); } /** diff --git a/tests/lib/SimpleSAML/StoreTest.php b/tests/lib/SimpleSAML/StoreTest.php index 61f0fe8237d291507390d1d4a58dee9c8b8d4cb9..ebaa1c5fb09b7d23e52ffdec3bc47746ae5e76e5 100644 --- a/tests/lib/SimpleSAML/StoreTest.php +++ b/tests/lib/SimpleSAML/StoreTest.php @@ -23,8 +23,8 @@ class StoreTest extends TestCase */ public function defaultStore() { - Configuration::loadFromArray(array( - ), '[ARRAY]', 'simplesaml'); + Configuration::loadFromArray([ + ], '[ARRAY]', 'simplesaml'); $store = Store::getInstance(); @@ -38,8 +38,8 @@ class StoreTest extends TestCase */ public function phpSessionStore() { - Configuration::loadFromArray(array( - ), '[ARRAY]', 'simplesaml'); + Configuration::loadFromArray([ + ], '[ARRAY]', 'simplesaml'); $store = Store::getInstance(); @@ -53,9 +53,9 @@ class StoreTest extends TestCase */ public function memcacheStore() { - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'store.type' => 'memcache', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $store = Store::getInstance(); @@ -69,11 +69,11 @@ class StoreTest extends TestCase */ public function sqlStore() { - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'store.type' => 'sql', 'store.sql.dsn' => 'sqlite::memory:', 'store.sql.prefix' => 'phpunit_', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $store = Store::getInstance(); @@ -87,11 +87,11 @@ class StoreTest extends TestCase */ public function pathStore() { - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'store.type' => '\SimpleSAML\Store\SQL', 'store.sql.dsn' => 'sqlite::memory:', 'store.sql.prefix' => 'phpunit_', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $store = Store::getInstance(); @@ -106,11 +106,11 @@ class StoreTest extends TestCase */ public function notFoundStoreException() { - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'store.type' => '\Test\SimpleSAML\Store\Dummy', 'store.sql.dsn' => 'sqlite::memory:', 'store.sql.prefix' => 'phpunit_', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); Store::getInstance(); } diff --git a/tests/lib/SimpleSAML/Utils/ArraysTest.php b/tests/lib/SimpleSAML/Utils/ArraysTest.php index 5bed975d1d2d90ceb0742ae307e8d252ef7f92d5..eb3d1b66843ff302c0bb6657ea7786b2b36db698 100644 --- a/tests/lib/SimpleSAML/Utils/ArraysTest.php +++ b/tests/lib/SimpleSAML/Utils/ArraysTest.php @@ -16,23 +16,23 @@ class ArraysTest extends TestCase public function testArrayize() { // check with empty array as input - $array = array(); + $array = []; $this->assertEquals($array, Arrays::arrayize($array)); // check non-empty array as input - $array = array('key' => 'value'); + $array = ['key' => 'value']; $this->assertEquals($array, Arrays::arrayize($array)); // check indexes are ignored when input is an array $this->assertArrayNotHasKey('invalid', Arrays::arrayize($array, 'invalid')); // check default index - $expected = array('string'); + $expected = ['string']; $this->assertEquals($expected, Arrays::arrayize($expected[0])); // check string index $index = 'key'; - $expected = array($index => 'string'); + $expected = [$index => 'string']; $this->assertEquals($expected, Arrays::arrayize($expected[$index], $index)); } @@ -47,33 +47,33 @@ class ArraysTest extends TestCase // check bad arrays $this->assertFalse( - Arrays::transpose(array('1', '2', '3')), + Arrays::transpose(['1', '2', '3']), 'Invalid two-dimensional array was accepted' ); $this->assertFalse( - Arrays::transpose(array('1' => 0, '2' => '0', '3' => array(0))), + Arrays::transpose(['1' => 0, '2' => '0', '3' => [0]]), 'Invalid elements on a two-dimensional array were accepted' ); // check array with numerical keys - $array = array( - 'key1' => array( + $array = [ + 'key1' => [ 'value1' - ), - 'key2' => array( + ], + 'key2' => [ 'value1', 'value2' - ) - ); - $transposed = array( - array( + ] + ]; + $transposed = [ + [ 'key1' => 'value1', 'key2' => 'value1' - ), - array( + ], + [ 'key2' => 'value2' - ) - ); + ] + ]; $this->assertEquals( $transposed, Arrays::transpose($array), @@ -81,24 +81,24 @@ class ArraysTest extends TestCase ); // check array with string keys - $array = array( - 'key1' => array( + $array = [ + 'key1' => [ 'subkey1' => 'value1' - ), - 'key2' => array( + ], + 'key2' => [ 'subkey1' => 'value1', 'subkey2' => 'value2' - ) - ); - $transposed = array( - 'subkey1' => array( + ] + ]; + $transposed = [ + 'subkey1' => [ 'key1' => 'value1', 'key2' => 'value1' - ), - 'subkey2' => array( + ], + 'subkey2' => [ 'key2' => 'value2' - ) - ); + ] + ]; $this->assertEquals( $transposed, Arrays::transpose($array), @@ -106,26 +106,26 @@ class ArraysTest extends TestCase ); // check array with no keys in common between sub arrays - $array = array( - 'key1' => array( + $array = [ + 'key1' => [ 'subkey1' => 'value1' - ), - 'key2' => array( + ], + 'key2' => [ 'subkey2' => 'value1', 'subkey3' => 'value2' - ) - ); - $transposed = array( - 'subkey1' => array( + ] + ]; + $transposed = [ + 'subkey1' => [ 'key1' => 'value1', - ), - 'subkey2' => array( + ], + 'subkey2' => [ 'key2' => 'value1' - ), - 'subkey3' => array( + ], + 'subkey3' => [ 'key2' => 'value2' - ) - ); + ] + ]; $this->assertEquals( $transposed, Arrays::transpose($array), diff --git a/tests/lib/SimpleSAML/Utils/AttributesTest.php b/tests/lib/SimpleSAML/Utils/AttributesTest.php index 0c1c8dba58c34472c556f9338cb207bb41247a4e..42685215a8a07d09ff5eec620d26929379ee21d5 100644 --- a/tests/lib/SimpleSAML/Utils/AttributesTest.php +++ b/tests/lib/SimpleSAML/Utils/AttributesTest.php @@ -35,7 +35,7 @@ class AttributesTest extends TestCase public function testGetExpectedAttributeInvalidAttributeName() { // check with invalid attribute name - $attributes = array(); + $attributes = []; $expected = false; $this->setExpectedException( 'InvalidArgumentException', @@ -51,9 +51,9 @@ class AttributesTest extends TestCase public function testGetExpectedAttributeNonNormalizedArray() { // check with non-normalized attributes array - $attributes = array( + $attributes = [ 'attribute' => 'value', - ); + ]; $expected = 'attribute'; $this->setExpectedException( 'InvalidArgumentException', @@ -69,9 +69,9 @@ class AttributesTest extends TestCase public function testGetExpectedAttributeMissingAttribute() { // check missing attribute - $attributes = array( - 'attribute' => array('value'), - ); + $attributes = [ + 'attribute' => ['value'], + ]; $expected = 'missing'; $this->setExpectedException( '\SimpleSAML\Error\Exception', @@ -87,9 +87,9 @@ class AttributesTest extends TestCase public function testGetExpectedAttributeEmptyAttribute() { // check empty attribute - $attributes = array( - 'attribute' => array(), - ); + $attributes = [ + 'attribute' => [], + ]; $expected = 'attribute'; $this->setExpectedException( '\SimpleSAML\Error\Exception', @@ -105,12 +105,12 @@ class AttributesTest extends TestCase public function testGetExpectedAttributeMultipleValues() { // check attribute with more than value, that being not allowed - $attributes = array( - 'attribute' => array( + $attributes = [ + 'attribute' => [ 'value1', 'value2', - ), - ); + ], + ]; $expected = 'attribute'; $this->setExpectedException( '\SimpleSAML\Error\Exception', @@ -127,17 +127,17 @@ class AttributesTest extends TestCase { // check one value $value = 'value'; - $attributes = array( - 'attribute' => array($value), - ); + $attributes = [ + 'attribute' => [$value], + ]; $expected = 'attribute'; $this->assertEquals($value, Attributes::getExpectedAttribute($attributes, $expected)); // check multiple (allowed) values $value = 'value'; - $attributes = array( - 'attribute' => array($value, 'value2', 'value3'), - ); + $attributes = [ + 'attribute' => [$value, 'value2', 'value3'], + ]; $expected = 'attribute'; $this->assertEquals($value, Attributes::getExpectedAttribute($attributes, $expected, true)); } @@ -160,7 +160,7 @@ class AttributesTest extends TestCase */ public function testNormalizeAttributesArrayBadKeys() { - Attributes::normalizeAttributesArray(array('attr1' => 'value1', 1 => 'value2')); + Attributes::normalizeAttributesArray(['attr1' => 'value1', 1 => 'value2']); } /** @@ -170,7 +170,7 @@ class AttributesTest extends TestCase */ public function testNormalizeAttributesArrayBadValues() { - Attributes::normalizeAttributesArray(array('attr1' => 'value1', 'attr2' => 0)); + Attributes::normalizeAttributesArray(['attr1' => 'value1', 'attr2' => 0]); } /** @@ -178,16 +178,16 @@ class AttributesTest extends TestCase */ public function testNormalizeAttributesArray() { - $attributes = array( + $attributes = [ 'key1' => 'value1', - 'key2' => array('value2', 'value3'), + 'key2' => ['value2', 'value3'], 'key3' => 'value1' - ); - $expected = array( - 'key1' => array('value1'), - 'key2' => array('value2', 'value3'), - 'key3' => array('value1') - ); + ]; + $expected = [ + 'key1' => ['value1'], + 'key2' => ['value2', 'value3'], + 'key3' => ['value1'] + ]; $this->assertEquals( $expected, Attributes::normalizeAttributesArray($attributes), @@ -203,13 +203,13 @@ class AttributesTest extends TestCase { // test for only the name $this->assertEquals( - array('default', 'name'), + ['default', 'name'], Attributes::getAttributeNamespace('name', 'default') ); // test for a given namespace and multiple '/' $this->assertEquals( - array('some/namespace', 'name'), + ['some/namespace', 'name'], Attributes::getAttributeNamespace('some/namespace/name', 'default') ); } diff --git a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php index 98ffb7f0b3350e28b71cc50211e4a65994352323..71002024435d92608bbd1ab3e8d92bca5b206063 100644 --- a/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php +++ b/tests/lib/SimpleSAML/Utils/Config/MetadataTest.php @@ -24,9 +24,9 @@ class MetadataTest extends TestCase } // test missing type - $contact = array( + $contact = [ 'name' => 'John Doe' - ); + ]; try { Metadata::getContact($contact); } catch (\InvalidArgumentException $e) { @@ -34,9 +34,9 @@ class MetadataTest extends TestCase } // test invalid type - $contact = array( + $contact = [ 'contactType' => 'invalid' - ); + ]; try { Metadata::getContact($contact); } catch (\InvalidArgumentException $e) { @@ -45,9 +45,9 @@ class MetadataTest extends TestCase // test all valid contact types foreach (Metadata::$VALID_CONTACT_TYPES as $type) { - $contact = array( + $contact = [ 'contactType' => $type - ); + ]; $parsed = Metadata::getContact($contact); $this->assertArrayHasKey('contactType', $parsed); $this->assertArrayNotHasKey('givenName', $parsed); @@ -55,10 +55,10 @@ class MetadataTest extends TestCase } // test basic name parsing - $contact = array( + $contact = [ 'contactType' => 'technical', 'name' => 'John Doe' - ); + ]; $parsed = Metadata::getContact($contact); $this->assertArrayNotHasKey('name', $parsed); $this->assertArrayHasKey('givenName', $parsed); @@ -67,10 +67,10 @@ class MetadataTest extends TestCase $this->assertEquals('Doe', $parsed['surName']); // test comma-separated names - $contact = array( + $contact = [ 'contactType' => 'technical', 'name' => 'Doe, John' - ); + ]; $parsed = Metadata::getContact($contact); $this->assertArrayHasKey('givenName', $parsed); $this->assertArrayHasKey('surName', $parsed); @@ -78,10 +78,10 @@ class MetadataTest extends TestCase $this->assertEquals('Doe', $parsed['surName']); // test long names - $contact = array( + $contact = [ 'contactType' => 'technical', 'name' => 'John Fitzgerald Doe Smith' - ); + ]; $parsed = Metadata::getContact($contact); $this->assertArrayNotHasKey('name', $parsed); $this->assertArrayHasKey('givenName', $parsed); @@ -89,10 +89,10 @@ class MetadataTest extends TestCase $this->assertEquals('John Fitzgerald Doe Smith', $parsed['givenName']); // test comma-separated long names - $contact = array( + $contact = [ 'contactType' => 'technical', 'name' => 'Doe Smith, John Fitzgerald' - ); + ]; $parsed = Metadata::getContact($contact); $this->assertArrayNotHasKey('name', $parsed); $this->assertArrayHasKey('givenName', $parsed); @@ -101,10 +101,10 @@ class MetadataTest extends TestCase $this->assertEquals('Doe Smith', $parsed['surName']); // test givenName - $contact = array( + $contact = [ 'contactType' => 'technical', - ); - $invalid_types = array(0, array(0), 0.1, true, false); + ]; + $invalid_types = [0, [0], 0.1, true, false]; foreach ($invalid_types as $type) { $contact['givenName'] = $type; try { @@ -115,10 +115,10 @@ class MetadataTest extends TestCase } // test surName - $contact = array( + $contact = [ 'contactType' => 'technical', - ); - $invalid_types = array(0, array(0), 0.1, true, false); + ]; + $invalid_types = [0, [0], 0.1, true, false]; foreach ($invalid_types as $type) { $contact['surName'] = $type; try { @@ -129,10 +129,10 @@ class MetadataTest extends TestCase } // test company - $contact = array( + $contact = [ 'contactType' => 'technical', - ); - $invalid_types = array(0, array(0), 0.1, true, false); + ]; + $invalid_types = [0, [0], 0.1, true, false]; foreach ($invalid_types as $type) { $contact['company'] = $type; try { @@ -143,10 +143,10 @@ class MetadataTest extends TestCase } // test emailAddress - $contact = array( + $contact = [ 'contactType' => 'technical', - ); - $invalid_types = array(0, 0.1, true, false, array()); + ]; + $invalid_types = [0, 0.1, true, false, []]; foreach ($invalid_types as $type) { $contact['emailAddress'] = $type; try { @@ -158,7 +158,7 @@ class MetadataTest extends TestCase ); } } - $invalid_types = array(array("string", true), array("string", 0)); + $invalid_types = [["string", true], ["string", 0]]; foreach ($invalid_types as $type) { $contact['emailAddress'] = $type; try { @@ -170,7 +170,7 @@ class MetadataTest extends TestCase ); } } - $valid_types = array('email@example.com', array('email1@example.com', 'email2@example.com')); + $valid_types = ['email@example.com', ['email1@example.com', 'email2@example.com']]; foreach ($valid_types as $type) { $contact['emailAddress'] = $type; $parsed = Metadata::getContact($contact); @@ -178,10 +178,10 @@ class MetadataTest extends TestCase } // test telephoneNumber - $contact = array( + $contact = [ 'contactType' => 'technical', - ); - $invalid_types = array(0, 0.1, true, false, array()); + ]; + $invalid_types = [0, 0.1, true, false, []]; foreach ($invalid_types as $type) { $contact['telephoneNumber'] = $type; try { @@ -193,7 +193,7 @@ class MetadataTest extends TestCase ); } } - $invalid_types = array(array("string", true), array("string", 0)); + $invalid_types = [["string", true], ["string", 0]]; foreach ($invalid_types as $type) { $contact['telephoneNumber'] = $type; try { @@ -202,7 +202,7 @@ class MetadataTest extends TestCase $this->assertEquals('Telephone numbers must be a string and cannot be empty.', $e->getMessage()); } } - $valid_types = array('1234', array('1234', '5678')); + $valid_types = ['1234', ['1234', '5678']]; foreach ($valid_types as $type) { $contact['telephoneNumber'] = $type; $parsed = Metadata::getContact($contact); @@ -210,13 +210,13 @@ class MetadataTest extends TestCase } // test completeness - $contact = array(); + $contact = []; foreach (Metadata::$VALID_CONTACT_OPTIONS as $option) { $contact[$option] = 'string'; } $contact['contactType'] = 'technical'; $contact['name'] = 'to_be_removed'; - $contact['attributes'] = array('test' => 'testval'); + $contact['attributes'] = ['test' => 'testval']; $parsed = Metadata::getContact($contact); foreach (array_keys($parsed) as $key) { $this->assertEquals($parsed[$key], $contact[$key]); @@ -231,32 +231,32 @@ class MetadataTest extends TestCase public function testIsHiddenFromDiscovery() { // test for success - $metadata = array( - 'EntityAttributes' => array( - Metadata::$ENTITY_CATEGORY => array( + $metadata = [ + 'EntityAttributes' => [ + Metadata::$ENTITY_CATEGORY => [ Metadata::$HIDE_FROM_DISCOVERY, - ), - ), - ); + ], + ], + ]; $this->assertTrue(Metadata::isHiddenFromDiscovery($metadata)); // test for failures - $this->assertFalse(Metadata::isHiddenFromDiscovery(array('foo'))); - $this->assertFalse(Metadata::isHiddenFromDiscovery(array( + $this->assertFalse(Metadata::isHiddenFromDiscovery(['foo'])); + $this->assertFalse(Metadata::isHiddenFromDiscovery([ 'EntityAttributes' => 'bar', - ))); - $this->assertFalse(Metadata::isHiddenFromDiscovery(array( - 'EntityAttributes' => array(), - ))); - $this->assertFalse(Metadata::isHiddenFromDiscovery(array( - 'EntityAttributes' => array( + ])); + $this->assertFalse(Metadata::isHiddenFromDiscovery([ + 'EntityAttributes' => [], + ])); + $this->assertFalse(Metadata::isHiddenFromDiscovery([ + 'EntityAttributes' => [ Metadata::$ENTITY_CATEGORY => '', - ), - ))); - $this->assertFalse(Metadata::isHiddenFromDiscovery(array( - 'EntityAttributes' => array( - Metadata::$ENTITY_CATEGORY => array(), - ), - ))); + ], + ])); + $this->assertFalse(Metadata::isHiddenFromDiscovery([ + 'EntityAttributes' => [ + Metadata::$ENTITY_CATEGORY => [], + ], + ])); } } diff --git a/tests/lib/SimpleSAML/Utils/CryptoTest.php b/tests/lib/SimpleSAML/Utils/CryptoTest.php index b5a0b500a966350542632a5b9f18035f623eaee1..db0080f56df6a43a7244e8010dd0ab594899cec9 100644 --- a/tests/lib/SimpleSAML/Utils/CryptoTest.php +++ b/tests/lib/SimpleSAML/Utils/CryptoTest.php @@ -21,9 +21,9 @@ class CryptoTest extends TestCase $this->root = vfsStream::setup( self::ROOTDIRNAME, null, - array( - self::DEFAULTCERTDIR => array(), - ) + [ + self::DEFAULTCERTDIR => [], + ] ); $this->root_directory = vfsStream::url(self::ROOTDIRNAME); $this->certdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTCERTDIR; @@ -41,7 +41,7 @@ class CryptoTest extends TestCase $m = new \ReflectionMethod('\SimpleSAML\Utils\Crypto', '_aesDecrypt'); $m->setAccessible(true); - $m->invokeArgs(null, array(array(), 'SECRET')); + $m->invokeArgs(null, [[], 'SECRET']); } @@ -57,7 +57,7 @@ class CryptoTest extends TestCase $m = new \ReflectionMethod('\SimpleSAML\Utils\Crypto', '_aesEncrypt'); $m->setAccessible(true); - $m->invokeArgs(null, array(array(), 'SECRET')); + $m->invokeArgs(null, [[], 'SECRET']); } @@ -79,7 +79,7 @@ class CryptoTest extends TestCase $plaintext = 'SUPER_SECRET_TEXT'; $ciphertext = 'uR2Yu0r4itInKx91D/l9y/08L5CIQyev9nAr27fh3Sshous4vbXRRcMcjqHDOrquD+2vqLyw7ygnbA9jA9TpB4hLZocvAWcTN8tyO82hiSY='; - $this->assertEquals($plaintext, $m->invokeArgs(null, array(base64_decode($ciphertext), $secret))); + $this->assertEquals($plaintext, $m->invokeArgs(null, [base64_decode($ciphertext), $secret])); } @@ -102,8 +102,8 @@ class CryptoTest extends TestCase $d->setAccessible(true); $original_plaintext = 'SUPER_SECRET_TEXT'; - $ciphertext = $e->invokeArgs(null, array($original_plaintext, $secret)); - $decrypted_plaintext = $d->invokeArgs(null, array($ciphertext, $secret)); + $ciphertext = $e->invokeArgs(null, [$original_plaintext, $secret]); + $decrypted_plaintext = $d->invokeArgs(null, [$ciphertext, $secret]); $this->assertEquals($original_plaintext, $decrypted_plaintext); } @@ -243,7 +243,6 @@ PHP; */ public function testBadHashAlgorithmValid() { - $pw = "password"; $algorithm = "wtf"; $hash = "{".$algorithm."}B64STRING"; @@ -277,7 +276,7 @@ PHP; */ public function testLoadPrivateKeyRequiredMetadataMissing() { - $config = new Configuration(array(), 'test'); + $config = new Configuration([], 'test'); $required = true; Crypto::loadPrivateKey($config, $required); @@ -288,7 +287,7 @@ PHP; */ public function testLoadPrivateKeyNotRequiredMetadataMissing() { - $config = new Configuration(array(), 'test'); + $config = new Configuration([], 'test'); $required = false; $res = Crypto::loadPrivateKey($config, $required); @@ -303,7 +302,7 @@ PHP; */ public function testLoadPrivateKeyMissingFile() { - $config = new Configuration(array('privatekey' => 'nonexistant'), 'test'); + $config = new Configuration(['privatekey' => 'nonexistant'], 'test'); Crypto::loadPrivateKey($config, false, '', true); } @@ -315,13 +314,13 @@ PHP; { $filename = $this->certdir.DIRECTORY_SEPARATOR.'key'; $data = 'data'; - $config = new Configuration(array('privatekey' => $filename), 'test'); + $config = new Configuration(['privatekey' => $filename], 'test'); $full_path = true; file_put_contents($filename, $data); $res = Crypto::loadPrivateKey($config, false, '', $full_path); - $expected = array('PEM' => $data); + $expected = ['PEM' => $data]; $this->assertEquals($expected, $res); } @@ -335,10 +334,10 @@ PHP; $filename = $this->certdir.DIRECTORY_SEPARATOR.'key'; $data = 'data'; $config = new Configuration( - array( + [ 'privatekey' => $filename, 'privatekey_pass' => $password, - ), + ], 'test' ); $full_path = true; @@ -346,7 +345,7 @@ PHP; file_put_contents($filename, $data); $res = Crypto::loadPrivateKey($config, false, '', $full_path); - $expected = array('PEM' => $data, 'password' => $password); + $expected = ['PEM' => $data, 'password' => $password]; $this->assertEquals($expected, $res); } @@ -361,10 +360,10 @@ PHP; $filename = $this->certdir.DIRECTORY_SEPARATOR.'key'; $data = 'data'; $config = new Configuration( - array( + [ $prefix.'privatekey' => $filename, $prefix.'privatekey_pass' => $password, - ), + ], 'test' ); $full_path = true; @@ -372,7 +371,7 @@ PHP; file_put_contents($filename, $data); $res = Crypto::loadPrivateKey($config, false, $prefix, $full_path); - $expected = array('PEM' => $data, 'password' => $password); + $expected = ['PEM' => $data, 'password' => $password]; $this->assertEquals($expected, $res); } @@ -384,7 +383,7 @@ PHP; */ public function testLoadPublicKeyRequiredMetadataMissing() { - $config = new Configuration(array(), 'test'); + $config = new Configuration([], 'test'); $required = true; Crypto::loadPublicKey($config, $required); @@ -395,7 +394,7 @@ PHP; */ public function testLoadPublicKeyNotRequiredMetadataMissing() { - $config = new Configuration(array(), 'test'); + $config = new Configuration([], 'test'); $required = false; $res = Crypto::loadPublicKey($config, $required); @@ -409,10 +408,10 @@ PHP; public function testLoadPublicKeyFingerprintBasicString() { $fingerprint = 'fingerprint'; - $config = new Configuration(array('certFingerprint' => $fingerprint), 'test'); + $config = new Configuration(['certFingerprint' => $fingerprint], 'test'); $res = Crypto::loadPublicKey($config); - $expected = array('certFingerprint' => array($fingerprint)); + $expected = ['certFingerprint' => [$fingerprint]]; $this->assertEquals($expected, $res); } @@ -425,17 +424,17 @@ PHP; $fingerprint1 = 'fingerprint1'; $fingerprint2 = 'fingerprint2'; $config = new Configuration( - array( - 'certFingerprint' => array( + [ + 'certFingerprint' => [ $fingerprint1, $fingerprint2 - ), - ), + ], + ], 'test' ); $res = Crypto::loadPublicKey($config); - $expected = array('certFingerprint' => array($fingerprint1, $fingerprint2)); + $expected = ['certFingerprint' => [$fingerprint1, $fingerprint2]]; $this->assertEquals($expected, $res); } @@ -446,10 +445,10 @@ PHP; public function testLoadPublicKeyFingerprintLowercase() { $fingerprint = 'FINGERPRINT'; - $config = new Configuration(array('certFingerprint' => $fingerprint), 'test'); + $config = new Configuration(['certFingerprint' => $fingerprint], 'test'); $res = Crypto::loadPublicKey($config); - $expected = array('certFingerprint' => array(strtolower($fingerprint))); + $expected = ['certFingerprint' => [strtolower($fingerprint)]]; $this->assertEquals($expected, $res); } @@ -460,10 +459,10 @@ PHP; public function testLoadPublicKeyFingerprintRemoveColons() { $fingerprint = 'f:i:n:g:e:r:p:r:i:n:t'; - $config = new Configuration(array('certFingerprint' => $fingerprint), 'test'); + $config = new Configuration(['certFingerprint' => $fingerprint], 'test'); $res = Crypto::loadPublicKey($config); - $expected = array('certFingerprint' => array(str_replace(':', '', $fingerprint))); + $expected = ['certFingerprint' => [str_replace(':', '', $fingerprint)]]; $this->assertEquals($expected, $res); } @@ -474,15 +473,15 @@ PHP; public function testLoadPublicKeyNotX509Certificate() { $config = new Configuration( - array( - 'keys' => array( - array( + [ + 'keys' => [ + [ 'X509Certificate' => '', 'type' => 'NotX509Certificate', 'signing' => true - ), - ), - ), + ], + ], + ], 'test' ); @@ -497,15 +496,15 @@ PHP; public function testLoadPublicKeyNotSigning() { $config = new Configuration( - array( - 'keys' => array( - array( + [ + 'keys' => [ + [ 'X509Certificate' => '', 'type' => 'X509Certificate', 'signing' => false - ), - ), - ), + ], + ], + ], 'test' ); @@ -521,15 +520,15 @@ PHP; { $x509certificate = 'x509certificate'; $config = new Configuration( - array( - 'keys' => array( - array( + [ + 'keys' => [ + [ 'X509Certificate' => $x509certificate, 'type' => 'X509Certificate', 'signing' => true - ), - ), - ), + ], + ], + ], 'test' ); diff --git a/tests/lib/SimpleSAML/Utils/HTTPTest.php b/tests/lib/SimpleSAML/Utils/HTTPTest.php index 917a16290bbb2b5ebd0bd8872b11ce05f3e79a55..986a813b1758bc096d2fc600010cebac97d8955b 100644 --- a/tests/lib/SimpleSAML/Utils/HTTPTest.php +++ b/tests/lib/SimpleSAML/Utils/HTTPTest.php @@ -38,7 +38,7 @@ class HTTPTest extends TestCase */ public function testAddURLParametersInvalidURL() { - HTTP::addURLParameters(array(), array()); + HTTP::addURLParameters([], []); } /** @@ -57,23 +57,23 @@ class HTTPTest extends TestCase public function testAddURLParameters() { $url = 'http://example.com/'; - $params = array( + $params = [ 'foo' => 'bar', 'bar' => 'foo', - ); + ]; $this->assertEquals($url.'?foo=bar&bar=foo', HTTP::addURLParameters($url, $params)); $url = 'http://example.com/?'; - $params = array( + $params = [ 'foo' => 'bar', 'bar' => 'foo', - ); + ]; $this->assertEquals($url.'foo=bar&bar=foo', HTTP::addURLParameters($url, $params)); $url = 'http://example.com/?foo=bar'; - $params = array( + $params = [ 'bar' => 'foo', - ); + ]; $this->assertEquals($url.'&bar=foo', HTTP::addURLParameters($url, $params)); } @@ -126,9 +126,9 @@ class HTTPTest extends TestCase { $original = $_SERVER; - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => '', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $_SERVER['SERVER_PORT'] = '80'; $this->assertEquals('localhost', HTTP::getSelfHost()); $_SERVER['SERVER_PORT'] = '3030'; @@ -144,9 +144,9 @@ class HTTPTest extends TestCase { $original = $_SERVER; - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => '', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); // standard port for HTTP $_SERVER['SERVER_PORT'] = '80'; @@ -175,9 +175,9 @@ class HTTPTest extends TestCase * Test a URL pointing to a script that's not part of the public interface. This allows us to test calls to * getSelfURL() from scripts outside of SimpleSAMLphp */ - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => 'http://example.com/simplesaml/', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $url = 'https://example.com/app/script.php/some/path?foo=bar'; $this->setupEnvFromURL($url); $_SERVER['SCRIPT_FILENAME'] = '/var/www/app/script.php'; @@ -188,9 +188,9 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a request URI that doesn't match the current script - $cfg = Configuration::loadFromArray(array( + $cfg = Configuration::loadFromArray([ 'baseurlpath' => 'https://example.org/simplesaml/', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $baseDir = $cfg->getBaseDir(); $_SERVER['SCRIPT_FILENAME'] = $baseDir.'www/module.php'; $this->setupEnvFromURL('http://www.example.com/protected/resource.asp?foo=bar'); @@ -202,9 +202,9 @@ class HTTPTest extends TestCase $this->assertEquals('http://www.example.com', HTTP::getSelfURLHost()); // test a valid, full URL, based on a full URL in the configuration - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => 'https://example.com/simplesaml/', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('http://www.example.org/module.php/module/file.php?foo=bar'); $this->assertEquals( 'https://example.com/simplesaml/module.php/module/file.php?foo=bar', @@ -216,9 +216,9 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a full URL *without* a trailing slash in the configuration - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => 'https://example.com/simplesaml', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $this->assertEquals( 'https://example.com/simplesaml/module.php/module/file.php?foo=bar', HTTP::getSelfURL() @@ -229,9 +229,9 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a full URL *without* a path in the configuration - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => 'https://example.com', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $this->assertEquals( 'https://example.com/module.php/module/file.php?foo=bar', HTTP::getSelfURL() @@ -242,9 +242,9 @@ class HTTPTest extends TestCase $this->assertEquals('https://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a relative path in the configuration - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => '/simplesaml/', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('http://www.example.org/simplesaml/module.php/module/file.php?foo=bar'); $this->assertEquals( 'http://www.example.org/simplesaml/module.php/module/file.php?foo=bar', @@ -256,9 +256,9 @@ class HTTPTest extends TestCase $this->assertEquals('http://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a relative path in the configuration and a non standard port - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => '/simplesaml/', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('http://example.org:8080/simplesaml/module.php/module/file.php?foo=bar'); $this->assertEquals( 'http://example.org:8080/simplesaml/module.php/module/file.php?foo=bar', @@ -270,9 +270,9 @@ class HTTPTest extends TestCase $this->assertEquals('http://'.HTTP::getSelfHostWithNonStandardPort(), HTTP::getSelfURLHost()); // test a valid, full URL, based on a relative path in the configuration, a non standard port and HTTPS - Configuration::loadFromArray(array( + Configuration::loadFromArray([ 'baseurlpath' => '/simplesaml/', - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $this->setupEnvFromURL('https://example.org:8080/simplesaml/module.php/module/file.php?foo=bar'); $this->assertEquals( 'https://example.org:8080/simplesaml/module.php/module/file.php?foo=bar', @@ -296,19 +296,19 @@ class HTTPTest extends TestCase { $original = $_SERVER; - Configuration::loadFromArray(array( - 'trusted.url.domains' => array('sp.example.com', 'app.example.com'), + Configuration::loadFromArray([ + 'trusted.url.domains' => ['sp.example.com', 'app.example.com'], 'trusted.url.regex' => false, - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $_SERVER['REQUEST_URI'] = '/module.php'; - $allowed = array( + $allowed = [ 'https://sp.example.com/', 'http://sp.example.com/', 'https://app.example.com/', 'http://app.example.com/', - ); + ]; foreach ($allowed as $url) { $this->assertEquals(HTTP::checkURLAllowed($url), $url); } @@ -326,21 +326,21 @@ class HTTPTest extends TestCase { $original = $_SERVER; - Configuration::loadFromArray(array( - 'trusted.url.domains' => array('.*\.example\.com'), + Configuration::loadFromArray([ + 'trusted.url.domains' => ['.*\.example\.com'], 'trusted.url.regex' => true, - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $_SERVER['REQUEST_URI'] = '/module.php'; - $allowed = array( + $allowed = [ 'https://sp.example.com/', 'http://sp.example.com/', 'https://app1.example.com/', 'http://app1.example.com/', 'https://app2.example.com/', 'http://app2.example.com/', - ); + ]; foreach ($allowed as $url) { $this->assertEquals(HTTP::checkURLAllowed($url), $url); } @@ -403,10 +403,10 @@ class HTTPTest extends TestCase { $original = $_SERVER; - Configuration::loadFromArray(array( - 'trusted.url.domains' => array('app\.example\.com'), + Configuration::loadFromArray([ + 'trusted.url.domains' => ['app\.example\.com'], 'trusted.url.regex' => true, - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); $_SERVER['REQUEST_URI'] = '/module.php'; diff --git a/tests/lib/SimpleSAML/Utils/SystemTest.php b/tests/lib/SimpleSAML/Utils/SystemTest.php index e39370e941d4a5b41154fb5fbc559d0c43509be6..7363c34f671e626479c8c280a47501e6e328d930 100644 --- a/tests/lib/SimpleSAML/Utils/SystemTest.php +++ b/tests/lib/SimpleSAML/Utils/SystemTest.php @@ -21,9 +21,9 @@ class SystemTest extends TestCase $this->root = vfsStream::setup( self::ROOTDIRNAME, null, - array( - self::DEFAULTTEMPDIR => array(), - ) + [ + self::DEFAULTTEMPDIR => [], + ] ); $this->root_directory = vfsStream::url(self::ROOTDIRNAME); } @@ -214,6 +214,10 @@ class SystemTest extends TestCase */ public function testGetTempDirBadOwner() { + if (!function_exists('posix_getuid')) { + static::markTestSkipped('POSIX-functions not available; skipping!'); + } + $bad_uid = posix_getuid() + 1; $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; @@ -222,16 +226,16 @@ class SystemTest extends TestCase chown($tempdir, $bad_uid); $this->setExpectedException('\SimpleSAML\Error\Exception'); - $res = System::getTempDir(); + System::getTempDir(); $this->clearInstance($config, '\SimpleSAML\Configuration'); } private function setConfigurationTempDir($directory) { - $config = Configuration::loadFromArray(array( + $config = Configuration::loadFromArray([ 'tempdir' => $directory, - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); return $config; } diff --git a/tests/lib/SimpleSAML/Utils/TimeTest.php b/tests/lib/SimpleSAML/Utils/TimeTest.php index ebe99b9c8091bf6d2f09fcdf9bfa062c554e28ca..6973a2180871c933fc92aecdff9ee8ea746f5002 100644 --- a/tests/lib/SimpleSAML/Utils/TimeTest.php +++ b/tests/lib/SimpleSAML/Utils/TimeTest.php @@ -36,7 +36,7 @@ class TimeTest extends TestCase } // test guessing timezone from the OS - \SimpleSAML\Configuration::loadFromArray(array('timezone' => null), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['timezone' => null], '[ARRAY]', 'simplesaml'); @Time::initTimezone(); $this->assertEquals($os, @date_default_timezone_get()); @@ -46,7 +46,7 @@ class TimeTest extends TestCase $c->setValue(false); // test unknown timezone - \SimpleSAML\Configuration::loadFromArray(array('timezone' => 'INVALID'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['timezone' => 'INVALID'], '[ARRAY]', 'simplesaml'); try { @Time::initTimezone(); $this->fail('Failed to recognize an invalid timezone.'); @@ -55,12 +55,12 @@ class TimeTest extends TestCase } // test a valid timezone - \SimpleSAML\Configuration::loadFromArray(array('timezone' => $tz), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['timezone' => $tz], '[ARRAY]', 'simplesaml'); @Time::initTimezone(); $this->assertEquals($tz, @date_default_timezone_get()); // make sure initialization happens only once - \SimpleSAML\Configuration::loadFromArray(array('timezone' => 'Europe/Madrid'), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray(['timezone' => 'Europe/Madrid'], '[ARRAY]', 'simplesaml'); @Time::initTimezone(); $this->assertEquals($tz, @date_default_timezone_get()); } @@ -143,7 +143,7 @@ class TimeTest extends TestCase } try { // invalid timestamp - Time::parseDuration('', array()); + Time::parseDuration('', []); $this->fail("Did not fail with invalid timestamp parameter."); } catch (\InvalidArgumentException $e) { $this->assertEquals('Invalid input parameters', $e->getMessage()); diff --git a/tests/lib/SimpleSAML/Utils/XMLTest.php b/tests/lib/SimpleSAML/Utils/XMLTest.php index 4f820a9efa2855fe8dc1a8c625ee17a98825f175..fe3694d131830c7808f4c71b2730e2881b0a3b10 100644 --- a/tests/lib/SimpleSAML/Utils/XMLTest.php +++ b/tests/lib/SimpleSAML/Utils/XMLTest.php @@ -150,7 +150,7 @@ class XMLTest extends TestCase { $dom = new \DOMDocument(); $element = $dom->appendChild(new \DOMElement('root')); - $comment = $element->appendChild(new \DOMComment('')); + $element->appendChild(new \DOMComment('')); XML::getDOMText($element); } @@ -168,7 +168,7 @@ class XMLTest extends TestCase $dom->appendChild($element); $res = XML::getDOMChildren($dom, $name, $namespace_uri); - $expected = array($element); + $expected = [$element]; $this->assertEquals($expected, $res); } @@ -357,12 +357,12 @@ NOWDOC; */ public function testIsValidMetadata() { - Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); $schema = 'saml-schema-metadata-2.0.xsd'; $dom = $this->getMockBuilder('\DOMDocument') - ->setMethods(array('schemaValidate')) + ->setMethods(['schemaValidate']) ->disableOriginalConstructor() ->getMock(); diff --git a/tests/lib/SimpleSAML/XML/ErrorsTest.php b/tests/lib/SimpleSAML/XML/ErrorsTest.php index a6a46f19da67564f78e765bb4865bb1821a6068d..5710650a2a684f6b28d328c9b6efec64378a8b5d 100644 --- a/tests/lib/SimpleSAML/XML/ErrorsTest.php +++ b/tests/lib/SimpleSAML/XML/ErrorsTest.php @@ -51,7 +51,7 @@ class ErrorsTest extends TestCase $error->column = 'col'; $error->message = ' msg '; - $errors = Errors::formatErrors(array($error, $error)); + $errors = Errors::formatErrors([$error, $error]); $this->assertEquals( "level=level,code=code,line=line,col=col,msg=msg\nlevel=level,code=code,line=line,col=col,msg=msg\n", diff --git a/tests/lib/SimpleSAML/XML/ParserTest.php b/tests/lib/SimpleSAML/XML/ParserTest.php index 336ae86f12357fff99e3870873d19bc171807c90..acd2bd9c946d7f7b2329f3c8739a19adb376623b 100644 --- a/tests/lib/SimpleSAML/XML/ParserTest.php +++ b/tests/lib/SimpleSAML/XML/ParserTest.php @@ -96,10 +96,10 @@ XML; { $result = $this ->xml - ->getValueAlternatives(array( + ->getValueAlternatives([ '/Root/Other', '/Root/Value' - ), true) + ], true) ; $this->assertEquals( @@ -117,10 +117,10 @@ XML; { $result = $this ->xml - ->getValueAlternatives(array( + ->getValueAlternatives([ '/Root/Foo', '/Root/Bar' - ), false) + ], false) ; $this->assertEquals( @@ -139,10 +139,10 @@ XML; { $this ->xml - ->getValueAlternatives(array( + ->getValueAlternatives([ '/Root/Foo', '/Root/Bar' - ), true) + ], true) ; } } diff --git a/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php b/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php index b492337f6780387f9125ddac3cea9a9885997fa7..c2e266929c2a254117be5a3fec30f9323944f306 100644 --- a/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php +++ b/tests/lib/SimpleSAML/XML/Shib13/AuthnResponseTest.php @@ -112,10 +112,10 @@ XML; $result = $this->xml->getNameID(); $this->assertEquals( - array( + [ 'Value' => 'NameIdentifier', 'Format' => 'urn:mace:shibboleth:1.0:nameIdentifier', - ), + ], $result ); } diff --git a/tests/lib/SimpleSAML/XML/SignerTest.php b/tests/lib/SimpleSAML/XML/SignerTest.php index 65b0f81cc8606ee640377b54e71bc59371d09706..fda19f8f2aa9cf58fcfba155694bd7bf7e9a135d 100644 --- a/tests/lib/SimpleSAML/XML/SignerTest.php +++ b/tests/lib/SimpleSAML/XML/SignerTest.php @@ -105,13 +105,13 @@ NOWDOC; $this->root = vfsStream::setup( self::ROOTDIRNAME, null, - array( - self::DEFAULTCERTDIR => array( + [ + self::DEFAULTCERTDIR => [ self::PRIVATEKEY => $this->private_key, self::CERTIFICATE1 => $this->certificate1, self::CERTIFICATE2 => $this->certificate2, - ), - ) + ], + ] ); $this->root_directory = vfsStream::url(self::ROOTDIRNAME); @@ -120,19 +120,19 @@ NOWDOC; $this->certificate_file1 = $this->certdir.DIRECTORY_SEPARATOR.self::CERTIFICATE1; $this->certificate_file2 = $this->certdir.DIRECTORY_SEPARATOR.self::CERTIFICATE2; - $this->config = Configuration::loadFromArray(array( + $this->config = Configuration::loadFromArray([ 'certdir' => $this->certdir, - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); } public function tearDown() { - $this->clearInstance($this->config, '\SimpleSAML\Configuration', array()); + $this->clearInstance($this->config, '\SimpleSAML\Configuration', []); } public function testSignerBasic() { - $res = new Signer(array()); + $res = new Signer([]); $this->assertNotNull($res); } @@ -146,7 +146,7 @@ NOWDOC; $doc = new \DOMDocument(); $insertInto = $doc->appendChild(new \DOMElement('insert')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->privatekey_file, null, true); $signer->sign($element, $insertInto); @@ -158,11 +158,11 @@ NOWDOC; private static function getCertificateValue($certificate) { - $replacements = array( + $replacements = [ "-----BEGIN CERTIFICATE-----", "-----END CERTIFICATE-----", "\n", - ); + ]; return str_replace($replacements, "", $certificate); } @@ -176,7 +176,7 @@ NOWDOC; $doc = new \DOMDocument(); $insertInto = $doc->appendChild(new \DOMElement('insert')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->privatekey_file, null, true); $signer->loadCertificate($this->certificate_file1, true); $signer->sign($element, $insertInto); @@ -198,7 +198,7 @@ NOWDOC; $doc = new \DOMDocument(); $insertInto = $doc->appendChild(new \DOMElement('insert')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->privatekey_file, null, true); $signer->loadCertificate($this->certificate_file1, true); $signer->addCertificate($this->certificate_file2, true); @@ -223,7 +223,7 @@ NOWDOC; $doc = new \DOMDocument(); $insertInto = $doc->appendChild(new \DOMElement('insert')); - $signer = new Signer(array()); + $signer = new Signer([]); $this->setExpectedException('\Exception'); $signer->sign($element, $insertInto); diff --git a/tests/lib/SimpleSAML/XML/ValidatorTest.php b/tests/lib/SimpleSAML/XML/ValidatorTest.php index 7887886129c27bd36cd41e7681fb364ca10609f3..bc8a197a604a6264dfc10da7b8458c7a54d8c467 100644 --- a/tests/lib/SimpleSAML/XML/ValidatorTest.php +++ b/tests/lib/SimpleSAML/XML/ValidatorTest.php @@ -147,14 +147,14 @@ NOWDOC; $this->root = vfsStream::setup( self::ROOTDIRNAME, null, - array( - self::DEFAULTCERTDIR => array( + [ + self::DEFAULTCERTDIR => [ self::CA_PRIVATE_KEY => $this->ca_private_key, self::CA_CERTIFICATE => $this->ca_certificate, self::GOOD_PRIVATE_KEY => $this->good_private_key, self::GOOD_CERTIFICATE => $this->good_certificate, - ), - ) + ], + ] ); $this->root_directory = vfsStream::url(self::ROOTDIRNAME); @@ -164,14 +164,14 @@ NOWDOC; $this->good_private_key_file = $this->certdir.DIRECTORY_SEPARATOR.self::GOOD_PRIVATE_KEY; $this->good_certificate_file = $this->certdir.DIRECTORY_SEPARATOR.self::GOOD_CERTIFICATE; - $this->config = Configuration::loadFromArray(array( + $this->config = Configuration::loadFromArray([ 'certdir' => $this->certdir, - ), '[ARRAY]', 'simplesaml'); + ], '[ARRAY]', 'simplesaml'); } public function tearDown() { - $this->clearInstance($this->config, '\SimpleSAML\Configuration', array()); + $this->clearInstance($this->config, '\SimpleSAML\Configuration', []); } public function testValidatorMissingSignature() @@ -192,7 +192,7 @@ NOWDOC; $signature_parent = $doc->appendChild(new \DOMElement('signature_parent')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->good_private_key_file, null, true); $signer->loadCertificate($this->good_certificate_file, true); $signer->sign($node, $signature_parent); @@ -216,7 +216,7 @@ NOWDOC; $signature_parent = $doc->appendChild(new \DOMElement('signature_parent')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->good_private_key_file, null, true); $signer->loadCertificate($this->good_certificate_file, true); $signer->sign($node, $signature_parent); @@ -228,7 +228,7 @@ NOWDOC; $validator = new Validator( $doc, 'node', - array('certFingerprint' => array($fingerprint)) + ['certFingerprint' => [$fingerprint]] ); // Avoiding Validator::class because it's >= PHP 5.5 only @@ -244,13 +244,13 @@ NOWDOC; $signature_parent = $doc->appendChild(new \DOMElement('signature_parent')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->good_private_key_file, null, true); $signer->loadCertificate($this->good_certificate_file, true); $signer->sign($node, $signature_parent); $this->setExpectedException('\Exception'); - new Validator($doc, 'node', array('certFingerprint' => array())); + new Validator($doc, 'node', ['certFingerprint' => []]); } public function testValidateFingerprintSuccess() @@ -262,7 +262,7 @@ NOWDOC; $signature_parent = $doc->appendChild(new \DOMElement('signature_parent')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->good_private_key_file, null, true); $signer->loadCertificate($this->good_certificate_file, true); $signer->sign($node, $signature_parent); @@ -287,7 +287,7 @@ NOWDOC; $signature_parent = $doc->appendChild(new \DOMElement('signature_parent')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->good_private_key_file, null, true); $signer->loadCertificate($this->good_certificate_file, true); $signer->sign($node, $signature_parent); @@ -309,14 +309,14 @@ NOWDOC; $signature_parent = $doc->appendChild(new \DOMElement('signature_parent')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->good_private_key_file, null, true); $signer->sign($node, $signature_parent); $validator = new Validator( $doc, 'node', - array('PEM' => $this->good_certificate) + ['PEM' => $this->good_certificate] ); $result = $validator->isNodeValidated($node); @@ -334,14 +334,14 @@ NOWDOC; $signature_parent = $doc->appendChild(new \DOMElement('signature_parent')); - $signer = new Signer(array()); + $signer = new Signer([]); $signer->loadPrivateKey($this->good_private_key_file, null, true); $signer->sign($node1, $signature_parent); $validator = new Validator( $doc, 'node1', - array('PEM' => $this->good_certificate) + ['PEM' => $this->good_certificate] ); $result = $validator->isNodeValidated($node2); diff --git a/tests/modules/consent/lib/Auth/Process/ConsentTest.php b/tests/modules/consent/lib/Auth/Process/ConsentTest.php index 1e06862d3e8684deca263d92e8879e07c8d736fd..d6b4e8b7158c50feaf7e94ef26f5d7b9c549a2d5 100644 --- a/tests/modules/consent/lib/Auth/Process/ConsentTest.php +++ b/tests/modules/consent/lib/Auth/Process/ConsentTest.php @@ -15,7 +15,8 @@ class ConsentTest extends TestCase { public function setUp() { - $this->config = Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + $this->config = Configuration::loadFromArray(['module.enable' => ['consent' => true]], '[ARRAY]', 'simplesaml'); + \SimpleSAML_Configuration::setPreLoadedConfig($this->config, 'config.php'); } /** @@ -39,82 +40,82 @@ class ConsentTest extends TestCase public function testCheckDisable() { // test consent disable regex with match - $config = array(); + $config = []; // test consent disable with match on specific SP entityid - $request = array( - 'Source' => array( + $request = [ + 'Source' => [ 'entityid' => 'https://idp.example.org', 'metadata-set' => 'saml20-idp-local', - 'consent.disable' => array( + 'consent.disable' => [ 'https://valid.flatstring.example.that.does.not.match', - ), - 'SingleSignOnService' => array( - array( + ], + 'SingleSignOnService' => [ + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://idp.example.org/saml2/idp/SSOService.php', - ), - ), - ), - 'Destination' => array( + ], + ], + ], + 'Destination' => [ // valid entityid equal to the last one in the consent.disable array 'entityid' => 'https://sp.example.org/my-sp', 'metadata-set' => 'saml20-sp-remote', - 'consent.disable' => array( - array('type' => 'regex', 'pattern' => '/invalid/i'), + 'consent.disable' => [ + ['type' => 'regex', 'pattern' => '/invalid/i'], 'https://sp.example.org/my-sp', // accept the SP that has this specific entityid 'https://idp.example.org', - ), - ), + ], + ], 'UserID' => 'jdoe', - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - ), - ); + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + ], + ]; $result = $this->processFilter($config, $request); // the state should NOT have changed because NO consent should be necessary (match) $this->assertEquals($request, $result); // test consent disable with match on SP through regular expression - $request = array( - 'Source' => array( + $request = [ + 'Source' => [ 'entityid' => 'https://idp.example.org', 'metadata-set' => 'saml20-idp-local', - 'consent.disable' => array( - array(), // invalid consent option array should be ignored + 'consent.disable' => [ + [], // invalid consent option array should be ignored 1234, // bad option - array(''), // no type - array('type'=>'invalid'), // invalid consent option type should be ignored - array('type'=>'regex'), // regex consent option without pattern should be ignored - array('type'=>'regex', 'pattern'=>'/.*\.valid.regex\.that\.does\.not\.match.*/i'), + [''], // no type + ['type'=>'invalid'], // invalid consent option type should be ignored + ['type'=>'regex'], // regex consent option without pattern should be ignored + ['type'=>'regex', 'pattern'=>'/.*\.valid.regex\.that\.does\.not\.match.*/i'], // accept any SP that has an entityid that contains the string ".example.org" - array('type'=>'regex', 'pattern'=>'/.*\.example\.org\/.*/i'), - ), - 'SingleSignOnService' => array( - array( + ['type'=>'regex', 'pattern'=>'/.*\.example\.org\/.*/i'], + ], + 'SingleSignOnService' => [ + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://idp.example.org/saml2/idp/SSOService.php', - ), - ), - ), - 'Destination' => array( + ], + ], + ], + 'Destination' => [ 'entityid' => 'https://sp.example.org/my-sp', // sp contains the string ".example.org" 'metadata-set' => 'saml20-sp-remote', - ), + ], 'UserID' => 'jdoe', - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - ), - ); + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + ], + ]; $result = $this->processFilter($config, $request); // the state should NOT have changed because NO consent should be necessary (match) $this->assertEquals($request, $result); // test corner cases - $request['Source']['consent.disable'] = array( + $request['Source']['consent.disable'] = [ 'https://valid.flatstring.example.that.does.not.match', - array('foo' => 'bar'), - ); + ['foo' => 'bar'], + ]; $request['Destination']['consent.disable'] = 1; $result = $this->processFilter($config, $request); // the state should NOT have changed because NO consent should be necessary (match) @@ -123,16 +124,16 @@ class ConsentTest extends TestCase public function testAttributeHashIsConsistentWhenOrderOfValuesChange() { - $attributes1 = array( - 'attribute1' => array('val1', 'val2'), - 'attribute2' => array('val1', 'val2') - ); + $attributes1 = [ + 'attribute1' => ['val1', 'val2'], + 'attribute2' => ['val1', 'val2'] + ]; $attributeHash1 = \SimpleSAML\Module\consent\Auth\Process\Consent::getAttributeHash($attributes1, true); - $attributes2 = array( - 'attribute1' => array('val1', 'val2'), - 'attribute2' => array('val2', 'val1') - ); + $attributes2 = [ + 'attribute1' => ['val1', 'val2'], + 'attribute2' => ['val2', 'val1'] + ]; $attributeHash2 = \SimpleSAML\Module\consent\Auth\Process\Consent::getAttributeHash($attributes2, true); $this->assertEquals($attributeHash1, $attributeHash2, "Hash is not the same when the order of values changes"); @@ -140,16 +141,16 @@ class ConsentTest extends TestCase public function testAttributeHashIsConsistentWhenOrderOfAttributesChange() { - $attributes1 = array( - 'attribute2' => array('val1', 'val2'), - 'attribute1' => array('val1', 'val2') - ); + $attributes1 = [ + 'attribute2' => ['val1', 'val2'], + 'attribute1' => ['val1', 'val2'] + ]; $attributeHash1 = \SimpleSAML\Module\consent\Auth\Process\Consent::getAttributeHash($attributes1, true); - $attributes2 = array( - 'attribute1' => array('val1', 'val2'), - 'attribute2' => array('val1', 'val2') - ); + $attributes2 = [ + 'attribute1' => ['val1', 'val2'], + 'attribute2' => ['val1', 'val2'] + ]; $attributeHash2 = \SimpleSAML\Module\consent\Auth\Process\Consent::getAttributeHash($attributes2, true); $this->assertEquals( @@ -161,16 +162,16 @@ class ConsentTest extends TestCase public function testAttributeHashIsConsistentWithoutValuesWhenOrderOfAttributesChange() { - $attributes1 = array( - 'attribute2' => array('val1', 'val2'), - 'attribute1' => array('val1', 'val2') - ); + $attributes1 = [ + 'attribute2' => ['val1', 'val2'], + 'attribute1' => ['val1', 'val2'] + ]; $attributeHash1 = \SimpleSAML\Module\consent\Auth\Process\Consent::getAttributeHash($attributes1); - $attributes2 = array( - 'attribute1' => array('val1', 'val2'), - 'attribute2' => array('val1', 'val2') - ); + $attributes2 = [ + 'attribute1' => ['val1', 'val2'], + 'attribute2' => ['val1', 'val2'] + ]; $attributeHash2 = \SimpleSAML\Module\consent\Auth\Process\Consent::getAttributeHash($attributes2); $this->assertEquals( @@ -184,34 +185,34 @@ class ConsentTest extends TestCase { $reflection = new \ReflectionClass('\SimpleSAML\Module\consent\Auth\Process\Consent'); - foreach (array( - '_includeValues', '_checked', '_focus', '_hiddenAttributes', '_noconsentattributes', '_showNoConsentAboutService' - ) as $v) { + foreach ([ + 'includeValues', 'checked', 'focus', 'hiddenAttributes', 'noconsentattributes', 'showNoConsentAboutService' + ] as $v) { $instanceVars[$v] = $reflection->getProperty($v); $instanceVars[$v]->setAccessible(true); } /* these just need to be different to the default values */ - $config = array( + $config = [ 'includeValues' => true, 'checked' => true, 'focus' => 'yes', - 'hiddenAttributes' => array('attribute1', 'attribute2'), - 'attributes.exclude' => array('attribute1', 'attribute2'), + 'hiddenAttributes' => ['attribute1', 'attribute2'], + 'attributes.exclude' => ['attribute1', 'attribute2'], 'showNoConsentAboutService' => false, - ); + ]; $testcase = $reflection->newInstance($config, null); - $this->assertEquals($instanceVars['_includeValues']->getValue($testcase), $config['includeValues']); - $this->assertEquals($instanceVars['_checked']->getValue($testcase), $config['checked']); - $this->assertEquals($instanceVars['_focus']->getValue($testcase), $config['focus']); - $this->assertEquals($instanceVars['_hiddenAttributes']->getValue($testcase), $config['hiddenAttributes']); - $this->assertEquals($instanceVars['_noconsentattributes']->getValue($testcase), $config['attributes.exclude']); - $this->assertEquals($instanceVars['_showNoConsentAboutService']->getValue($testcase), $config['showNoConsentAboutService']); + $this->assertEquals($instanceVars['includeValues']->getValue($testcase), $config['includeValues']); + $this->assertEquals($instanceVars['checked']->getValue($testcase), $config['checked']); + $this->assertEquals($instanceVars['focus']->getValue($testcase), $config['focus']); + $this->assertEquals($instanceVars['hiddenAttributes']->getValue($testcase), $config['hiddenAttributes']); + $this->assertEquals($instanceVars['noconsentattributes']->getValue($testcase), $config['attributes.exclude']); + $this->assertEquals($instanceVars['showNoConsentAboutService']->getValue($testcase), $config['showNoConsentAboutService']); - $deprecated = $reflection->newInstance(array('noconsentattributes' => $config['attributes.exclude'],), null); - $this->assertEquals($instanceVars['_noconsentattributes']->getValue($deprecated), $config['attributes.exclude']); + $deprecated = $reflection->newInstance(['noconsentattributes' => $config['attributes.exclude'],], null); + $this->assertEquals($instanceVars['noconsentattributes']->getValue($deprecated), $config['attributes.exclude']); } } diff --git a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php index deabdd3d210f596678284e80806dbac91275d422..c84fbc95e14e36bb95c2b05f2ea3c96b17354652 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php @@ -27,16 +27,16 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testBasic() { - $config = array( - 'test' => array('value1', 'value2'), - ); - $request = array( - 'Attributes' => array(), - ); + $config = [ + 'test' => ['value1', 'value2'], + ]; + $request = [ + 'Attributes' => [], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test', $attributes); - $this->assertEquals($attributes['test'], array('value1', 'value2')); + $this->assertEquals($attributes['test'], ['value1', 'value2']); } /** @@ -44,23 +44,23 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testExistingNotModified() { - $config = array( - 'test' => array('value1', 'value2'), - ); - $request = array( - 'Attributes' => array( - 'original1' => array('original_value1'), - 'original2' => array('original_value2'), - ), - ); + $config = [ + 'test' => ['value1', 'value2'], + ]; + $request = [ + 'Attributes' => [ + 'original1' => ['original_value1'], + 'original2' => ['original_value2'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test', $attributes); - $this->assertEquals($attributes['test'], array('value1', 'value2')); + $this->assertEquals($attributes['test'], ['value1', 'value2']); $this->assertArrayHasKey('original1', $attributes); - $this->assertEquals($attributes['original1'], array('original_value1')); + $this->assertEquals($attributes['original1'], ['original_value1']); $this->assertArrayHasKey('original2', $attributes); - $this->assertEquals($attributes['original2'], array('original_value2')); + $this->assertEquals($attributes['original2'], ['original_value2']); } /** @@ -68,16 +68,16 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testStringValue() { - $config = array( + $config = [ 'test' => 'value', - ); - $request = array( - 'Attributes' => array(), - ); + ]; + $request = [ + 'Attributes' => [], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test', $attributes); - $this->assertEquals($attributes['test'], array('value')); + $this->assertEquals($attributes['test'], ['value']); } /** @@ -85,19 +85,19 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testAddMultiple() { - $config = array( - 'test1' => array('value1'), - 'test2' => array('value2'), - ); - $request = array( - 'Attributes' => array(), - ); + $config = [ + 'test1' => ['value1'], + 'test2' => ['value2'], + ]; + $request = [ + 'Attributes' => [], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test1', $attributes); - $this->assertEquals($attributes['test1'], array('value1')); + $this->assertEquals($attributes['test1'], ['value1']); $this->assertArrayHasKey('test2', $attributes); - $this->assertEquals($attributes['test2'], array('value2')); + $this->assertEquals($attributes['test2'], ['value2']); } /** @@ -105,17 +105,17 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testAppend() { - $config = array( - 'test' => array('value2'), - ); - $request = array( - 'Attributes' => array( - 'test' => array('value1'), - ), - ); + $config = [ + 'test' => ['value2'], + ]; + $request = [ + 'Attributes' => [ + 'test' => ['value1'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['test'], array('value1', 'value2')); + $this->assertEquals($attributes['test'], ['value1', 'value2']); } /** @@ -123,18 +123,18 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testReplace() { - $config = array( + $config = [ '%replace', - 'test' => array('value2'), - ); - $request = array( - 'Attributes' => array( - 'test' => array('value1'), - ), - ); + 'test' => ['value2'], + ]; + $request = [ + 'Attributes' => [ + 'test' => ['value1'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['test'], array('value2')); + $this->assertEquals($attributes['test'], ['value2']); } /** @@ -144,16 +144,16 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testWrongFlag() { - $config = array( + $config = [ '%nonsense', - 'test' => array('value2'), - ); - $request = array( - 'Attributes' => array( - 'test' => array('value1'), - ), - ); - $result = self::processFilter($config, $request); + 'test' => ['value2'], + ]; + $request = [ + 'Attributes' => [ + 'test' => ['value1'], + ], + ]; + self::processFilter($config, $request); } /** @@ -163,15 +163,15 @@ class Test_Core_Auth_Process_AttributeAdd extends TestCase */ public function testWrongAttributeValue() { - $config = array( + $config = [ '%replace', - 'test' => array(true), - ); - $request = array( - 'Attributes' => array( - 'test' => array('value1'), - ), - ); - $result = self::processFilter($config, $request); + 'test' => [true], + ]; + $request = [ + 'Attributes' => [ + 'test' => ['value1'], + ], + ]; + self::processFilter($config, $request); } } diff --git a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php index d59522cba870bb66f6ac551e7575745137c86ad5..45421547057821896c038fe6a8e7ab001c42930c 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php @@ -27,22 +27,22 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testBasic() { - $config = array( + $config = [ 'subject' => 'test', 'pattern' => '/wrong/', 'replacement' => 'right', - ); + ]; - $request = array( - 'Attributes' => array( - 'test' => array('somethingiswrong'), - ), - ); + $request = [ + 'Attributes' => [ + 'test' => ['somethingiswrong'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test', $attributes); - $this->assertEquals($attributes['test'], array('somethingisright')); + $this->assertEquals($attributes['test'], ['somethingisright']); } /** @@ -50,25 +50,25 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testWithTarget() { - $config = array( + $config = [ 'subject' => 'test', 'target' => 'test2', 'pattern' => '/wrong/', 'replacement' => 'right', - ); + ]; - $request = array( - 'Attributes' => array( - 'something' => array('somethingelse'), - 'test' => array('wrong'), - ), - ); + $request = [ + 'Attributes' => [ + 'something' => ['somethingelse'], + 'test' => ['wrong'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test2', $attributes); - $this->assertEquals($attributes['test'], array('wrong')); - $this->assertEquals($attributes['test2'], array('right')); + $this->assertEquals($attributes['test'], ['wrong']); + $this->assertEquals($attributes['test2'], ['right']); } /** @@ -76,24 +76,24 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testNomatch() { - $config = array( + $config = [ 'subject' => 'test', 'pattern' => '/wrong/', 'replacement' => 'right', - ); + ]; - $request = array( - 'Attributes' => array( - 'something' => array('somevalue'), - 'somethingelse' => array('someothervalue'), - ), - ); + $request = [ + 'Attributes' => [ + 'something' => ['somevalue'], + 'somethingelse' => ['someothervalue'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertEquals($attributes, - array('something' => array('somevalue'), - 'somethingelse' => array('someothervalue'))); + ['something' => ['somevalue'], + 'somethingelse' => ['someothervalue']]); } /** @@ -101,20 +101,20 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testReplaceMatch() { - $config = array( + $config = [ 'subject' => 'source', 'pattern' => '/wrong/', 'replacement' => 'right', '%replace', - ); - $request = array( - 'Attributes' => array( - 'source' => array('wrongthing'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'source' => ['wrongthing'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['source'], array('right')); + $this->assertEquals($attributes['source'], ['right']); } /** @@ -122,22 +122,22 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testReplaceMatchWithTarget() { - $config = array( + $config = [ 'subject' => 'source', 'pattern' => '/wrong/', 'replacement' => 'right', 'target' => 'test', '%replace', - ); - $request = array( - 'Attributes' => array( - 'source' => array('wrong'), - 'test' => array('wrong'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'source' => ['wrong'], + 'test' => ['wrong'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['test'], array('right')); + $this->assertEquals($attributes['test'], ['right']); } /** @@ -145,22 +145,22 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testReplaceNoMatch() { - $config = array( + $config = [ 'subject' => 'test', 'pattern' => '/doink/', 'replacement' => 'wrong', 'target' => 'test', '%replace', - ); - $request = array( - 'Attributes' => array( - 'source' => array('wrong'), - 'test' => array('right'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'source' => ['wrong'], + 'test' => ['right'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['test'], array('right')); + $this->assertEquals($attributes['test'], ['right']); } /** @@ -170,21 +170,21 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testRemoveMatch() { - $config = array( + $config = [ 'subject' => 'eduPersonAffiliation', 'pattern' => '/^emper/', '%remove', - ); - $request = array( - 'Attributes' => array( - 'displayName' => array('emperor kuzco'), - 'eduPersonAffiliation' => array('member', 'emperor', 'staff'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'displayName' => ['emperor kuzco'], + 'eduPersonAffiliation' => ['member', 'emperor', 'staff'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['displayName'], array('emperor kuzco')); - $this->assertEquals($attributes['eduPersonAffiliation'], array(0 => 'member', 2 => 'staff')); + $this->assertEquals($attributes['displayName'], ['emperor kuzco']); + $this->assertEquals($attributes['eduPersonAffiliation'], [0 => 'member', 2 => 'staff']); } /** @@ -192,17 +192,17 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testRemoveMatchAll() { - $config = array( + $config = [ 'subject' => 'eduPersonAffiliation', 'pattern' => '/^emper/', '%remove', - ); - $request = array( - 'Attributes' => array( - 'displayName' => array('emperor kuzco'), - 'eduPersonAffiliation' => array('emperess', 'emperor'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'displayName' => ['emperor kuzco'], + 'eduPersonAffiliation' => ['emperess', 'emperor'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes); @@ -215,17 +215,17 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testWrongConfig() { - $config = array( + $config = [ 'subject' => 'eduPersonAffiliation', 'pattern' => '/^emper/', '%dwiw', - ); - $request = array( - 'Attributes' => array( - 'eduPersonAffiliation' => array('emperess', 'emperor'), - ), - ); - $result = self::processFilter($config, $request); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonAffiliation' => ['emperess', 'emperor'], + ], + ]; + self::processFilter($config, $request); } /** @@ -235,15 +235,15 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testIncompleteConfig() { - $config = array( + $config = [ 'subject' => 'eduPersonAffiliation', - ); - $request = array( - 'Attributes' => array( - 'eduPersonAffiliation' => array('emperess', 'emperor'), - ), - ); - $result = self::processFilter($config, $request); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonAffiliation' => ['emperess', 'emperor'], + ], + ]; + self::processFilter($config, $request); } /** @@ -253,23 +253,17 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testIncompleteConfig2() { - $config = array( + $config = [ 'subject' => 'test', 'pattern' => '/wrong/', - ); - - $request = array( - 'Attributes' => array( - 'test' => array('somethingiswrong'), - ), - ); - - $request = array( - 'Attributes' => array( - 'eduPersonAffiliation' => array('emperess', 'emperor'), - ), - ); - $result = self::processFilter($config, $request); + ]; + + $request = [ + 'Attributes' => [ + 'eduPersonAffiliation' => ['emperess', 'emperor'], + ], + ]; + self::processFilter($config, $request); } /** @@ -279,25 +273,19 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testIncompleteConfig3() { - $config = array( + $config = [ 'subject' => 'test', 'pattern' => '/wrong/', '%replace', '%remove', - ); - - $request = array( - 'Attributes' => array( - 'test' => array('somethingiswrong'), - ), - ); - - $request = array( - 'Attributes' => array( - 'eduPersonAffiliation' => array('emperess', 'emperor'), - ), - ); - $result = self::processFilter($config, $request); + ]; + + $request = [ + 'Attributes' => [ + 'eduPersonAffiliation' => ['emperess', 'emperor'], + ], + ]; + self::processFilter($config, $request); } /** @@ -307,25 +295,19 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testIncompleteConfig4() { - $config = array( + $config = [ 'subject' => 'test', 'pattern' => '/wrong/', 'target' => 'test2', '%remove', - ); - - $request = array( - 'Attributes' => array( - 'test' => array('somethingiswrong'), - ), - ); - - $request = array( - 'Attributes' => array( - 'eduPersonAffiliation' => array('emperess', 'emperor'), - ), - ); - $result = self::processFilter($config, $request); + ]; + + $request = [ + 'Attributes' => [ + 'eduPersonAffiliation' => ['emperess', 'emperor'], + ], + ]; + self::processFilter($config, $request); } @@ -336,23 +318,17 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase */ public function testIncompleteConfig5() { - $config = array( + $config = [ 'subject' => 'test', 'pattern' => '/wrong/', 'replacement' => null, - ); - - $request = array( - 'Attributes' => array( - 'test' => array('somethingiswrong'), - ), - ); + ]; - $request = array( - 'Attributes' => array( - 'eduPersonAffiliation' => array('emperess', 'emperor'), - ), - ); + $request = [ + 'Attributes' => [ + 'eduPersonAffiliation' => ['emperess', 'emperor'], + ], + ]; $result = self::processFilter($config, $request); } } diff --git a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php index 52f03613cffebdcc1eee49bf3b4b6504d0d3aa59..cedd9432219d948c7fc97d9d95b1475a21cccc8d 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php @@ -27,17 +27,17 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ public function testBasic() { - $config = array( + $config = [ 'test' => 'testnew', - ); - $request = array( - 'Attributes' => array('test' => array('AAP')), - ); + ]; + $request = [ + 'Attributes' => ['test' => ['AAP']], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test', $attributes); $this->assertArrayHasKey('testnew', $attributes); - $this->assertEquals($attributes['testnew'], array('AAP')); + $this->assertEquals($attributes['testnew'], ['AAP']); } /** @@ -45,19 +45,19 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ public function testArray() { - $config = array( - 'test' => array('new1','new2'), - ); - $request = array( - 'Attributes' => array('test' => array('AAP')), - ); + $config = [ + 'test' => ['new1','new2'], + ]; + $request = [ + 'Attributes' => ['test' => ['AAP']], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('test', $attributes); $this->assertArrayHasKey('new1', $attributes); $this->assertArrayHasKey('new2', $attributes); - $this->assertEquals($attributes['new1'], array('AAP')); - $this->assertEquals($attributes['new2'], array('AAP')); + $this->assertEquals($attributes['new1'], ['AAP']); + $this->assertEquals($attributes['new2'], ['AAP']); } /** @@ -65,24 +65,24 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ public function testExistingNotModified() { - $config = array( + $config = [ 'test' => 'testnew', - ); - $request = array( - 'Attributes' => array( - 'test' => array('AAP'), - 'original1' => array('original_value1'), - 'original2' => array('original_value2'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'test' => ['AAP'], + 'original1' => ['original_value1'], + 'original2' => ['original_value2'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('testnew', $attributes); - $this->assertEquals($attributes['test'], array('AAP')); + $this->assertEquals($attributes['test'], ['AAP']); $this->assertArrayHasKey('original1', $attributes); - $this->assertEquals($attributes['original1'], array('original_value1')); + $this->assertEquals($attributes['original1'], ['original_value1']); $this->assertArrayHasKey('original2', $attributes); - $this->assertEquals($attributes['original2'], array('original_value2')); + $this->assertEquals($attributes['original2'], ['original_value2']); } /** @@ -90,19 +90,19 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ public function testCopyMultiple() { - $config = array( + $config = [ 'test1' => 'new1', 'test2' => 'new2', - ); - $request = array( - 'Attributes' => array('test1' => array('val1'), 'test2' => array('val2.1','val2.2')), - ); + ]; + $request = [ + 'Attributes' => ['test1' => ['val1'], 'test2' => ['val2.1','val2.2']], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('new1', $attributes); - $this->assertEquals($attributes['new1'], array('val1')); + $this->assertEquals($attributes['new1'], ['val1']); $this->assertArrayHasKey('new2', $attributes); - $this->assertEquals($attributes['new2'], array('val2.1','val2.2')); + $this->assertEquals($attributes['new2'], ['val2.1','val2.2']); } /** @@ -110,18 +110,18 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ public function testCopyClash() { - $config = array( + $config = [ 'test' => 'new1', - ); - $request = array( - 'Attributes' => array( - 'test' => array('testvalue1'), - 'new1' => array('newvalue1'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'test' => ['testvalue1'], + 'new1' => ['newvalue1'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['new1'], array('testvalue1')); + $this->assertEquals($attributes['new1'], ['testvalue1']); } /** @@ -131,15 +131,15 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ public function testWrongAttributeName() { - $config = array( - array('value2'), - ); - $request = array( - 'Attributes' => array( - 'test' => array('value1'), - ), - ); - $result = self::processFilter($config, $request); + $config = [ + ['value2'], + ]; + $request = [ + 'Attributes' => [ + 'test' => ['value1'], + ], + ]; + self::processFilter($config, $request); } /** @@ -149,14 +149,14 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ public function testWrongAttributeValue() { - $config = array( + $config = [ 'test' => 100, - ); - $request = array( - 'Attributes' => array( - 'test' => array('value1'), - ), - ); - $result = self::processFilter($config, $request); + ]; + $request = [ + 'Attributes' => [ + 'test' => ['value1'], + ], + ]; + self::processFilter($config, $request); } } diff --git a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php index fc55240f9f9e1b88cf71390973b06eb773346b98..9bc2260cea3e266123abb56939417f0a8c83fd3c 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php @@ -26,23 +26,23 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testIdPAttrs() { - $config = array( + $config = [ 'cn', 'mail' - ); - - $request = array( - 'Attributes' => array( - 'eduPersonTargetedID' => array('eptid@example.org'), - 'eduPersonAffiliation' => array('member'), - 'cn' => array('user name'), - 'mail' => array('user@example.org'), - ), - 'Destination' => array( - ), - 'Source' => array( - 'attributes' => array('cn','mail'), - ), - ); + ]; + + $request = [ + 'Attributes' => [ + 'eduPersonTargetedID' => ['eptid@example.org'], + 'eduPersonAffiliation' => ['member'], + 'cn' => ['user name'], + 'mail' => ['user@example.org'], + ], + 'Destination' => [ + ], + 'Source' => [ + 'attributes' => ['cn','mail'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; @@ -52,10 +52,10 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes); $this->assertCount(2, $attributes); - $config = array( + $config = [ 'cn', 'default' => TRUE, - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; @@ -73,22 +73,22 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testNULLMetadataAttrs() { - $config = array( + $config = [ 'cn', 'mail' - ); - - $request = array( - 'Attributes' => array( - 'eduPersonTargetedID' => array('eptid@example.org'), - 'eduPersonAffiliation' => array('member'), - 'cn' => array('user name'), - 'mail' => array('user@example.org'), - ), - 'Destination' => array( - ), - 'Source' => array( - ), - ); + ]; + + $request = [ + 'Attributes' => [ + 'eduPersonTargetedID' => ['eptid@example.org'], + 'eduPersonAffiliation' => ['member'], + 'cn' => ['user name'], + 'mail' => ['user@example.org'], + ], + 'Destination' => [ + ], + 'Source' => [ + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; @@ -98,10 +98,10 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes); $this->assertCount(2, $attributes); - $config = array( + $config = [ 'cn', 'default' => TRUE, - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; @@ -111,8 +111,8 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes); $this->assertCount(1, $attributes); - $config = array( - ); + $config = [ + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; @@ -131,19 +131,19 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public static function setUpBeforeClass() { - self::$request = array( - 'Attributes' => array( - 'eduPersonTargetedID' => array('eptid@example.org'), - 'eduPersonAffiliation' => array('member'), - 'cn' => array('common name'), - 'mail' => array('user@example.org'), - ), - 'Destination' => array( - 'attributes' => array('cn','mail'), - ), - 'Source' => array( - ), - ); + self::$request = [ + 'Attributes' => [ + 'eduPersonTargetedID' => ['eptid@example.org'], + 'eduPersonAffiliation' => ['member'], + 'cn' => ['common name'], + 'mail' => ['user@example.org'], + ], + 'Destination' => [ + 'attributes' => ['cn','mail'], + ], + 'Source' => [ + ], + ]; } /** @@ -151,9 +151,9 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testBasic() { - $config = array( + $config = [ 'cn', 'mail' - ); + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; @@ -167,9 +167,9 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testDefaultWithMetadata() { - $config = array( + $config = [ 'default' => TRUE, - ); + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; @@ -183,10 +183,10 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testDefaultWithAttrs() { - $config = array( + $config = [ 'default' => TRUE, 'eduPersonTargetedID', 'eduPersonAffiliation', - ); + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; @@ -204,11 +204,11 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testInvalidConfig() { - $config = array( + $config = [ 'invalidArg' => TRUE, - ); + ]; - $result = self::processFilter($config, self::$request); + self::processFilter($config, self::$request); } /** @@ -218,11 +218,11 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testInvalidAttributeName() { - $config = array( + $config = [ null - ); + ]; - $result = self::processFilter($config, self::$request); + self::processFilter($config, self::$request); } @@ -231,36 +231,36 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testMatchAttributeValues() { - $config = array( - 'eduPersonAffiliation' => array('member') - ); + $config = [ + 'eduPersonAffiliation' => ['member'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('member')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); - $config = array( - 'eduPersonAffiliation' => array('member','staff') - ); + $config = [ + 'eduPersonAffiliation' => ['member','staff'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('member')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); - $config = array( - 'eduPersonAffiliation' => array('student') - ); + $config = [ + 'eduPersonAffiliation' => ['student'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); - $config = array( - 'eduPersonAffiliation' => array('student','staff') - ); + $config = [ + 'eduPersonAffiliation' => ['student','staff'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); @@ -269,10 +269,10 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testBadOptionsNotTreatedAsValidValues() { // Ensure really misconfigured ignoreCase and regex options are not interpretted as valid valus - $config = array( - 'eduPersonAffiliation' => array('ignoreCase' => 'member', 'nomatch'), - 'mail' => array('regex' => 'user@example.org', 'nomatch') - ); + $config = [ + 'eduPersonAffiliation' => ['ignoreCase' => 'member', 'nomatch'], + 'mail' => ['regex' => 'user@example.org', 'nomatch'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); @@ -283,16 +283,16 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase * php and matched against an attribute value of '1' */ public function testThatIgnoreCaseOptionNotMatchBooleanAsStringValue() { - $config = array( - 'someAttribute' => array('ignoreCase' => true, 'someValue') - ); + $config = [ + 'someAttribute' => ['ignoreCase' => true, 'someValue'] + ]; - $request = array( - 'Attributes' => array( - 'someAttribute' => array('1'), //boolean true as a string + $request = [ + 'Attributes' => [ + 'someAttribute' => ['1'], //boolean true as a string - ), - ); + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); @@ -303,36 +303,36 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testMatchAttributeValuesIgnoreCase() { - $config = array( - 'eduPersonAffiliation' => array('ignoreCase' => true, 'meMber') - ); + $config = [ + 'eduPersonAffiliation' => ['ignoreCase' => true, 'meMber'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('member')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); - $config = array( - 'eduPersonAffiliation' => array('ignoreCase' => true, 'membeR','sTaff') - ); + $config = [ + 'eduPersonAffiliation' => ['ignoreCase' => true, 'membeR','sTaff'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('member')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); - $config = array( - 'eduPersonAffiliation' => array('ignoreCase' => true, 'Student') - ); + $config = [ + 'eduPersonAffiliation' => ['ignoreCase' => true, 'Student'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); - $config = array( - 'eduPersonAffiliation' => array('ignoreCase' => true, 'studeNt','sTaff') - ); + $config = [ + 'eduPersonAffiliation' => ['ignoreCase' => true, 'studeNt','sTaff'] + ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); @@ -344,93 +344,93 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testMatchAttributeValuesRegex() { // SSP Logger requires a configuration to be set. - \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); $state = self::$request; - $state['Attributes']['eduPersonEntitlement'] = array( + $state['Attributes']['eduPersonEntitlement'] = [ 'urn:mace:example.terena.org:tcs:personal-user', 'urn:x-surfnet:surfdomeinen.nl:role:dnsadmin', 'urn:x-surfnet:surf.nl:surfdrive:quota:100', '1' //boolean true as a string - ); + ]; - $config = array( - 'eduPersonEntitlement' => array( + $config = [ + 'eduPersonEntitlement' => [ 'regex' => true, '/^urn:x-surfnet:surf/' - ) - ); + ] + ]; $result = self::processFilter($config, $state); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonEntitlement', $attributes); $this->assertEquals( - array('urn:x-surfnet:surfdomeinen.nl:role:dnsadmin', 'urn:x-surfnet:surf.nl:surfdrive:quota:100'), + ['urn:x-surfnet:surfdomeinen.nl:role:dnsadmin', 'urn:x-surfnet:surf.nl:surfdrive:quota:100'], $attributes['eduPersonEntitlement'] ); // Matching multiple lines shouldn't duplicate the attribute - $config = array( - 'eduPersonEntitlement' => array( + $config = [ + 'eduPersonEntitlement' => [ 'regex' => true, '/urn:x-surfnet:surf/', '/urn:x-surfnet/' - ) - ); + ] + ]; $result = self::processFilter($config, $state); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonEntitlement', $attributes); $this->assertEquals( - array('urn:x-surfnet:surfdomeinen.nl:role:dnsadmin', 'urn:x-surfnet:surf.nl:surfdrive:quota:100'), + ['urn:x-surfnet:surfdomeinen.nl:role:dnsadmin', 'urn:x-surfnet:surf.nl:surfdrive:quota:100'], $attributes['eduPersonEntitlement'] ); // Invalid and no-match regex expressions should not stop a valid regex from matching - $config = array( - 'eduPersonEntitlement' => array( + $config = [ + 'eduPersonEntitlement' => [ 'regex' => true, '/urn:mace:example.terena.org:tcs:no-match/', '$invalidRegex[', '/^URN:x-surf.*SURF.*n$/i' - ) - ); + ] + ]; $result = self::processFilter($config, $state); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonEntitlement', $attributes); $this->assertEquals( - array('urn:x-surfnet:surfdomeinen.nl:role:dnsadmin'), + ['urn:x-surfnet:surfdomeinen.nl:role:dnsadmin'], $attributes['eduPersonEntitlement'] ); // No matches should remove attribute - $config = array( - 'eduPersonEntitlement' => array( + $config = [ + 'eduPersonEntitlement' => [ 'regex' => true, '/urn:x-no-match/' - ) - ); + ] + ]; $result = self::processFilter($config, $state); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); // A regex that matches an input value multiple times should work. - $config = array( - 'eduPersonEntitlement' => array( + $config = [ + 'eduPersonEntitlement' => [ 'regex' => true, '/surf/' - ) - ); + ] + ]; $result = self::processFilter($config, $state); $attributes = $result['Attributes']; $this->assertCount(1, $attributes); $this->assertArrayHasKey('eduPersonEntitlement', $attributes); $this->assertEquals( - array('urn:x-surfnet:surfdomeinen.nl:role:dnsadmin', 'urn:x-surfnet:surf.nl:surfdrive:quota:100'), + ['urn:x-surfnet:surfdomeinen.nl:role:dnsadmin', 'urn:x-surfnet:surf.nl:surfdrive:quota:100'], $attributes['eduPersonEntitlement'] ); } @@ -445,26 +445,26 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testMatchAttributeValuesNotArray() { - $config = array( - ); - - $request = array( - 'Attributes' => array( - 'eduPersonTargetedID' => array('eptid@example.org'), - 'eduPersonAffiliation' => array('member'), - 'cn' => array('user name'), - 'mail' => array('user@example.org'), - 'discardme' => array('somethingiswrong'), - ), - 'Destination' => array( - 'attributes' => array('eduPersonAffiliation' => 'student'), - ), - 'Source' => array( - ), - ); - - - $result = self::processFilter($config, $request); + $config = [ + ]; + + $request = [ + 'Attributes' => [ + 'eduPersonTargetedID' => ['eptid@example.org'], + 'eduPersonAffiliation' => ['member'], + 'cn' => ['user name'], + 'mail' => ['user@example.org'], + 'discardme' => ['somethingiswrong'], + ], + 'Destination' => [ + 'attributes' => ['eduPersonAffiliation' => 'student'], + ], + 'Source' => [ + ], + ]; + + + self::processFilter($config, $request); } /** @@ -472,24 +472,24 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ public function testNoIntersection() { - $config = array( + $config = [ 'default' => TRUE, - ); - - $request = array( - 'Attributes' => array( - 'eduPersonTargetedID' => array('eptid@example.org'), - 'eduPersonAffiliation' => array('member'), - 'cn' => array('user name'), - 'mail' => array('user@example.org'), - 'discardme' => array('somethingiswrong'), - ), - 'Destination' => array( - 'attributes' => array('urn:oid:1.2.840.113549.1.9.1'), - ), - 'Source' => array( - ), - ); + ]; + + $request = [ + 'Attributes' => [ + 'eduPersonTargetedID' => ['eptid@example.org'], + 'eduPersonAffiliation' => ['member'], + 'cn' => ['user name'], + 'mail' => ['user@example.org'], + 'discardme' => ['somethingiswrong'], + ], + 'Destination' => [ + 'attributes' => ['urn:oid:1.2.840.113549.1.9.1'], + ], + 'Source' => [ + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; diff --git a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php index 75ea9441a31e7a4b78db68cbc45e4bea17030b0f..9821cf275432cb06f2089d83ed03b7e6d053bcd2 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php @@ -27,16 +27,16 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase */ public function testBasic() { - $config = array( - ); - $request = array( - 'Attributes' => array(), + $config = [ + ]; + $request = [ + 'Attributes' => [], 'UserID' => 'user2@example.org', - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('realm', $attributes); - $this->assertEquals($attributes['realm'], array('example.org')); + $this->assertEquals($attributes['realm'], ['example.org']); } /** @@ -46,12 +46,12 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase */ public function testNoUserID() { - $config = array( - ); - $request = array( - 'Attributes' => array(), - ); - $result = self::processFilter($config, $request); + $config = [ + ]; + $request = [ + 'Attributes' => [], + ]; + self::processFilter($config, $request); } /** @@ -59,21 +59,21 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase */ public function testAttributeNameConfig() { - $config = array( + $config = [ 'attributename' => 'schacHomeOrganization', - ); - $request = array( - 'Attributes' => array( + ]; + $request = [ + 'Attributes' => [ 'displayName' => 'Joe User', 'schacGender' => 9, - ), + ], 'UserID' => 'user2@example.org', - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('schacHomeOrganization', $attributes); $this->assertArrayHasKey('displayName', $attributes); - $this->assertEquals($attributes['schacHomeOrganization'], array('example.org')); + $this->assertEquals($attributes['schacHomeOrganization'], ['example.org']); } /** @@ -81,21 +81,21 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase */ public function testTargetAttributeOverwritten() { - $config = array( + $config = [ 'attributename' => 'schacHomeOrganization', - ); - $request = array( - 'Attributes' => array( + ]; + $request = [ + 'Attributes' => [ 'displayName' => 'Joe User', 'schacGender' => 9, 'schacHomeOrganization' => 'example.com', - ), + ], 'UserID' => 'user2@example.org', - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('schacHomeOrganization', $attributes); - $this->assertEquals($attributes['schacHomeOrganization'], array('example.org')); + $this->assertEquals($attributes['schacHomeOrganization'], ['example.org']); } /** @@ -103,13 +103,13 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase */ public function testNoAtisNoOp() { - $config = array(); - $request = array( - 'Attributes' => array( + $config = []; + $request = [ + 'Attributes' => [ 'displayName' => 'Joe User', - ), + ], 'UserID' => 'user2', - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayNotHasKey('realm', $attributes); @@ -120,13 +120,13 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase */ public function testMultiAtisNoOp() { - $config = array(); - $request = array( - 'Attributes' => array( + $config = []; + $request = [ + 'Attributes' => [ 'displayName' => 'Joe User', - ), + ], 'UserID' => 'user2@home@example.org', - ); + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayNotHasKey('realm', $attributes); diff --git a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php index a6d601f06bfa821ab68f514fd471d1f37a8a4a47..23904bd67cdbb02cb583ab8411d3b2c5cbbae60d 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php @@ -34,26 +34,26 @@ class AttributeValueMapTest extends TestCase */ public function testBasic() { - $config = array( + $config = [ 'sourceattribute' => 'memberOf', 'targetattribute' => 'eduPersonAffiliation', - 'values' => array( - 'member' => array( + 'values' => [ + 'member' => [ 'theGroup', 'otherGroup', - ), - ), - ); - $request = array( - 'Attributes' => array( - 'memberOf' => array('theGroup'), - ), - ); + ], + ], + ]; + $request = [ + 'Attributes' => [ + 'memberOf' => ['theGroup'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayNotHasKey('memberOf', $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('member')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); } @@ -65,27 +65,27 @@ class AttributeValueMapTest extends TestCase */ public function testNoDuplicates() { - $config = array( + $config = [ 'sourceattribute' => 'memberOf', 'targetattribute' => 'eduPersonAffiliation', - 'values' => array( - 'member' => array( + 'values' => [ + 'member' => [ 'theGroup', 'otherGroup', - ), - ), - ); - $request = array( - 'Attributes' => array( - 'memberOf' => array('theGroup', 'otherGroup'), - 'eduPersonAffiliation' => array('member', 'someValue'), - ), - ); + ], + ], + ]; + $request = [ + 'Attributes' => [ + 'memberOf' => ['theGroup', 'otherGroup'], + 'eduPersonAffiliation' => ['member', 'someValue'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayNotHasKey('memberOf', $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('member', 'someValue')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['member', 'someValue']); } @@ -97,28 +97,28 @@ class AttributeValueMapTest extends TestCase */ public function testReplace() { - $config = array( + $config = [ 'sourceattribute' => 'memberOf', 'targetattribute' => 'eduPersonAffiliation', '%replace', - 'values' => array( - 'member' => array( + 'values' => [ + 'member' => [ 'theGroup', 'otherGroup', - ), - ), - ); - $request = array( - 'Attributes' => array( - 'memberOf' => array('theGroup'), - 'eduPersonAffiliation' => array('someValue'), - ), - ); + ], + ], + ]; + $request = [ + 'Attributes' => [ + 'memberOf' => ['theGroup'], + 'eduPersonAffiliation' => ['someValue'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayNotHasKey('memberOf', $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('member')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); } @@ -130,28 +130,28 @@ class AttributeValueMapTest extends TestCase */ public function testKeep() { - $config = array( + $config = [ 'sourceattribute' => 'memberOf', 'targetattribute' => 'eduPersonAffiliation', '%keep', - 'values' => array( - 'member' => array( + 'values' => [ + 'member' => [ 'theGroup', 'otherGroup', - ), - ), - ); - $request = array( - 'Attributes' => array( - 'memberOf' => array('theGroup'), - 'eduPersonAffiliation' => array('someValue'), - ), - ); + ], + ], + ]; + $request = [ + 'Attributes' => [ + 'memberOf' => ['theGroup'], + 'eduPersonAffiliation' => ['someValue'], + ], + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('memberOf', $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], array('someValue','member')); + $this->assertEquals($attributes['eduPersonAffiliation'], ['someValue','member']); } @@ -163,21 +163,21 @@ class AttributeValueMapTest extends TestCase */ public function testUnknownFlag() { - $config = array( + $config = [ '%test', 'targetattribute' => 'affiliation', 'sourceattribute' => 'memberOf', - 'values' => array( - 'member' => array( + 'values' => [ + 'member' => [ 'theGroup', - ), - ), - ); - $request = array( - 'Attributes' => array( - 'memberOf' => array('theGroup'), - ), - ); + ], + ], + ]; + $request = [ + 'Attributes' => [ + 'memberOf' => ['theGroup'], + ], + ]; $result = self::processFilter($config, $request); $this->assertArrayHasKey('affiliation', $result['Attributes']); $this->assertArrayNotHasKey('memberOf', $result['Attributes']); @@ -195,19 +195,19 @@ class AttributeValueMapTest extends TestCase */ public function testMissingSourceAttribute() { - $config = array( + $config = [ 'targetattribute' => 'affiliation', - 'values' => array( - 'member' => array( + 'values' => [ + 'member' => [ 'theGroup', - ), - ), - ); - $request = array( - 'Attributes' => array( - 'memberOf' => array('theGroup'), - ), - ); + ], + ], + ]; + $request = [ + 'Attributes' => [ + 'memberOf' => ['theGroup'], + ], + ]; self::processFilter($config, $request); } @@ -222,19 +222,19 @@ class AttributeValueMapTest extends TestCase */ public function testMissingTargetAttribute() { - $config = array( + $config = [ 'sourceattribute' => 'memberOf', - 'values' => array( - 'member' => array( + 'values' => [ + 'member' => [ 'theGroup', - ), - ), - ); - $request = array( - 'Attributes' => array( - 'memberOf' => array('theGroup'), - ), - ); + ], + ], + ]; + $request = [ + 'Attributes' => [ + 'memberOf' => ['theGroup'], + ], + ]; self::processFilter($config, $request); } } diff --git a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php index 0c04b777b2dcf9f54c6776a06a5a32828eb59280..ebf43b9c5c42779bc80c67c0defcf5b6ff4406c8 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php @@ -29,9 +29,9 @@ class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_Te protected function setUp() { - \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); $this->http = $this->getMockBuilder('SimpleSAML\Utils\HTTPAdapter') - ->setMethods(array('redirectTrustedURL')) + ->setMethods(['redirectTrustedURL']) ->getMock(); } @@ -40,17 +40,17 @@ class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_Te */ public function testSingleValuedUnchanged() { - $config = array( - 'singleValued' => array('eduPersonPrincipalName') - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('joe@example.com'), - ), - ); + $config = [ + 'singleValued' => ['eduPersonPrincipalName'] + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['joe@example.com'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('eduPersonPrincipalName' => array('joe@example.com')); + $expectedData = ['eduPersonPrincipalName' => ['joe@example.com']]; $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } @@ -59,33 +59,33 @@ class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_Te */ public function testFirstValue() { - $config = array( - 'firstValue' => array('eduPersonPrincipalName') - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('joe@example.com', 'bob@example.net'), - ), - ); + $config = [ + 'firstValue' => ['eduPersonPrincipalName'] + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['joe@example.com', 'bob@example.net'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('eduPersonPrincipalName' => array('joe@example.com')); + $expectedData = ['eduPersonPrincipalName' => ['joe@example.com']]; $this->assertEquals($expectedData, $attributes, "Only first value should be returned"); } public function testFirstValueUnchanged() { - $config = array( - 'firstValue' => array('eduPersonPrincipalName') - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('joe@example.com'), - ), - ); + $config = [ + 'firstValue' => ['eduPersonPrincipalName'] + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['joe@example.com'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('eduPersonPrincipalName' => array('joe@example.com')); + $expectedData = ['eduPersonPrincipalName' => ['joe@example.com']]; $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } @@ -94,35 +94,35 @@ class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_Te */ public function testFlatten() { - $config = array( - 'flatten' => array('eduPersonPrincipalName'), + $config = [ + 'flatten' => ['eduPersonPrincipalName'], 'flattenWith' => '|', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('joe@example.com', 'bob@example.net'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['joe@example.com', 'bob@example.net'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('eduPersonPrincipalName' => array('joe@example.com|bob@example.net')); + $expectedData = ['eduPersonPrincipalName' => ['joe@example.com|bob@example.net']]; $this->assertEquals($expectedData, $attributes, "Flattened string should be returned"); } public function testFlattenUnchanged() { - $config = array( - 'flatten' => array('eduPersonPrincipalName'), + $config = [ + 'flatten' => ['eduPersonPrincipalName'], 'flattenWith' => '|', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('joe@example.com'), - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['joe@example.com'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('eduPersonPrincipalName' => array('joe@example.com')); + $expectedData = ['eduPersonPrincipalName' => ['joe@example.com']]; $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } @@ -131,14 +131,14 @@ class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_Te */ public function testAbort() { - $config = array( - 'singleValued' => array('eduPersonPrincipalName'), - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('joe@example.com', 'bob@example.net'), - ), - ); + $config = [ + 'singleValued' => ['eduPersonPrincipalName'], + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['joe@example.com', 'bob@example.net'], + ], + ]; $this->http->expects($this->once()) ->method('redirectTrustedURL'); diff --git a/tests/modules/core/lib/Auth/Process/CardinalityTest.php b/tests/modules/core/lib/Auth/Process/CardinalityTest.php index 8d94754445a17de1a02691f11daff701fe0e9ca2..da6e2e30d47bdcb9a8ab91174e0e7c6a2b7b11cd 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalityTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalityTest.php @@ -30,9 +30,9 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \SimpleSAML\Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + \SimpleSAML\Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); $this->http = $this->getMockBuilder('SimpleSAML\Utils\HTTPAdapter') - ->setMethods(array('redirectTrustedURL')) + ->setMethods(['redirectTrustedURL']) ->getMock(); } @@ -41,17 +41,17 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMinNoMax() { - $config = array( - 'mail' => array('min' => 1), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['min' => 1], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('mail' => array('joe@example.com', 'bob@example.com')); + $expectedData = ['mail' => ['joe@example.com', 'bob@example.com']]; $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } @@ -60,17 +60,17 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMaxNoMin() { - $config = array( - 'mail' => array('max' => 2), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['max' => 2], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('mail' => array('joe@example.com', 'bob@example.com')); + $expectedData = ['mail' => ['joe@example.com', 'bob@example.com']]; $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } @@ -79,17 +79,17 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMaxMin() { - $config = array( - 'mail' => array('min' => 1, 'max' => 2), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['min' => 1, 'max' => 2], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $result = $this->processFilter($config, $request); $attributes = $result['Attributes']; - $expectedData = array('mail' => array('joe@example.com', 'bob@example.com')); + $expectedData = ['mail' => ['joe@example.com', 'bob@example.com']]; $this->assertEquals($expectedData, $attributes, "Assertion values should not have changed"); } @@ -98,14 +98,14 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMaxOutOfBounds() { - $config = array( - 'mail' => array('max' => 2), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com', 'fred@example.com'), - ), - ); + $config = [ + 'mail' => ['max' => 2], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com', 'fred@example.com'], + ], + ]; $this->http->expects($this->once()) ->method('redirectTrustedURL'); @@ -118,14 +118,14 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMinOutOfBounds() { - $config = array( - 'mail' => array('min' => 3), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['min' => 3], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $this->http->expects($this->once()) ->method('redirectTrustedURL'); @@ -138,12 +138,12 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMissingAttribute() { - $config = array( - 'mail' => array('min' => 1), - ); - $request = array( - 'Attributes' => array( ), - ); + $config = [ + 'mail' => ['min' => 1], + ]; + $request = [ + 'Attributes' => [], + ]; $this->http->expects($this->once()) ->method('redirectTrustedURL'); @@ -162,14 +162,14 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMinInvalid() { - $config = array( - 'mail' => array('min' => false), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['min' => false], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $this->processFilter($config, $request); } @@ -180,14 +180,14 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMinNegative() { - $config = array( - 'mail' => array('min' => -1), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['min' => -1], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $this->processFilter($config, $request); } @@ -198,14 +198,14 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMaxInvalid() { - $config = array( - 'mail' => array('max' => false), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['max' => false], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $this->processFilter($config, $request); } @@ -216,14 +216,14 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testMinGreaterThanMax() { - $config = array( - 'mail' => array('min' => 2, 'max' => 1), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + 'mail' => ['min' => 2, 'max' => 1], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; $this->processFilter($config, $request); } @@ -234,14 +234,14 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase */ public function testInvalidAttributeName() { - $config = array( - array('min' => 2, 'max' => 1), - ); - $request = array( - 'Attributes' => array( - 'mail' => array('joe@example.com', 'bob@example.com'), - ), - ); + $config = [ + ['min' => 2, 'max' => 1], + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['joe@example.com', 'bob@example.com'], + ], + ]; self::processFilter($config, $request); } } diff --git a/tests/modules/core/lib/Auth/Process/PHPTest.php b/tests/modules/core/lib/Auth/Process/PHPTest.php index c7331397389ddb73748e6a2b78bab8e243ad6f03..67bf33b706d36cc24e6675e47957944d45700df4 100644 --- a/tests/modules/core/lib/Auth/Process/PHPTest.php +++ b/tests/modules/core/lib/Auth/Process/PHPTest.php @@ -28,7 +28,7 @@ class Test_Core_Auth_Process_PHP extends TestCase */ public function testInvalidConfiguration() { - $config = array(); + $config = []; $this->setExpectedException( "\SimpleSAML\Error\Exception", "core:PHP: missing mandatory configuration option 'code'." @@ -42,17 +42,17 @@ class Test_Core_Auth_Process_PHP extends TestCase */ public function testCodeDefined() { - $config = array( + $config = [ 'code' => ' $attributes["key"] = array("value"); ', - ); - $request = array('Attributes' => array()); - $expected = array( - 'Attributes' => array( - 'key' => array('value'), - ), - ); + ]; + $request = ['Attributes' => []]; + $expected = [ + 'Attributes' => [ + 'key' => ['value'], + ], + ]; $this->assertEquals($expected, $this->processFilter($config, $request)); } @@ -62,25 +62,25 @@ class Test_Core_Auth_Process_PHP extends TestCase */ public function testPreserveIncomingAttributes() { - $config = array( + $config = [ 'code' => ' $attributes["orig2"] = array("value0"); ', - ); - $request = array( - 'Attributes' => array( - 'orig1' => array('value1', 'value2'), - 'orig2' => array('value3'), - 'orig3' => array('value4') - ) - ); - $expected = array( - 'Attributes' => array( - 'orig1' => array('value1', 'value2'), - 'orig2' => array('value0'), - 'orig3' => array('value4') - ), - ); + ]; + $request = [ + 'Attributes' => [ + 'orig1' => ['value1', 'value2'], + 'orig2' => ['value3'], + 'orig3' => ['value4'] + ] + ]; + $expected = [ + 'Attributes' => [ + 'orig1' => ['value1', 'value2'], + 'orig2' => ['value0'], + 'orig3' => ['value4'] + ], + ]; $this->assertEquals($expected, $this->processFilter($config, $request)); } @@ -91,19 +91,19 @@ class Test_Core_Auth_Process_PHP extends TestCase */ public function testThrowExceptionFromFilter() { - $config = array( + $config = [ 'code' => ' if (empty($attributes["uid"])) { throw new Exception("Missing uid attribute."); } $attributes["uid"][0] = strtoupper($attributes["uid"][0]); ', - ); - $request = array( - 'Attributes' => array( - 'orig1' => array('value1', 'value2'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'orig1' => ['value1', 'value2'], + ] + ]; $this->setExpectedException( "Exception", @@ -111,4 +111,42 @@ class Test_Core_Auth_Process_PHP extends TestCase ); $this->processFilter($config, $request); } + + /** + * Check that the entire state can be adjusted. + */ + public function testStateCanBeModified() + { + + $config = array( + 'code' => ' + $attributes["orig2"] = array("value0"); + $state["newKey"] = ["newValue"]; + $state["Destination"]["attributes"][] = "givenName"; + ', + ); + $request = array( + 'Attributes' => array( + 'orig1' => array('value1', 'value2'), + 'orig2' => array('value3'), + 'orig3' => array('value4') + ), + 'Destination' => [ + 'attributes' => ['eduPersonPrincipalName'] + ], + ); + $expected = array( + 'Attributes' => array( + 'orig1' => array('value1', 'value2'), + 'orig2' => array('value0'), + 'orig3' => array('value4') + ), + 'Destination' => [ + 'attributes' => ['eduPersonPrincipalName', 'givenName'] + ], + 'newKey' => ['newValue'] + ); + + $this->assertEquals($expected, $this->processFilter($config, $request)); + } } diff --git a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php index 843492678a7de14a8a8b1943a2d02c351e4af365..6bc4d276f90dc7be8e59b0bced8ea9ca2874c64c 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php @@ -27,21 +27,21 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testBasic() { - $config = array( + $config = [ 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - 'eduPersonAffiliation' => array('member'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + 'eduPersonAffiliation' => ['member'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('eduPersonScopedAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('member@example.com')); + $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@example.com']); } /* @@ -49,21 +49,21 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testNoOverwrite() { - $config = array( + $config = [ 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - 'eduPersonAffiliation' => array('member'), - 'eduPersonScopedAffiliation' => array('library-walk-in@example.edu'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + 'eduPersonAffiliation' => ['member'], + 'eduPersonScopedAffiliation' => ['library-walk-in@example.edu'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('library-walk-in@example.edu', 'member@example.com')); + $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['library-walk-in@example.edu', 'member@example.com']); } /* @@ -71,21 +71,21 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testNoDuplication() { - $config = array( + $config = [ 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - 'eduPersonAffiliation' => array('member'), - 'eduPersonScopedAffiliation' => array('member@example.com'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + 'eduPersonAffiliation' => ['member'], + 'eduPersonScopedAffiliation' => ['member@example.com'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('member@example.com')); + $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@example.com']); } @@ -94,18 +94,18 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testNoSourceAttribute() { - $config = array( + $config = [ 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'mail' => array('j.doe@example.edu', 'john@example.org'), - 'eduPersonAffiliation' => array('member'), - 'eduPersonScopedAffiliation' => array('library-walk-in@example.edu'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['j.doe@example.edu', 'john@example.org'], + 'eduPersonAffiliation' => ['member'], + 'eduPersonScopedAffiliation' => ['library-walk-in@example.edu'], + ] + ]; $result = self::processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); } @@ -115,18 +115,18 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testNoScopeAttribute() { - $config = array( + $config = [ 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'mail' => array('j.doe@example.edu', 'john@example.org'), - 'eduPersonScopedAffiliation' => array('library-walk-in@example.edu'), - 'eduPersonPrincipalName' => array('jdoe@example.com'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['j.doe@example.edu', 'john@example.org'], + 'eduPersonScopedAffiliation' => ['library-walk-in@example.edu'], + 'eduPersonPrincipalName' => ['jdoe@example.com'], + ] + ]; $result = self::processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); } @@ -136,20 +136,20 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testMultiAt() { - $config = array( + $config = [ 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('john@doe@example.com'), - 'eduPersonAffiliation' => array('member'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['john@doe@example.com'], + 'eduPersonAffiliation' => ['member'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('member@doe@example.com')); + $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@doe@example.com']); } /* @@ -157,20 +157,20 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testMultivaluedSource() { - $config = array( + $config = [ 'scopeAttribute' => 'eduPersonPrincipalName', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - 'eduPersonAffiliation' => array('member','staff','faculty'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + 'eduPersonAffiliation' => ['member','staff','faculty'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('member@example.com','staff@example.com','faculty@example.com')); + $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@example.com','staff@example.com','faculty@example.com']); } /* @@ -178,20 +178,20 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testNoAt() { - $config = array( + $config = [ 'scopeAttribute' => 'schacHomeOrganization', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - ); - $request = array( - 'Attributes' => array( - 'schacHomeOrganization' => array('example.org'), - 'eduPersonAffiliation' => array('student'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'schacHomeOrganization' => ['example.org'], + 'eduPersonAffiliation' => ['student'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('student@example.org')); + $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['student@example.org']); } /* @@ -199,21 +199,21 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ public function testOnlyIfEmpty() { - $config = array( + $config = [ 'scopeAttribute' => 'schacHomeOrganization', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', 'onlyIfEmpty' => true, - ); - $request = array( - 'Attributes' => array( - 'schacHomeOrganization' => array('example.org'), - 'eduPersonAffiliation' => array('student'), - 'eduPersonScopedAffiliation' => array('staff@example.org', 'member@example.org'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'schacHomeOrganization' => ['example.org'], + 'eduPersonAffiliation' => ['student'], + 'eduPersonScopedAffiliation' => ['staff@example.org', 'member@example.org'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], array('staff@example.org', 'member@example.org')); + $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['staff@example.org', 'member@example.org']); } } diff --git a/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php index 1d24c38e90f358861d737f2d2c22d70dc53c99fa..0e5aace085379d0e6475324a8e04ee3841f1d247 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php @@ -27,19 +27,19 @@ class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase */ public function testBasic() { - $config = array( + $config = [ 'sourceAttribute' => 'eduPersonPrincipalName', 'targetAttribute' => 'scope', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('scope', $attributes); - $this->assertEquals($attributes['scope'], array('example.com')); + $this->assertEquals($attributes['scope'], ['example.com']); } /* @@ -47,19 +47,19 @@ class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase */ public function testNoOverwrite() { - $config = array( + $config = [ 'sourceAttribute' => 'eduPersonPrincipalName', 'targetAttribute' => 'scope', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - 'scope' => array('example.edu') - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + 'scope' => ['example.edu'] + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['scope'], array('example.edu')); + $this->assertEquals($attributes['scope'], ['example.edu']); } /* @@ -67,16 +67,16 @@ class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase */ public function testNoSourceAttribute() { - $config = array( + $config = [ 'sourceAttribute' => 'eduPersonPrincipalName', 'targetAttribute' => 'scope', - ); - $request = array( - 'Attributes' => array( - 'mail' => array('j.doe@example.edu', 'john@example.org'), - 'scope' => array('example.edu') - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'mail' => ['j.doe@example.edu', 'john@example.org'], + 'scope' => ['example.edu'] + ] + ]; $result = self::processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); } @@ -86,18 +86,18 @@ class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase */ public function testMultiAt() { - $config = array( + $config = [ 'sourceAttribute' => 'eduPersonPrincipalName', 'targetAttribute' => 'scope', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('john@doe@example.com'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['john@doe@example.com'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['scope'], array('example.com')); + $this->assertEquals($attributes['scope'], ['example.com']); } /* @@ -105,15 +105,15 @@ class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase */ public function testNoAt() { - $config = array( + $config = [ 'sourceAttribute' => 'eduPersonPrincipalName', 'targetAttribute' => 'scope', - ); - $request = array( - 'Attributes' => array( - 'eduPersonPrincipalName' => array('johndoe'), - ) - ); + ]; + $request = [ + 'Attributes' => [ + 'eduPersonPrincipalName' => ['johndoe'], + ] + ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; diff --git a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php index e828db7795514618ddfe422514f95d59f57344f6..51f5c6b1da60f7f23e2776036db3e59eb917a77a 100644 --- a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php +++ b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php @@ -29,7 +29,7 @@ class Test_Core_Auth_Process_TargetedID extends TestCase // $config = array( // ); // $request = array( -// 'Attributes' => array(), +// 'Attributes' => [], // 'UserID' => 'user2@example.org', // ); // $result = self::processFilter($config, $request); @@ -168,12 +168,11 @@ class Test_Core_Auth_Process_TargetedID extends TestCase */ public function testNoUserID() { - $config = array( - ); - $request = array( - 'Attributes' => array(), - ); - $result = self::processFilter($config, $request); + $config = []; + $request = [ + 'Attributes' => [], + ]; + self::processFilter($config, $request); } /** @@ -183,15 +182,15 @@ class Test_Core_Auth_Process_TargetedID extends TestCase */ public function testAttributeNotExists() { - $config = array( + $config = [ 'attributename' => 'uid', - ); - $request = array( - 'Attributes' => array( + ]; + $request = [ + 'Attributes' => [ 'displayName' => 'Jack Student', - ), - ); - $result = self::processFilter($config, $request); + ], + ]; + self::processFilter($config, $request); } /** @@ -201,15 +200,15 @@ class Test_Core_Auth_Process_TargetedID extends TestCase */ public function testConfigInvalidAttributeName() { - $config = array( + $config = [ 'attributename' => 5, - ); - $request = array( - 'Attributes' => array( + ]; + $request = [ + 'Attributes' => [ 'displayName' => 'Jack Student', - ), - ); - $result = self::processFilter($config, $request); + ], + ]; + self::processFilter($config, $request); } /** @@ -219,14 +218,14 @@ class Test_Core_Auth_Process_TargetedID extends TestCase */ public function testConfigInvalidNameId() { - $config = array( + $config = [ 'nameId' => 'persistent', - ); - $request = array( - 'Attributes' => array( + ]; + $request = [ + 'Attributes' => [ 'displayName' => 'Jack Student', - ), - ); - $result = self::processFilter($config, $request); + ], + ]; + self::processFilter($config, $request); } } diff --git a/tests/modules/core/lib/Auth/UserPassBaseTest.php b/tests/modules/core/lib/Auth/UserPassBaseTest.php index d70616800b1561327d3c716b9cde90b43aef474b..e3e1d25d7473324bf9959378059a586e9b591251 100644 --- a/tests/modules/core/lib/Auth/UserPassBaseTest.php +++ b/tests/modules/core/lib/Auth/UserPassBaseTest.php @@ -4,15 +4,15 @@ class UserPassBaseTest extends \PHPUnit_Framework_TestCase { public function testAuthenticateECPCallsLoginAndSetsAttributes() { - $state = array(); - $attributes = array('attrib' => 'val'); + $state = []; + $attributes = ['attrib' => 'val']; $username = $state['core:auth:username'] = 'username'; $password = $state['core:auth:password'] = 'password'; $stub = $this->getMockBuilder('\SimpleSAML\Module\core\Auth\UserPassBase') ->disableOriginalConstructor() - ->setMethods(array('login')) + ->setMethods(['login']) ->getMockForAbstractClass(); $stub->expects($this->once()) @@ -27,8 +27,8 @@ class UserPassBaseTest extends \PHPUnit_Framework_TestCase public function testAuthenticateECPCallsLoginWithForcedUsername() { - $state = array(); - $attributes = array(); + $state = []; + $attributes = []; $forcedUsername = 'forcedUsername'; @@ -37,7 +37,7 @@ class UserPassBaseTest extends \PHPUnit_Framework_TestCase $stub = $this->getMockBuilder('\SimpleSAML\Module\core\Auth\UserPassBase') ->disableOriginalConstructor() - ->setMethods(array('login')) + ->setMethods(['login']) ->getMockForAbstractClass(); $stub->expects($this->once()) diff --git a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php index 3ee9098b878896066da8dad57e8ef508154d8e3d..90816896b7b349274586d9743d8b4dcf06a6eb42 100644 --- a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php +++ b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php @@ -8,13 +8,13 @@ class UserPassOrgBaseTest extends \PHPUnit_Framework_TestCase { public function testRememberOrganizationEnabled() { - $config = array( + $config = [ 'ldap:LDAPMulti', 'remember.organization.enabled' => true, 'remember.organization.checked' => false, - 'my-org' => array( + 'my-org' => [ 'description' => 'My organization', // The rest of the options are the same as those available for // the LDAP authentication source. @@ -22,14 +22,14 @@ class UserPassOrgBaseTest extends \PHPUnit_Framework_TestCase 'dnpattern' => 'uid=%username%,ou=employees,dc=example,dc=org', // Whether SSL/TLS should be used when contacting the LDAP server. 'enable_tls' => false, - ) - ); + ] + ]; // When PHP 5.4 support is dropped, replace with: // $mockUserPassOrgBase = $this->getMockBuilder(\SimpleSAML\Module\core\Auth\UserPassOrgBase::class) - $mockUserPassOrgBase = $this->getMockBuilder(get_parent_class(new \SimpleSAML\Module\ldap\Auth\Source\LDAPMulti(array('AuthId' => 'my-org'), array()))) - ->setConstructorArgs(array(array('AuthId' => 'my-org'), &$config)) - ->setMethods(array()) + $mockUserPassOrgBase = $this->getMockBuilder(get_parent_class(new \SimpleSAML\Module\ldap\Auth\Source\LDAPMulti(['AuthId' => 'my-org'], []))) + ->setConstructorArgs([['AuthId' => 'my-org'], &$config]) + ->setMethods([]) ->getMockForAbstractClass(); $this->assertTrue($mockUserPassOrgBase->getRememberOrganizationEnabled()); diff --git a/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php b/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php index 11f6efed6bbddc922a095bc6c1940529b6f5bf81..b7c502e4e1c335025859cd07150a54a2862a4912 100644 --- a/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php +++ b/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php @@ -15,11 +15,11 @@ class BaseFilter_Test extends TestCase $this->assertEquals( "array ( 'ldap.hostname' => 'ldap://172.17.101.32', 'ldap.port' => 389, 'ldap.password' => '********', )", - $method->invokeArgs($stub, array(array( + $method->invokeArgs($stub, [[ 'ldap.hostname' => 'ldap://172.17.101.32', 'ldap.port' => 389, 'ldap.password' => 'password', - ))) + ]]) ); } } diff --git a/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php b/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php index 1915c9c0e77316a4a7236e309ce6777ccb891cc9..20e9400b6dd685c233181a8da2f3fd8352e70192 100644 --- a/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php +++ b/tests/modules/saml/lib/Auth/Process/FilterScopesTest.php @@ -34,51 +34,51 @@ class FilterScopesTest extends TestCase public function testValidScopes() { // test declared scopes - $config = array(); - $request = array( - 'Source' => array( - 'SingleSignOnService' => array( - array( + $config = []; + $request = [ + 'Source' => [ + 'SingleSignOnService' => [ + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://example.org/saml2/idp/SSOService.php', - ), - ), - 'scope' => array( + ], + ], + 'scope' => [ 'example.com', 'example.net', - ), - ), - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.com'), - ), - ); + ], + ], + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.com'], + ], + ]; $result = $this->processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); // test multiple values - $request['Attributes'] = array( - 'eduPersonPrincipalName' => array( + $request['Attributes'] = [ + 'eduPersonPrincipalName' => [ 'jdoe@example.com', 'jdoe@example.net', - ), - ); + ], + ]; $result = $this->processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); // test implicit scope - $request['Attributes'] = array( - 'eduPersonPrincipalName' => array('jdoe@example.org'), - ); + $request['Attributes'] = [ + 'eduPersonPrincipalName' => ['jdoe@example.org'], + ]; $result = $this->processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); // test alternative attributes - $config['attributes'] = array( + $config['attributes'] = [ 'mail', - ); - $request['Attributes'] = array( - 'mail' => array('john.doe@example.org'), - ); + ]; + $request['Attributes'] = [ + 'mail' => ['john.doe@example.org'], + ]; $result = $this->processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); @@ -95,43 +95,43 @@ class FilterScopesTest extends TestCase public function testInvalidScopes() { // test scope not matching anything, empty attribute - $config = array(); - $request = array( - 'Source' => array( - 'SingleSignOnService' => array( - array( + $config = []; + $request = [ + 'Source' => [ + 'SingleSignOnService' => [ + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://example.org/saml2/idp/SSOService.php', - ), - ), - 'scope' => array( + ], + ], + 'scope' => [ 'example.com', 'example.net', - ), - ), - 'Attributes' => array( - 'eduPersonPrincipalName' => array('jdoe@example.edu'), - ), - ); + ], + ], + 'Attributes' => [ + 'eduPersonPrincipalName' => ['jdoe@example.edu'], + ], + ]; $result = $this->processFilter($config, $request); - $this->assertEquals(array(), $result['Attributes']); + $this->assertEquals([], $result['Attributes']); // test some scopes allowed and some others not $request['Attributes']['eduPersonPrincipalName'][] = 'jdoe@example.com'; $result = $this->processFilter($config, $request); $this->assertEquals( - array( - 'eduPersonPrincipalName' => array( + [ + 'eduPersonPrincipalName' => [ 'jdoe@example.com', - ), - ), + ], + ], $result['Attributes'] ); // test attribute missing scope - $request['Attributes'] = array( - 'eduPersonPrincipalName' => array('jdoe'), - ); + $request['Attributes'] = [ + 'eduPersonPrincipalName' => ['jdoe'], + ]; $result = $this->processFilter($config, $request); $this->assertEquals($request['Attributes'], $result['Attributes']); } diff --git a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php index 84799db9e227ecb503d2ff481a8ba6f2255d2aad..fbcf3796c3a95ff415cd6dde4531d37c5efe191c 100644 --- a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php +++ b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php @@ -31,7 +31,7 @@ class NameIDAttributeTest extends TestCase */ public function testMinimalConfig() { - $config = array(); + $config = []; $nameId = new \SAML2\XML\saml\NameID(); $nameId->value = 'eugene@oombaas'; @@ -40,15 +40,15 @@ class NameIDAttributeTest extends TestCase $spId = 'eugeneSP'; $idpId = 'eugeneIdP'; - $request = array( - 'Source' => array( + $request = [ + 'Source' => [ 'entityid' => $spId, - ), - 'Destination' => array( + ], + 'Destination' => [ 'entityid' => $idpId, - ), + ], 'saml:sp:NameID' => $nameId, - ); + ]; $result = $this->processFilter($config, $request); $this->assertEquals("{$spId}!{$idpId}!{$nameId->value}", $result['Attributes']['nameid'][0]); } @@ -59,7 +59,7 @@ class NameIDAttributeTest extends TestCase public function testCustomAttributeName() { $attributeName = 'eugeneNameIDAttribute'; - $config = array('attribute' => $attributeName); + $config = ['attribute' => $attributeName]; $nameId = new \SAML2\XML\saml\NameID(); $nameId->value = 'eugene@oombaas'; @@ -68,15 +68,15 @@ class NameIDAttributeTest extends TestCase $spId = 'eugeneSP'; $idpId = 'eugeneIdP'; - $request = array( - 'Source' => array( + $request = [ + 'Source' => [ 'entityid' => $spId, - ), - 'Destination' => array( + ], + 'Destination' => [ 'entityid' => $idpId, - ), + ], 'saml:sp:NameID' => $nameId, - ); + ]; $result = $this->processFilter($config, $request); $this->assertTrue(isset($result['Attributes'][$attributeName])); $this->assertEquals("{$spId}!{$idpId}!{$nameId->value}", $result['Attributes'][$attributeName][0]); @@ -87,7 +87,7 @@ class NameIDAttributeTest extends TestCase */ public function testFormat() { - $config = array('format' => '%V'); + $config = ['format' => '%V']; $nameId = new \SAML2\XML\saml\NameID(); $nameId->value = 'eugene@oombaas'; @@ -96,15 +96,15 @@ class NameIDAttributeTest extends TestCase $spId = 'eugeneSP'; $idpId = 'eugeneIdP'; - $request = array( - 'Source' => array( + $request = [ + 'Source' => [ 'entityid' => $spId, - ), - 'Destination' => array( + ], + 'Destination' => [ 'entityid' => $idpId, - ), + ], 'saml:sp:NameID' => $nameId, - ); + ]; $result = $this->processFilter($config, $request); $this->assertEquals("{$nameId->value}", $result['Attributes']['nameid'][0]); } @@ -116,7 +116,7 @@ class NameIDAttributeTest extends TestCase public function testCustomAttributeNameAndFormat() { $attributeName = 'eugeneNameIDAttribute'; - $config = array('attribute' => $attributeName, 'format' => '%V'); + $config = ['attribute' => $attributeName, 'format' => '%V']; $nameId = new \SAML2\XML\saml\NameID(); $nameId->value = 'eugene@oombaas'; @@ -125,15 +125,15 @@ class NameIDAttributeTest extends TestCase $spId = 'eugeneSP'; $idpId = 'eugeneIdP'; - $request = array( - 'Source' => array( + $request = [ + 'Source' => [ 'entityid' => $spId, - ), - 'Destination' => array( + ], + 'Destination' => [ 'entityid' => $idpId, - ), + ], 'saml:sp:NameID' => $nameId, - ); + ]; $result = $this->processFilter($config, $request); $this->assertTrue(isset($result['Attributes'][$attributeName])); $this->assertEquals("{$nameId->value}", $result['Attributes'][$attributeName][0]); diff --git a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php index 502babca7e10c312d3b842f1aca4f5d3eac8a4c0..f3634818d9bb5ffcde328ee09fecfa301248193b 100644 --- a/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php +++ b/tests/modules/saml/lib/Auth/Source/Auth_Source_SP_Test.php @@ -55,11 +55,11 @@ class SP_Tester extends \SimpleSAML\Module\saml\Auth\Source\SP { // Exit test. Continuing would mean running into a assert(FALSE) throw new ExitTestException( - array( + [ 'state' => $state, 'binding' => $binding, 'ar' => $ar, - ) + ] ); } } @@ -91,17 +91,17 @@ class SP_Test extends TestCase protected function setUp() { - $this->idpConfigArray = array( + $this->idpConfigArray = [ 'metadata-set' => 'saml20-idp-remote', 'entityid' => 'https://engine.surfconext.nl/authentication/idp/metadata', - 'SingleSignOnService' => array( - array( + 'SingleSignOnService' => [ + [ 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://engine.surfconext.nl/authentication/idp/single-sign-on', - ), - ), - 'keys' => array( - array( + ], + ], + 'keys' => [ + [ 'encryption' => false, 'signing' => true, 'type' => 'X509Certificate', @@ -121,11 +121,11 @@ class SP_Test extends TestCase 'ZkQO8EsscJPPy/Zp4uHAnADWACkOUHiCbcKiUUFu66dX0Wr/v53Gekz487GgVRs8HEeT9MU1reBKRgdENR8PNg4rbQfLc'. '3YQKLWK7yWnn/RenjDpuCiePj8N8/80tGgrNgK/6fzM3zI18sSywnXLswxqDb/J+jgVxnQ6MrsTf1urM8MnfcxG/82oHI'. 'wfMh/sXPCZpo+DTLkhQxctJ3M=', - ), - ), - ); + ], + ], + ]; - $this->config = Configuration::loadFromArray(array(), '[ARRAY]', 'simplesaml'); + $this->config = Configuration::loadFromArray([], '[ARRAY]', 'simplesaml'); } @@ -137,10 +137,10 @@ class SP_Test extends TestCase * * @return \SAML2\AuthnRequest The AuthnRequest generated. */ - private function createAuthnRequest($state = array()) + private function createAuthnRequest($state = []) { - $info = array('AuthId' => 'default-sp'); - $config = array(); + $info = ['AuthId' => 'default-sp']; + $config = []; $as = new SP_Tester($info, $config); /** @var \SAML2\AuthnRequest $ar */ @@ -187,9 +187,9 @@ class SP_Test extends TestCase */ public function testNameID() { - $state = array( - 'saml:NameID' => array('Value' => 'user@example.org', 'Format' => \SAML2\Constants::NAMEID_UNSPECIFIED) - ); + $state = [ + 'saml:NameID' => ['Value' => 'user@example.org', 'Format' => \SAML2\Constants::NAMEID_UNSPECIFIED] + ]; /** @var \SAML2\AuthnRequest $ar */ $ar = $this->createAuthnRequest($state); @@ -219,9 +219,9 @@ class SP_Test extends TestCase */ public function testAuthnContextClassRef() { - $state = array( + $state = [ 'saml:AuthnContextClassRef' => 'http://example.com/myAuthnContextClassRef' - ); + ]; /** @var \SAML2\AuthnRequest $ar */ $ar = $this->createAuthnRequest($state); @@ -248,9 +248,9 @@ class SP_Test extends TestCase */ public function testForcedAuthn() { - $state = array( + $state = [ 'ForceAuthn' => true - ); + ]; /** @var \SAML2\AuthnRequest $ar */ $ar = $this->createAuthnRequest($state); diff --git a/tests/modules/saml/lib/IdP/SAML2Test.php b/tests/modules/saml/lib/IdP/SAML2Test.php index 76efcedb2316fd1c699f5d42fc642347f20c00af..1dce810fa0c439817be83cb2755ea85e8eb0d988 100644 --- a/tests/modules/saml/lib/IdP/SAML2Test.php +++ b/tests/modules/saml/lib/IdP/SAML2Test.php @@ -6,7 +6,7 @@ class SAML2Test extends \PHPUnit_Framework_TestCase { $username = $_SERVER['PHP_AUTH_USER'] = 'username'; $password = $_SERVER['PHP_AUTH_PW'] = 'password'; - $state = array(); + $state = []; \SimpleSAML\Module\saml\IdP\SAML2::processSOAPAuthnRequest($state); @@ -20,7 +20,7 @@ class SAML2Test extends \PHPUnit_Framework_TestCase $_SERVER['PHP_AUTH_PW'] = 'password'; unset($_SERVER['PHP_AUTH_USER']); - $state = array(); + $state = []; \SimpleSAML\Module\saml\IdP\SAML2::processSOAPAuthnRequest($state); } @@ -31,7 +31,7 @@ class SAML2Test extends \PHPUnit_Framework_TestCase $_SERVER['PHP_AUTH_USER'] = 'username'; unset($_SERVER['PHP_AUTH_PW']); - $state = array(); + $state = []; \SimpleSAML\Module\saml\IdP\SAML2::processSOAPAuthnRequest($state); } diff --git a/tests/www/IndexTest.php b/tests/www/IndexTest.php index be7d060121a32b0d275f17f41a811a857e9cd9e1..7d3bcedd02f685e30e698c17b95fd03da2cd880b 100644 --- a/tests/www/IndexTest.php +++ b/tests/www/IndexTest.php @@ -72,12 +72,12 @@ class IndexTest extends TestCase } // test most basic redirection - $this->updateConfig(array( + $this->updateConfig([ 'baseurlpath' => 'http://example.org/simplesaml/' - )); - $resp = $this->server->get('/index.php', array(), array( + ]); + $resp = $this->server->get('/index.php', [], [ CURLOPT_FOLLOWLOCATION => 0, - )); + ]); $this->assertEquals('302', $resp['code']); $this->assertEquals( 'http://example.org/simplesaml/module.php/core/frontpage_welcome.php', @@ -85,12 +85,12 @@ class IndexTest extends TestCase ); // test non-default path and https - $this->updateConfig(array( + $this->updateConfig([ 'baseurlpath' => 'https://example.org/' - )); - $resp = $this->server->get('/index.php', array(), array( + ]); + $resp = $this->server->get('/index.php', [], [ CURLOPT_FOLLOWLOCATION => 0, - )); + ]); $this->assertEquals('302', $resp['code']); $this->assertEquals( 'https://example.org/module.php/core/frontpage_welcome.php', @@ -98,12 +98,12 @@ class IndexTest extends TestCase ); // test URL guessing - $this->updateConfig(array( + $this->updateConfig([ 'baseurlpath' => '/simplesaml/' - )); - $resp = $this->server->get('/index.php', array(), array( + ]); + $resp = $this->server->get('/index.php', [], [ CURLOPT_FOLLOWLOCATION => 0, - )); + ]); $this->assertEquals('302', $resp['code']); $this->assertEquals( 'http://'.$this->server_addr.'/simplesaml/module.php/core/frontpage_welcome.php', diff --git a/tests/www/TemplateTest.php b/tests/www/TemplateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..06dfe10808c2ea612f0050eeb3c20a915fd99f72 --- /dev/null +++ b/tests/www/TemplateTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Simple test for syntax-checking Twig-templates. + * + * @author Tim van Dijen <tvdijen@gmail.com> + * @package SimpleSAMLphp + */ + +namespace SimpleSAML\Test\Web; + +use PHPUnit\Framework\TestCase; + +use \SimpleSAML\Configuration; +use \SimpleSAML\XHTML\Template; +use \SimpleSAML\Module; + +class TemplateTest extends TestCase +{ + public function testSyntax() + { + $config = Configuration::loadFromArray([ + 'language.i18n.backend' => 'gettext/gettext', + 'module.enable' => array_fill_keys(Module::getModules(), true), + ]); + Configuration::setPreLoadedConfig($config); + + $basedir = dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'templates'; + + // Base templates + $files = array_diff(scandir($basedir), ['.', '..']); + foreach ($files as $file) { + if (preg_match('/.twig$/', $file)) { + $t = new Template($config, $file); + ob_start(); + try { + $t->show(); + $this->addToAssertionCount(1); + } catch (\Twig_Error_Syntax $e) { + $this->fail($e->getMessage().' in '.$e->getFile().':'.$e->getLine()); + } + ob_end_clean(); + } + } + + // Module templates + foreach (Module::getModules() as $module) { + $basedir = Module::getModuleDir($module).DIRECTORY_SEPARATOR.'templates'; + if (file_exists($basedir)) { + $files = array_diff(scandir($basedir), ['.', '..']); + foreach ($files as $file) { + if (preg_match('/.twig$/', $file)) { + $t = new Template($config, $module.':'.$file); + ob_start(); + try { + $t->show(); + $this->addToAssertionCount(1); + } catch (\Twig_Error_Syntax $e) { + $this->fail($e->getMessage().' in '.$e->getFile().':'.$e->getLine()); + } + ob_end_clean(); + } + } + } + } + } +} diff --git a/www/admin/hostnames.php b/www/admin/hostnames.php index fa93ab5d8a8bf4bb21b079bd601d9041ad29b4fb..2948ef12da122a024b8a594f76d90a9f7f91df5f 100644 --- a/www/admin/hostnames.php +++ b/www/admin/hostnames.php @@ -9,21 +9,21 @@ $session = \SimpleSAML\Session::getSessionFromRequest(); // Check if valid local session exists.. \SimpleSAML\Utils\Auth::requireAdmin(); -$attributes = array(); - -$attributes['HTTP_HOST'] = array($_SERVER['HTTP_HOST']); -$attributes['HTTPS'] = isset($_SERVER['HTTPS']) ? array($_SERVER['HTTPS']) : array(); -$attributes['SERVER_PROTOCOL'] = array($_SERVER['SERVER_PROTOCOL']); -$attributes['SERVER_PORT'] = array($_SERVER['SERVER_PORT']); - -$attributes['getBaseURL()'] = array(\SimpleSAML\Utils\HTTP::getBaseURL()); -$attributes['getSelfHost()'] = array(\SimpleSAML\Utils\HTTP::getSelfHost()); -$attributes['getSelfHostWithNonStandardPort()'] = array(\SimpleSAML\Utils\HTTP::getSelfHostWithNonStandardPort()); -$attributes['selfURLhost()'] = array(\SimpleSAML\Utils\HTTP::getSelfURLHost()); -$attributes['selfURLNoQuery()'] = array(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery()); -$attributes['getSelfHostWithPath()'] = array(\SimpleSAML\Utils\HTTP::getSelfHostWithPath()); -$attributes['getFirstPathElement()'] = array(\SimpleSAML\Utils\HTTP::getFirstPathElement()); -$attributes['selfURL()'] = array(\SimpleSAML\Utils\HTTP::getSelfURL()); +$attributes = []; + +$attributes['HTTP_HOST'] = [$_SERVER['HTTP_HOST']]; +$attributes['HTTPS'] = isset($_SERVER['HTTPS']) ? [$_SERVER['HTTPS']] : []; +$attributes['SERVER_PROTOCOL'] = [$_SERVER['SERVER_PROTOCOL']]; +$attributes['SERVER_PORT'] = [$_SERVER['SERVER_PORT']]; + +$attributes['getBaseURL()'] = [\SimpleSAML\Utils\HTTP::getBaseURL()]; +$attributes['getSelfHost()'] = [\SimpleSAML\Utils\HTTP::getSelfHost()]; +$attributes['getSelfHostWithNonStandardPort()'] = [\SimpleSAML\Utils\HTTP::getSelfHostWithNonStandardPort()]; +$attributes['selfURLhost()'] = [\SimpleSAML\Utils\HTTP::getSelfURLHost()]; +$attributes['selfURLNoQuery()'] = [\SimpleSAML\Utils\HTTP::getSelfURLNoQuery()]; +$attributes['getSelfHostWithPath()'] = [\SimpleSAML\Utils\HTTP::getSelfHostWithPath()]; +$attributes['getFirstPathElement()'] = [\SimpleSAML\Utils\HTTP::getFirstPathElement()]; +$attributes['selfURL()'] = [\SimpleSAML\Utils\HTTP::getSelfURL()]; $template = new \SimpleSAML\XHTML\Template($config, 'hostnames.php'); diff --git a/www/admin/index.php b/www/admin/index.php index 28bec413bc6c1e4bb85438eca84abd68b9ad4054..41e9c200af4a8218ad2d143ccd4dfe9f0ce14e5c 100644 --- a/www/admin/index.php +++ b/www/admin/index.php @@ -9,12 +9,14 @@ $session = \SimpleSAML\Session::getSessionFromRequest(); // Check if valid local session exists.. \SimpleSAML\Utils\Auth::requireAdmin(); -$adminpages = array( +$adminpages = [ 'hostnames.php' => 'Diagnostics on hostname, port and protocol', 'phpinfo.php' => 'PHP info', '../module.php/sanitycheck/index.php' => 'Sanity check of your SimpleSAMLphp setup', 'sandbox.php' => 'Sandbox for testing changes to layout and css', -); +]; + +$logouturl = \SimpleSAML\Utils\Auth::getAdminLogoutURL(); $template = new \SimpleSAML\XHTML\Template($config, 'index.php'); @@ -22,6 +24,6 @@ $template->data['pagetitle'] = 'Admin'; $template->data['adminpages'] = $adminpages; $template->data['remaining'] = $session->getAuthData('admin', 'Expire') - time(); $template->data['valid'] = 'na'; -$template->data['logout'] = null; +$template->data['logouturl'] = $logouturl; $template->show(); diff --git a/www/admin/metadata-converter.php b/www/admin/metadata-converter.php index db3114fb41c2d612af77659f2b71d8aba29f1fe6..e88dff061e890e7b7bb3708e98d14ddde6c9cd22 100644 --- a/www/admin/metadata-converter.php +++ b/www/admin/metadata-converter.php @@ -19,12 +19,12 @@ if (!empty($xmldata)) { // get all metadata for the entities foreach ($entities as &$entity) { - $entity = array( + $entity = [ 'shib13-sp-remote' => $entity->getMetadata1xSP(), 'shib13-idp-remote' => $entity->getMetadata1xIdP(), 'saml20-sp-remote' => $entity->getMetadata20SP(), 'saml20-idp-remote' => $entity->getMetadata20IdP(), - ); + ]; } // transpose from $entities[entityid][type] to $output[type][entityid] @@ -49,7 +49,7 @@ if (!empty($xmldata)) { } } else { $xmldata = ''; - $output = array(); + $output = []; } $template = new \SimpleSAML\XHTML\Template($config, 'metadata-converter.php', 'admin'); diff --git a/www/assets/css/src/default.css b/www/assets/css/src/default.css index ae1ae6ef379cbd42cd41f8bc18b64a98ac591569..f1721e22eb9089b4e717a7177bfd0c38dc3d94f7 100644 --- a/www/assets/css/src/default.css +++ b/www/assets/css/src/default.css @@ -233,6 +233,13 @@ This styles the menu heading. color: #fff; margin: 0; } +.frontpage-menu .pure-menu-item { + border-bottom: 1px solid lightgrey; +} +.frontpage-menu .pure-menu-selected { + border-bottom: 1px solid black; + font-weight: bold; +} /* -- Dynamic Button For Responsive Menu -------------------------------------*/ @@ -362,12 +369,6 @@ CONTENT margin-top: 2em; width: 35%; } -.pure-menu-item { - border-bottom: 1px solid lightgrey; -} -.pure-menu-item:last-child { - border-bottom: none; -} .code-box{ border:1px solid #ccc; margin-bottom: 1em; @@ -652,3 +653,8 @@ dt { .entity-expired { color: #500; } +div.preferredidp { + border: 1px dashed #ccc; + background: #eee; + padding: 2px 2em 2px 2em; +} diff --git a/www/authmemcookie.php b/www/authmemcookie.php index 032c05f4c568d10c8c6fe50b20f249bf2ac01a99..9825c62f54bc6ed9032b981eb43ae0882f989af9 100644 --- a/www/authmemcookie.php +++ b/www/authmemcookie.php @@ -40,7 +40,7 @@ try { // generate the authentication information $attributes = $s->getAttributes(); - $authData = array(); + $authData = []; // username $usernameAttr = $amc->getUsernameAttr(); @@ -63,7 +63,7 @@ try { } $authData['Groups'] = $attributes[$groupsAttr]; } else { - $authData['Groups'] = array(); + $authData['Groups'] = []; } $authData['RemoteIP'] = $_SERVER['REMOTE_ADDR']; diff --git a/www/errorreport.php b/www/errorreport.php index 4ffe52452765c566be4f4422d3da2bec0e804046..0193e4767b589133c67e27bbef489fc0f9d072b9 100644 --- a/www/errorreport.php +++ b/www/errorreport.php @@ -26,7 +26,7 @@ try { } if ($data === null) { - $data = array( + $data = [ 'exceptionMsg' => 'not set', 'exceptionTrace' => 'not set', 'reportId' => $reportId, @@ -34,7 +34,7 @@ if ($data === null) { 'url' => 'not set', 'version' => $config->getVersion(), 'referer' => 'not set', - ); + ]; if (isset($session)) { $data['trackId'] = $session->getTrackID(); @@ -69,11 +69,11 @@ $message = <<<MESSAGE <p>Track ID:</p> <pre>%s</pre> -<p>Version: <tt>%s</tt></p> +<p>Version: <code>%s</code></p> -<p>Report ID: <tt>%s</tt></p> +<p>Report ID: <code>%s</code></p> -<p>Referer: <tt>%s</tt></p> +<p>Referer: <code>%s</code></p> <hr /> <div class="footer"> diff --git a/www/module.php b/www/module.php index d8a72013d1e439d61d92bef310fbada8b044d78c..c53d595f67bf915920f167dcdb58f2a669d6c5c2 100644 --- a/www/module.php +++ b/www/module.php @@ -13,10 +13,10 @@ require_once('_include.php'); // index pages - file names to attempt when accessing directories -$indexFiles = array('index.php', 'index.html', 'index.htm', 'index.txt'); +$indexFiles = ['index.php', 'index.html', 'index.htm', 'index.txt']; // MIME types - key is file extension, value is MIME type -$mimeTypes = array( +$mimeTypes = [ 'bmp' => 'image/x-ms-bmp', 'css' => 'text/css', 'gif' => 'image/gif', @@ -37,7 +37,7 @@ $mimeTypes = array( 'txt' => 'text/plain', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', -); +]; if (empty($_SERVER['PATH_INFO'])) { throw new \SimpleSAML\Error\NotFound('No PATH_INFO to module.php'); diff --git a/www/saml2/idp/ArtifactResolutionService.php b/www/saml2/idp/ArtifactResolutionService.php index 975e8d8260d2a5851cd37d8afef44d59679cf772..16a99dc62e1285bb179ff4d8cd46ba8c44c26410 100644 --- a/www/saml2/idp/ArtifactResolutionService.php +++ b/www/saml2/idp/ArtifactResolutionService.php @@ -47,7 +47,7 @@ if (!($request instanceof \SAML2\ArtifactResolve)) { } $issuer = $request->getIssuer(); -$spMetadata = $metadata->getMetadataConfig($issuer, 'saml20-sp-remote'); +$spMetadata = $metadata->getMetaDataConfig($issuer, 'saml20-sp-remote'); $artifact = $request->getArtifact(); diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php index 720ecc872f7fcf15bb0ab16b634f84055a1a35f5..eaaaa955fbc701decb2ed671680821be24f9102e 100644 --- a/www/saml2/idp/metadata.php +++ b/www/saml2/idp/metadata.php @@ -26,18 +26,18 @@ try { $_GET['idpentityid'] : $metadata->getMetaDataCurrentEntityID('saml20-idp-hosted'); $idpmeta = $metadata->getMetaDataConfig($idpentityid, 'saml20-idp-hosted'); - $availableCerts = array(); + $availableCerts = []; - $keys = array(); + $keys = []; $certInfo = Crypto::loadPublicKey($idpmeta, false, 'new_'); if ($certInfo !== null) { $availableCerts['new_idp.crt'] = $certInfo; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => true, 'X509Certificate' => $certInfo['certData'], - ); + ]; $hasNewCert = true; } else { $hasNewCert = false; @@ -45,29 +45,29 @@ try { $certInfo = Crypto::loadPublicKey($idpmeta, true); $availableCerts['idp.crt'] = $certInfo; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => ($hasNewCert ? false : true), 'X509Certificate' => $certInfo['certData'], - ); + ]; if ($idpmeta->hasValue('https.certificate')) { $httpsCert = Crypto::loadPublicKey($idpmeta, true, 'https.'); assert(isset($httpsCert['certData'])); $availableCerts['https.crt'] = $httpsCert; - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => false, 'X509Certificate' => $httpsCert['certData'], - ); + ]; } - $metaArray = array( + $metaArray = [ 'metadata-set' => 'saml20-idp-remote', 'entityid' => $idpentityid, - ); + ]; $ssob = $metadata->getGenerated('SingleSignOnServiceBinding', 'saml20-idp-hosted'); $slob = $metadata->getGenerated('SingleLogoutServiceBinding', 'saml20-idp-hosted'); @@ -76,30 +76,30 @@ try { if (is_array($ssob)) { foreach ($ssob as $binding) { - $metaArray['SingleSignOnService'][] = array( + $metaArray['SingleSignOnService'][] = [ 'Binding' => $binding, 'Location' => $ssol, - ); + ]; } } else { - $metaArray['SingleSignOnService'][] = array( + $metaArray['SingleSignOnService'][] = [ 'Binding' => $ssob, 'Location' => $ssol, - ); + ]; } if (is_array($slob)) { foreach ($slob as $binding) { - $metaArray['SingleLogoutService'][] = array( + $metaArray['SingleLogoutService'][] = [ 'Binding' => $binding, 'Location' => $slol, - ); + ]; } } else { - $metaArray['SingleLogoutService'][] = array( + $metaArray['SingleLogoutService'][] = [ 'Binding' => $slob, 'Location' => $slol, - ); + ]; } if (count($keys) === 1) { @@ -110,28 +110,28 @@ try { if ($idpmeta->getBoolean('saml20.sendartifact', false)) { // Artifact sending enabled - $metaArray['ArtifactResolutionService'][] = array( + $metaArray['ArtifactResolutionService'][] = [ 'index' => 0, 'Location' => HTTP::getBaseURL().'saml2/idp/ArtifactResolutionService.php', 'Binding' => Constants::BINDING_SOAP, - ); + ]; } if ($idpmeta->getBoolean('saml20.hok.assertion', false)) { // Prepend HoK SSO Service endpoint. - array_unshift($metaArray['SingleSignOnService'], array( + array_unshift($metaArray['SingleSignOnService'], [ 'hoksso:ProtocolBinding' => Constants::BINDING_HTTP_REDIRECT, 'Binding' => Constants::BINDING_HOK_SSO, 'Location' => HTTP::getBaseURL().'saml2/idp/SSOService.php' - )); + ]); } if ($idpmeta->getBoolean('saml20.ecp', false)) { - $metaArray['SingleSignOnService'][] = array( + $metaArray['SingleSignOnService'][] = [ 'index' => 0, 'Binding' => Constants::BINDING_SOAP, 'Location' => HTTP::getBaseURL().'saml2/idp/SSOService.php', - ); + ]; } $metaArray['NameIDFormat'] = $idpmeta->getArrayizeString( @@ -218,7 +218,7 @@ try { $t->data['clipboard.js'] = true; $t->data['available_certs'] = $availableCerts; - $certdata = array(); + $certdata = []; foreach (array_keys($availableCerts) as $availableCert) { $certdata[$availableCert]['name'] = $availableCert; $certdata[$availableCert]['url'] = SimpleSAML\Module::getModuleURL('saml/idp/certs.php').'/'.$availableCert; diff --git a/www/shib13/idp/metadata.php b/www/shib13/idp/metadata.php index a366f1da2827f14e1c94ffebe470fd7cf4ef7ea2..acd5ee33a46b99877db0598eba10d367d8e1e023 100644 --- a/www/shib13/idp/metadata.php +++ b/www/shib13/idp/metadata.php @@ -20,30 +20,30 @@ try { $_GET['idpentityid'] : $metadata->getMetaDataCurrentEntityID('shib13-idp-hosted'); $idpmeta = $metadata->getMetaDataConfig($idpentityid, 'shib13-idp-hosted'); - $keys = array(); + $keys = []; $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, false, 'new_'); if ($certInfo !== null) { - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => false, 'X509Certificate' => $certInfo['certData'], - ); + ]; } $certInfo = \SimpleSAML\Utils\Crypto::loadPublicKey($idpmeta, true); - $keys[] = array( + $keys[] = [ 'type' => 'X509Certificate', 'signing' => true, 'encryption' => false, 'X509Certificate' => $certInfo['certData'], - ); + ]; - $metaArray = array( + $metaArray = [ 'metadata-set' => 'shib13-idp-remote', 'entityid' => $idpentityid, 'SingleSignOnService' => $metadata->getGenerated('SingleSignOnService', 'shib13-idp-hosted'), - ); + ]; if (count($keys) === 1) { $metaArray['certData'] = $keys[0]['X509Certificate']; @@ -71,11 +71,11 @@ try { $metaBuilder = new \SimpleSAML\Metadata\SAMLBuilder($idpentityid); $metaBuilder->addMetadataIdP11($metaArray); $metaBuilder->addOrganizationInfo($metaArray); - $metaBuilder->addContact('technical', \SimpleSAML\Utils\Config\Metadata::getContact(array( + $metaBuilder->addContact('technical', \SimpleSAML\Utils\Config\Metadata::getContact([ 'emailAddress' => $config->getString('technicalcontact_email', null), 'name' => $config->getString('technicalcontact_name', null), 'contactType' => 'technical', - ))); + ])); $metaxml = $metaBuilder->getEntityDescriptorText(); // sign the metadata if enabled @@ -91,7 +91,7 @@ try { $t->data['headerString'] = \SimpleSAML\Locale\Translate::noop('metadata_shib13-idp'); $t->data['metaurl'] = \SimpleSAML\Utils\HTTP::addURLParameters( \SimpleSAML\Utils\HTTP::getSelfURLNoQuery(), - array('output' => 'xml') + ['output' => 'xml'] ); $t->data['metadata'] = htmlspecialchars($metaxml); $t->data['metadataflat'] = htmlspecialchars($metaflat); diff --git a/yarn.lock b/yarn.lock index 2a21e9b3d830371a608dd0625e37d500fea2651d..1cbf92fed61b4dd0485ad90bf63e12791efecf7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,415 +2,147 @@ # yarn lockfile v1 -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - ansicolors@~0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.2.1.tgz#be089599097b74a5c9c4a84a0cdbcdb62bd87aef" + integrity sha1-vgiVmQl7dKXJxKhKDNvNtivYeu8= -aproba@^1.0.3: - version "1.2.0" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" - -are-we-there-yet@~1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz#bb5dca382bb94f05e15194373d16fd3ba1ca110d" - dependencies: - delegates "^1.0.0" - readable-stream "^2.0.6" - -async@0.2.x: - version "0.2.10" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" - -bindings@1.2.x: - version "1.2.1" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" - -bl@^1.0.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.1.tgz#cac328f7bee45730d404b692203fcb590e172d5e" +async@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.1.tgz#b245a23ca71930044ec53fa46aa00a3e87c6a610" + integrity sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ== dependencies: - readable-stream "^2.0.5" + lodash "^4.17.10" -cardinal@0.4.x: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cardinal/-/cardinal-0.4.4.tgz#ca5bb68a5b511b90fe93b9acea49bdee5c32bfe2" +cardinal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cardinal/-/cardinal-1.0.0.tgz#50e21c1b0aa37729f9377def196b5a9cec932ee9" + integrity sha1-UOIcGwqjdyn5N33vGWtanOyTLuk= dependencies: ansicolors "~0.2.1" - redeyed "~0.4.0" - -chownr@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.0.1.tgz#e2a75042a9551908bebd25b8523d5f9769d79181" + redeyed "~1.0.0" -clipboard@^1.7.1: - version "1.7.1" - resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-1.7.1.tgz#360d6d6946e99a7a1fef395e42ba92b5e9b5a16b" +clipboard@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.1.tgz#a12481e1c13d8a50f5f036b0560fe5d16d74e46a" + integrity sha512-7yhQBmtN+uYZmfRjjVjKa0dZdWuabzpSKGtyQZN+9C8xlC788SSJjOHWh7tzurfwTqTD5UDYAhIv5fRJg3sHjQ== dependencies: good-listener "^1.2.2" select "^1.1.2" tiny-emitter "^2.0.0" -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - -console-control-strings@^1.0.0, console-control-strings@~1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" - -core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - -csv-parse@^1.1.7: - version "1.3.3" - resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-1.3.3.tgz#d1cfd8743c2f849a0abb2fd544db56695d19a490" - -deep-extend@~0.4.0: - version "0.4.2" - resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" +csv-parse@^2.0.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-2.5.0.tgz#65748997ecc3719c594622db1b9ea0e2eb7d56bb" + integrity sha512-4OcjOJQByI0YDU5COYw9HAqjo8/MOLLmT9EKyMCXUzgvh30vS1SlMK+Ho84IH5exN44cSnrYecw/7Zpu2m4lkA== delegate@^3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.1.3.tgz#9a8251a777d7025faa55737bc3b071742127a9fd" - -delegates@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + version "3.2.0" + resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166" + integrity sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw== -end-of-stream@^1.0.0, end-of-stream@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.0.tgz#7a90d833efda6cfa6eac0f4949dbb0fad3a63206" - dependencies: - once "^1.4.0" - -esprima@~1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.0.4.tgz#9f557e08fc3b4d26ece9dd34f8fbf476b62585ad" - -expand-template@^1.0.2: - version "1.1.0" - resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-1.1.0.tgz#e09efba977bf98f9ee0ed25abd0c692e02aec3fc" +esprima@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.0.0.tgz#53cf247acda77313e551c3aa2e73342d3fb4f7d9" + integrity sha1-U88kes2ncxPlUcOqLnM0LT+099k= font-awesome@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/font-awesome/-/font-awesome-4.7.0.tgz#8fa8cf0411a1a31afd07b06d2902bb9fc815a133" - -gauge@~2.7.3: - version "2.7.4" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" - dependencies: - aproba "^1.0.3" - console-control-strings "^1.0.0" - has-unicode "^2.0.0" - object-assign "^4.1.0" - signal-exit "^3.0.0" - string-width "^1.0.1" - strip-ansi "^3.0.1" - wide-align "^1.1.0" - -github-from-package@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + integrity sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM= good-listener@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" + integrity sha1-1TswzfkxPf+33JoNR3CWqm0UXFA= dependencies: delegate "^3.1.2" -has-unicode@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" - -humanize@0.0.x: +humanize@^0.0.9: version "0.0.9" resolved "https://registry.yarnpkg.com/humanize/-/humanize-0.0.9.tgz#1994ffaecdfe9c441ed2bdac7452b7bb4c9e41a4" + integrity sha1-GZT/rs3+nEQe0r2sdFK3u0yeQaQ= -inherits@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" +jquery-ui@^1.12.1: + version "1.12.1" + resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51" + integrity sha1-vLQEXI3QU5wTS8FIjN0+dop6nlE= -ini@~1.3.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" +jquery@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" + integrity sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg== -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - dependencies: - number-is-nan "^1.0.0" - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -jquery-ui@^1.10.4: - version "1.10.4" - resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.10.4.tgz#a096fe5f4e0f2ab69a0585cf10455877f57506bd" - -jquery@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787" +lodash@^4.17.10: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== microplugin@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/microplugin/-/microplugin-0.0.3.tgz#1fc2e1bb7c9e19e82bd84bba9137bbe71250d8cd" - -microtime@^2.1.0: - version "2.1.6" - resolved "https://registry.yarnpkg.com/microtime/-/microtime-2.1.6.tgz#76047a03f91ced5abb2e5367e5f1df2ede756bae" - dependencies: - bindings "1.2.x" - nan "2.6.x" - prebuild-install "^2.1.0" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -minimist@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-H8Lhu3yeGegr2Eu6kTe75xJQ2M0= minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" + integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - dependencies: - minimist "0.0.8" - -nan@2.6.x: - version "2.6.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" - -node-abi@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-2.1.1.tgz#c9cda256ec8aa99bcab2f6446db38af143338b2a" - -noop-logger@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" - -npmlog@^4.0.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" - dependencies: - are-we-there-yet "~1.1.2" - console-control-strings "~1.1.0" - gauge "~2.7.3" - set-blocking "~2.0.0" - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" +nan@2.9.x: + version "2.9.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866" + integrity sha512-ltW65co7f3PQWBDbqVvaU1WtFJUsNW7sWWm4HINhbMQIyVyzIeyZ8toX5TC5eeooE6piZoaEh4cZkueSKG3KYw== -object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - -once@^1.3.1, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - dependencies: - wrappy "1" - -optimist@0.6.x: +optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= dependencies: minimist "~0.0.1" wordwrap "~0.0.2" -os-homedir@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - -prebuild-install@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-2.3.0.tgz#19481247df728b854ab57b187ce234211311b485" - dependencies: - expand-template "^1.0.2" - github-from-package "0.0.0" - minimist "^1.2.0" - mkdirp "^0.5.1" - node-abi "^2.1.1" - noop-logger "^0.1.1" - npmlog "^4.0.1" - os-homedir "^1.0.1" - pump "^1.0.1" - rc "^1.1.6" - simple-get "^1.4.2" - tar-fs "^1.13.0" - tunnel-agent "^0.6.0" - xtend "4.0.1" - -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" - -pump@^1.0.0, pump@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.2.tgz#3b3ee6512f94f0e575538c17995f9f16990a5d51" - dependencies: - end-of-stream "^1.1.0" - once "^1.3.1" - purecss@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/purecss/-/purecss-1.0.0.tgz#3dbcd9e2a7592448a69acb705cce16311bf4b785" + integrity sha512-gfC78WCOWNnfkzulx9aoWwcl+0JflhwKeJ+k9s/ZyIawfYNA4bqBmt0DtfgtQK9iuYMtGfbdE8R2AQMjSWR2VQ== -rc@^1.1.6: - version "1.2.2" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" - dependencies: - deep-extend "~0.4.0" - ini "~1.3.0" - minimist "^1.2.0" - strip-json-comments "~2.0.1" - -readable-stream@^2.0.0, readable-stream@^2.0.5, readable-stream@^2.0.6: - version "2.3.3" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - safe-buffer "~5.1.1" - string_decoder "~1.0.3" - util-deprecate "~1.0.1" - -redeyed@~0.4.0: - version "0.4.4" - resolved "https://registry.yarnpkg.com/redeyed/-/redeyed-0.4.4.tgz#37e990a6f2b21b2a11c2e6a48fd4135698cba97f" +redeyed@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/redeyed/-/redeyed-1.0.1.tgz#e96c193b40c0816b00aec842698e61185e55498a" + integrity sha1-6WwZO0DAgWsArshCaY5hGF5VSYo= dependencies: - esprima "~1.0.4" - -safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + esprima "~3.0.0" select@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" + integrity sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0= -selectize@^0.12.4: - version "0.12.4" - resolved "https://registry.yarnpkg.com/selectize/-/selectize-0.12.4.tgz#50c697526b609dea11da153cf7252b98948f4c0e" +selectize@^0.12.6: + version "0.12.6" + resolved "https://registry.yarnpkg.com/selectize/-/selectize-0.12.6.tgz#c2cf08cbaa4cb06c5e99bb452919d71b080690d6" + integrity sha512-bWO5A7G+I8+QXyjLfQUgh31VI4WKYagUZQxAXlDyUmDDNrFxrASV0W9hxCOl0XJ/XQ1dZEu3G9HjXV4Wj0yb6w== dependencies: microplugin "0.0.3" sifter "^0.5.1" -set-blocking@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - sifter@^0.5.1: - version "0.5.2" - resolved "https://registry.yarnpkg.com/sifter/-/sifter-0.5.2.tgz#4702e3cee3036903da1f194b29e6dc7a4fb59abe" + version "0.5.3" + resolved "https://registry.yarnpkg.com/sifter/-/sifter-0.5.3.tgz#5e6507fe8c114b2b28d90b6bf4e5b636e611e48b" + integrity sha1-XmUH/owRSyso2Qtr9OW2NuYR5Is= dependencies: - async "0.2.x" - cardinal "0.4.x" - csv-parse "^1.1.7" - humanize "0.0.x" - optimist "0.6.x" - optionalDependencies: - microtime "^2.1.0" - -signal-exit@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" - -simple-get@^1.4.2: - version "1.4.3" - resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-1.4.3.tgz#e9755eda407e96da40c5e5158c9ea37b33becbeb" - dependencies: - once "^1.3.1" - unzip-response "^1.0.0" - xtend "^4.0.0" - -string-width@^1.0.1, string-width@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -string_decoder@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0, strip-ansi@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - dependencies: - ansi-regex "^2.0.0" - -strip-json-comments@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" - -tar-fs@^1.13.0: - version "1.16.0" - resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-1.16.0.tgz#e877a25acbcc51d8c790da1c57c9cf439817b896" - dependencies: - chownr "^1.0.1" - mkdirp "^0.5.1" - pump "^1.0.0" - tar-stream "^1.1.2" - -tar-stream@^1.1.2: - version "1.5.4" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.5.4.tgz#36549cf04ed1aee9b2a30c0143252238daf94016" - dependencies: - bl "^1.0.0" - end-of-stream "^1.0.0" - readable-stream "^2.0.0" - xtend "^4.0.0" + async "^2.6.0" + cardinal "^1.0.0" + csv-parse "^2.0.0" + humanize "^0.0.9" + optimist "^0.6.1" tiny-emitter@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.0.2.tgz#82d27468aca5ade8e5fd1e6d22b57dd43ebdfb7c" - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - dependencies: - safe-buffer "^5.0.1" - -unzip-response@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-1.0.2.tgz#b984f0877fc0a89c2c773cc1ef7b5b232b5b06fe" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - -wide-align@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" - dependencies: - string-width "^1.0.2" + integrity sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow== wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - -xtend@4.0.1, xtend@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc=