diff --git a/bin/memcacheSync.php b/bin/memcacheSync.php index 0b5ca9c85980c3c3b7558b4dda257c7cafe21b97..0dfdc31f4741b3b56961c9ea27e7e569ac3952a8 100755 --- a/bin/memcacheSync.php +++ b/bin/memcacheSync.php @@ -3,19 +3,19 @@ // Check that the memcache library is enabled -if(!class_exists('Memcache') && !class_exists('Memcached')) { - echo("Error: the memcached (or memcache) PHP extension appears to be unavailable.\n"); - echo("\n"); - echo("This is most likely because PHP doesn't load it for the command line\n"); - echo("version. You probably need to enable it somehow.\n"); - echo("\n"); - if(is_executable('/usr/sbin/phpenmod')) { - echo("It is possible that running one of the following commands as root will fix it:\n"); - echo(" phpenmod -s cli memcached\n"); - echo(" phpenmod -s cli memcache\n"); - } - - exit(1); +if (!class_exists('Memcache') && !class_exists('Memcached')) { + echo "Error: the memcached (or memcache) PHP extension appears to be unavailable.\n"; + echo "\n"; + echo "This is most likely because PHP doesn't load it for the command line\n"; + echo "version. You probably need to enable it somehow.\n"; + echo "\n"; + if (is_executable('/usr/sbin/phpenmod')) { + echo "It is possible that running one of the following commands as root will fix it:\n"; + echo " phpenmod -s cli memcached\n"; + echo " phpenmod -s cli memcache\n"; + } + + exit(1); } // This is the base directory of the SimpleSAMLphp installation @@ -38,25 +38,24 @@ $stats = \SimpleSAML\Memcache::getRawStats(); $keys = []; foreach ($stats as $group) { foreach ($group as $server => $state) { - if ($state === false) { - echo("WARNING: Server ".$server." is down.\n"); + echo "WARNING: Server ".$server." is down.\n"; $warnServerDown++; continue; } $items = $state['curr_items']; - echo("Server ".$server." has ".$items." items.\n"); + echo "Server ".$server." has ".$items." items.\n"; $serverKeys = getServerKeys($server); $keys = array_merge($keys, $serverKeys); } } -echo("Total number of keys: ".count($keys)."\n"); +echo "Total number of keys: ".count($keys)."\n"; $keys = array_unique($keys); -echo("Total number of unique keys: ".count($keys)."\n"); +echo "Total number of unique keys: ".count($keys)."\n"; -echo("Starting synchronization.\n"); +echo "Starting synchronization.\n" ; $skipped = 0; $sync = 0; @@ -70,20 +69,20 @@ foreach ($keys as $key) { } -echo("Synchronization done.\n"); -echo($sync." keys in sync.\n"); +echo "Synchronization done.\n"; +echo $sync." keys in sync.\n"; if ($skipped > 0) { - echo($skipped." keys skipped.\n"); - echo("Keys are skipped because they are either expired, or are of a type unknown\n"); - echo("to SimpleSAMLphp.\n"); + echo $skipped." keys skipped.\n"; + echo "Keys are skipped because they are either expired, or are of a type unknown\n"; + echo "to SimpleSAMLphp.\n"; } if ($warnServerDown > 0) { - echo("WARNING: ".$warnServerDown." server(s) down. Not all servers are synchronized.\n"); + echo "WARNING: ".$warnServerDown." server(s) down. Not all servers are synchronized.\n"; } if ($warnBigSlab > 0) { - echo("WARNING: ".$warnBigSlab." slab(s) may have contained more keys than we were told about.\n"); + echo "WARNING: ".$warnBigSlab." slab(s) may have contained more keys than we were told about.\n"; } /** @@ -99,12 +98,12 @@ function getServerKeys($server) $host = $server[0]; $port = (int) $server[1]; - echo("Connecting to: ".$host.":".$port."\n"); + echo "Connecting to: ".$host.":".$port."\n"; $socket = fsockopen($host, $port); - echo("Connected. Finding keys.\n"); + echo "Connected. Finding keys.\n"; if (fwrite($socket, "stats slabs\r\n") === false) { - echo("Error requesting slab dump from server.\n"); + echo "Error requesting slab dump from server.\n"; exit(1); } @@ -127,9 +126,8 @@ function getServerKeys($server) // Dump keys in slabs $keys = []; foreach ($slabs as $slab) { - if (fwrite($socket, "stats cachedump ".$slab." 1000000\r\n") === false) { - echo("Error requesting cache dump from server.\n"); + echo "Error requesting cache dump from server.\n"; exit(1); } @@ -149,17 +147,17 @@ function getServerKeys($server) if (preg_match('/^ITEM (.*) \[\d+ b; \d+ s\]/', $line, $matches)) { $keys[] = $matches[1]; } else { - echo("Unknown result from cache dump: ".$line."\n"); + echo "Unknown result from cache dump: ".$line."\n"; } } if ($resultSize > 1900000 || count($keys) >= 1000000) { - echo("WARNING: Slab ".$slab." on server ".$host.":".$port. - " may have contained more keys than we were told about.\n"); + echo "WARNING: Slab ".$slab." on server ".$host.":".$port. + " may have contained more keys than we were told about.\n"; $GLOBALS['warnBigSlab'] += 1; } } - echo("Found ".count($keys)." key(s).\n"); + echo "Found ".count($keys)." key(s).\n"; fclose($socket); return $keys; diff --git a/config-templates/authsources.php b/config-templates/authsources.php index c637594c900dd522a18e47ff81fccb50b21d618e..ac1d1c5545fa14b685d2c6f58b078eaf44e95aeb 100644 --- a/config-templates/authsources.php +++ b/config-templates/authsources.php @@ -35,79 +35,81 @@ $config = [ * The metadata will then be created as follows: * <md:RequestedAttribute FriendlyName="friendlyName" Name="name" /> */ - /*'name' => array( - 'en' => 'A service', - 'no' => 'En tjeneste', - ), + /* + 'name' => [ + 'en' => 'A service', + 'no' => 'En tjeneste', + ], - 'attributes' => array( + 'attributes' => [ 'attrname' => 'urn:oid:x.x.x.x', - ),*/ - /*'attributes.required' => array ( + ], + 'attributes.required' => [ 'urn:oid:x.x.x.x', - ),*/ + ], + */ ], /* - 'example-sql' => array( + 'example-sql' => [ 'sqlauth:SQL', 'dsn' => 'pgsql:host=sql.example.org;port=5432;dbname=simplesaml', 'username' => 'simplesaml', 'password' => 'secretpassword', - 'query' => 'SELECT uid, givenName, email, eduPersonPrincipalName FROM users WHERE uid = :username AND password = SHA2(CONCAT((SELECT salt FROM users WHERE uid = :username), :password),256);', - ), + 'query' => 'SELECT uid, givenName, email, eduPersonPrincipalName FROM users WHERE uid = :username AND password = SHA2(CONCAT((SELECT salt FROM users WHERE uid = :username), :password), 256);', + ], */ /* - 'example-static' => array( + 'example-static' => [ 'exampleauth:Static', - 'uid' => array('testuser'), - 'eduPersonAffiliation' => array('member', 'employee'), - 'cn' => array('Test User'), - ), + 'uid' => ['testuser'], + 'eduPersonAffiliation' => ['member', 'employee'], + 'cn' => ['Test User'], + ], */ /* - 'example-userpass' => array( + 'example-userpass' => [ 'exampleauth:UserPass', // Give the user an option to save their username for future login attempts // And when enabled, what should the default be, to save the username or not - //'remember.username.enabled' => FALSE, - //'remember.username.checked' => FALSE, - - 'student:studentpass' => array( - 'uid' => array('test'), - 'eduPersonAffiliation' => array('member', 'student'), - ), - 'employee:employeepass' => array( - 'uid' => array('employee'), - 'eduPersonAffiliation' => array('member', 'employee'), - ), - ), + //'remember.username.enabled' => false, + //'remember.username.checked' => false, + + 'student:studentpass' => [ + 'uid' => ['test'], + 'eduPersonAffiliation' => ['member', 'student'], + ], + 'employee:employeepass' => [ + 'uid' => ['employee'], + 'eduPersonAffiliation' => ['member', 'employee'], + ], + ], */ /* - 'crypto-hash' => array( + 'crypto-hash' => [ 'authcrypt:Hash', // hashed version of 'verysecret', made with bin/pwgen.php - 'professor:{SSHA256}P6FDTEEIY2EnER9a6P2GwHhI5JDrwBgjQ913oVQjBngmCtrNBUMowA==' => array( - 'uid' => array('prof_a'), - 'eduPersonAffiliation' => array('member', 'employee', 'board'), - ), - ), + 'professor:{SSHA256}P6FDTEEIY2EnER9a6P2GwHhI5JDrwBgjQ913oVQjBngmCtrNBUMowA==' => [ + 'uid' => ['prof_a'], + 'eduPersonAffiliation' => ['member', 'employee', 'board'], + ], + ], */ /* - 'htpasswd' => array( + 'htpasswd' => [ 'authcrypt:Htpasswd', 'htpasswd_file' => '/var/www/foo.edu/legacy_app/.htpasswd', - 'static_attributes' => array( - 'eduPersonAffiliation' => array('member', 'employee'), - 'Organization' => array('University of Foo'), - ), - ), + 'static_attributes' => [ + 'eduPersonAffiliation' => ['member', 'employee'], + 'Organization' => ['University of Foo'], + ], + ], */ /* @@ -115,21 +117,21 @@ $config = [ // external authentication engine. Take a look at the comment in the beginning // of modules/exampleauth/lib/Auth/Source/External.php for a description of // how to adjust it to your own site. - 'example-external' => array( + 'example-external' => [ 'exampleauth:External', - ), + ], */ /* - 'yubikey' => array( + 'yubikey' => [ 'authYubiKey:YubiKey', 'id' => '000', // 'key' => '012345678', - ), + ], */ /* - 'facebook' => array( + 'facebook' => [ 'authfacebook:Facebook', // Register your Facebook application on http://www.facebook.com/developers // App ID or API key (requests with App ID should be faster; https://github.com/facebook/php-sdk/issues/214) @@ -143,7 +145,7 @@ $config = [ // When empty, only the app-specific user id and name will be returned // See https://developers.facebook.com/docs/graph-api/reference/v2.6/user for the full list // 'user_fields' => 'email,birthday,third_party_id,name,first_name,last_name', - ), + ], */ /* @@ -152,59 +154,59 @@ $config = [ // https://www.linkedin.com/secure/developer // Attributes definition: // https://developer.linkedin.com/docs/fields - 'linkedin' => array( + 'linkedin' => [ 'authlinkedin:LinkedIn', 'key' => 'xxxxxxxxxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxx', 'attributes' => 'id,first-name,last-name,headline,summary,specialties,picture-url,email-address', - ), + ], */ /* // Twitter OAuth Authentication API. // Register your application to get an API key here: // http://twitter.com/oauth_clients - 'twitter' => array( + 'twitter' => [ 'authtwitter:Twitter', 'key' => 'xxxxxxxxxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxx', // Forces the user to enter their credentials to ensure the correct users account is authorized. // Details: https://dev.twitter.com/docs/api/1/get/oauth/authenticate - 'force_login' => FALSE, - ), + 'force_login' => false, + ], */ /* // Microsoft Account (Windows Live ID) Authentication API. // Register your application to get an API key here: // https://apps.dev.microsoft.com/ - 'windowslive' => array( + 'windowslive' => [ 'authwindowslive:LiveID', 'key' => 'xxxxxxxxxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxx', - ), + ], */ /* // Example of a LDAP authentication source. - 'example-ldap' => array( + 'example-ldap' => [ 'ldap:LDAP', // Give the user an option to save their username for future login attempts // And when enabled, what should the default be, to save the username or not - //'remember.username.enabled' => FALSE, - //'remember.username.checked' => FALSE, + //'remember.username.enabled' => false, + //'remember.username.checked' => false, // The hostname of the LDAP server. 'hostname' => 'ldap.example.org', // Whether SSL/TLS should be used when contacting the LDAP server. - 'enable_tls' => TRUE, + 'enable_tls' => true, // Whether debug output from the LDAP library should be enabled. // Default is FALSE. - 'debug' => FALSE, + 'debug' => false, // The timeout for accessing the LDAP server, in seconds. // The default is 0, which means no timeout. @@ -215,12 +217,12 @@ $config = [ 'port' => 389, // Set whether to follow referrals. AD Controllers may require FALSE to function. - 'referrals' => TRUE, + 'referrals' => true, // Which attributes should be retrieved from the LDAP server. // This can be an array of attribute names, or NULL, in which case // all attributes are fetched. - 'attributes' => NULL, + 'attributes' => null, // The pattern which should be used to create the users DN given the username. // %username% in this pattern will be replaced with the users username. @@ -230,7 +232,7 @@ $config = [ // As an alternative to specifying a pattern for the users DN, it is possible to // search for the username in a set of attributes. This is enabled by this option. - 'search.enable' => FALSE, + 'search.enable' => false, // The DN which will be used as a base for the search. // This can be a single string, in which case only that DN is searched, or an @@ -241,40 +243,40 @@ $config = [ // // This is an array with one or more attribute names. Any of the attributes in // the array may match the value the username. - 'search.attributes' => array('uid', 'mail'), + 'search.attributes' => ['uid', 'mail'], // Additional LDAP filters appended to the search attributes 'search.filter' => '(objectclass=inetorgperson)', // The username & password the SimpleSAMLphp should bind to before searching. If // this is left as NULL, no bind will be performed before searching. - 'search.username' => NULL, - 'search.password' => NULL, + 'search.username' => null, + 'search.password' => null, // If the directory uses privilege separation, // the authenticated user may not be able to retrieve // all required attribures, a privileged entity is required // to get them. This is enabled with this option. - 'priv.read' => FALSE, + 'priv.read' => false, // The DN & password the SimpleSAMLphp should bind to before // retrieving attributes. These options are required if // 'priv.read' is set to TRUE. - 'priv.username' => NULL, - 'priv.password' => NULL, + 'priv.username' => null, + 'priv.password' => null, - ), + ], */ /* // Example of an LDAPMulti authentication source. - 'example-ldapmulti' => array( + 'example-ldapmulti' => [ 'ldap:LDAPMulti', // Give the user an option to save their username for future login attempts // And when enabled, what should the default be, to save the username or not - //'remember.username.enabled' => FALSE, - //'remember.username.checked' => FALSE, + //'remember.username.enabled' => false, + //'remember.username.checked' => false, // Give the user an option to save their organization choice for future login // attempts. And when enabled, what should the default be, checked or not. @@ -298,7 +300,7 @@ $config = [ // username will be used as the user enters it. // // The default is FALSE. - 'include_organization_in_username' => FALSE, + 'include_organization_in_username' => false, // A list of available LDAP servers. // @@ -308,7 +310,7 @@ $config = [ // // The value of each element is an array in the same format as an LDAP // authentication source. - 'employees' => array( + 'employees' => [ // A short name/description for this group. Will be shown in a dropdown list // when the user logs on. // @@ -319,16 +321,14 @@ $config = [ // the LDAP authentication source. 'hostname' => 'ldap.employees.example.org', 'dnpattern' => 'uid=%username%,ou=employees,dc=example,dc=org', - ), + ], - 'students' => array( + 'students' => [ 'description' => 'Students', 'hostname' => 'ldap.students.example.org', 'dnpattern' => 'uid=%username%,ou=students,dc=example,dc=org', - ), - - ), + ], + ], */ - ]; diff --git a/config-templates/config.php b/config-templates/config.php index f3f776351e53a2fbb308fdd3c8de49f480f4f713..ac9b800f230c7a435735e9c37a183370dbe9bef4 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -33,7 +33,7 @@ $config = [ * The 'application' configuration array groups a set configuration options * relative to an application protected by SimpleSAMLphp. */ - //'application' => array( + //'application' => [ /* * The 'baseURL' configuration option allows you to specify a protocol, * host and optionally a port that serves as the canonical base for all @@ -49,7 +49,7 @@ $config = [ * to SimpleSAMLphp's API. */ //'baseURL' => 'https://example.com', - //), + //], /* * The following settings are *filesystem paths* which define where @@ -148,7 +148,7 @@ $config = [ * WHAT YOU ARE DOING! * * Example: - * 'trusted.url.domains' => array('sp.example.com', 'app.example.com'), + * 'trusted.url.domains' => ['sp.example.com', 'app.example.com'], */ 'trusted.url.domains' => [], @@ -235,7 +235,7 @@ $config = [ * See docs/simplesamlphp-errorhandling.txt for function code example. * * Example: - * 'errors.show_function' => array('SimpleSAML\Module\example\Error', 'show'), + * 'errors.show_function' => ['SimpleSAML\Module\example\Error', 'show'], */ @@ -318,17 +318,17 @@ $config = [ */ 'statistics.out' => [// Log statistics to the normal log. /* - array( + [ 'class' => 'core:Log', 'level' => 'notice', - ), + ], */ // Log statistics to files in a directory. One file per day. /* - array( + [ 'class' => 'core:File', 'directory' => '/var/log/stats', - ), + ], */ ], @@ -406,12 +406,12 @@ $config = [ */ 'database.slaves' => [ /* - array( + [ 'dsn' => 'mysql:host=myslave;dbname=saml', 'username' => 'simplesamlphp', 'password' => 'secret', 'persistent' => false, - ), + ], */ ], @@ -458,11 +458,11 @@ $config = [ * * Example: * - * 'module.enable' => array( - * 'exampleauth' => TRUE, // Setting to TRUE enables. - * 'saml' => FALSE, // Setting to FALSE disables. - * 'core' => NULL, // Unset or NULL uses default. - * ), + * 'module.enable' => [ + * 'exampleauth' => true, // Setting to TRUE enables. + * 'saml' => false, // Setting to FALSE disables. + * 'core' => null, // Unset or NULL uses default. + * ], * */ @@ -568,7 +568,7 @@ $config = [ * See docs/simplesamlphp-advancedfeatures.txt for function code example. * * Example: - * 'session.check_function' => array('\SimpleSAML\Module\example\Util', 'checkSession'), + * 'session.check_function' => ['\SimpleSAML\Module\example\Util', 'checkSession'], */ @@ -606,26 +606,26 @@ $config = [ * 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 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'], + * ], + * ], * */ 'memcache_store.servers' => [ @@ -681,10 +681,10 @@ $config = [ * * For example, for the "no" language code (Norwegian), we would have: * - * 'priorities' => array( - * 'no' => array('nb', 'nn', 'en', 'se'), + * 'priorities' => [ + * 'no' => ['nb', 'nn', 'en', 'se'], * ... - * ), + * ], * * establishing that if a translation for the "no" language code is * not available, we look for translations in "nb" (Norwegian BokmĂĄl), @@ -702,7 +702,7 @@ $config = [ * Languages available, RTL languages, and what language is the default. */ 'language.available' => [ - 'en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'ca', 'fr', 'it', 'nl', 'lb', + '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' ], @@ -745,7 +745,7 @@ $config = [ * the default language for the user. * * Example: - * 'language.get_language_function' => array('\SimpleSAML\Module\example\Template', 'getLanguage'), + * 'language.get_language_function' => ['\SimpleSAML\Module\example\Template', 'getLanguage'], */ /* @@ -856,9 +856,10 @@ $config = [ */ 'authproc.idp' => [ /* Enable the authproc filter below to add URN prefixes to all attributes - 10 => array( - 'class' => 'core:AttributeMap', 'addurnprefix' - ), */ + 10 => array[ + 'class' => 'core:AttributeMap', 'addurnprefix' + ], + */ /* Enable the authproc filter below to automatically generated eduPersonTargetedID. 20 => 'core:TargetedID', */ @@ -879,26 +880,28 @@ $config = [ /* * Search attribute "distinguishedName" for pattern and replaces if found - - 60 => array( + */ + /* + 60 => [ 'class' => 'core:AttributeAlter', 'pattern' => '/OU=studerende/', 'replacement' => 'Student', 'subject' => 'distinguishedName', '%replace', - ), - */ + ], + */ /* * Consent module is enabled (with no permanent storage, using cookies). - - 90 => array( + */ + /* + 90 => [ 'class' => 'consent:Consent', 'store' => 'consent:Cookie', 'focus' => 'yes', - 'checked' => TRUE - ), - */ + 'checked' => true + ], + */ // If language is set in Consent module it will be added as an attribute. 99 => 'core:LanguageAdaptor', ], @@ -909,27 +912,28 @@ $config = [ */ 'authproc.sp' => [ /* - 10 => array( + 10 => [ 'class' => 'core:AttributeMap', 'removeurnprefix' - ), + ], */ /* * Generate the 'group' attribute populated from other variables, including eduPersonAffiliation. - 60 => array( + 60 => [ 'class' => 'core:GenerateGroups', 'eduPersonAffiliation' - ), + ], */ /* * All users will be members of 'users' and 'members' - 61 => array( - 'class' => 'core:AttributeAdd', 'groups' => array('users', 'members') - ), + */ + /* + 61 => [ + 'class' => 'core:AttributeAdd', 'groups' => ['users', 'members'] + ], */ // Adopts language from attribute to use in UI 90 => 'core:LanguageAdaptor', - ], @@ -987,36 +991,36 @@ $config = [ * This example defines two flatfile sources. One is the default metadata directory, the other * is a metadata directory with auto-generated metadata files. * - * 'metadata.sources' => array( - * array('type' => 'flatfile'), - * array('type' => 'flatfile', 'directory' => 'metadata-generated'), - * ), + * 'metadata.sources' => [ + * ['type' => 'flatfile'], + * ['type' => 'flatfile', 'directory' => 'metadata-generated'], + * ], * * This example defines a flatfile source and an XML source. - * 'metadata.sources' => array( - * array('type' => 'flatfile'), - * array('type' => 'xml', 'file' => 'idp.example.org-idpMeta.xml'), - * ), + * 'metadata.sources' => [ + * ['type' => 'flatfile'], + * ['type' => 'xml', 'file' => 'idp.example.org-idpMeta.xml'], + * ], * * This example defines an mdq source. - * 'metadata.sources' => array( - * array( + * 'metadata.sources' => [ + * [ * 'type' => 'mdq', * 'server' => 'http://mdq.server.com:8080', * 'cachedir' => '/var/simplesamlphp/mdq-cache', * 'cachelength' => 86400 - * ) - * ), + * ] + * ], * * This example defines an pdo source. - * 'metadata.sources' => array( - * array('type' => 'pdo') - * ), + * 'metadata.sources' => [ + * ['type' => 'pdo'] + * ], * * Default: - * 'metadata.sources' => array( - * array('type' => 'flatfile') - * ), + * 'metadata.sources' => [ + * ['type' => 'flatfile'] + * ], */ 'metadata.sources' => [ ['type' => 'flatfile'], diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 26c05307f41cecc56b51b1c8532b9165c7ac258f..f9275d521f0704d3d2499c47b920976f9aac161d 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -1286,7 +1286,7 @@ class Configuration implements Utils\ClearableState $loc = $this->location.'['.var_export($name, true).']'; if (is_string($ret)) { - $ret = ['en' => $ret,]; + $ret = ['en' => $ret]; } if (!is_array($ret)) { diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php index c9e7a223d62e59d4db53530b353dc9212618f695..2b577fdc56a326a11ac249ed2c510c45672d2b64 100644 --- a/lib/SimpleSAML/Locale/Translate.php +++ b/lib/SimpleSAML/Locale/Translate.php @@ -541,7 +541,7 @@ class Translate $priorities = $langcfg->getArray('priorities', []); } - if ( !empty($priorities[$context['currentLanguage']]) ) { + if (!empty($priorities[$context['currentLanguage']])) { foreach ($priorities[$context['currentLanguage']] as $lang) { if (isset($translations[$lang])) { return $translations[$lang]; diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php index 794e825430fef1ce3514e85cf1f4b0def117e642..51449f95f970297a48f2fe11bfe1278ac43a04f9 100644 --- a/lib/SimpleSAML/XHTML/IdPDisco.php +++ b/lib/SimpleSAML/XHTML/IdPDisco.php @@ -595,31 +595,34 @@ class IdPDisco $tryLanguages = [0 => $language, 1 => $defaultLanguage, 2 => $fallbackLanguage]; $newlist = []; - foreach($idpList as $entityid => $data) { + foreach ($idpList as $entityid => $data) { $newlist[$entityid]['entityid'] = $entityid; - foreach ( $tryLanguages as $lang ) { - if ( $name = $this->getEntityDisplayName($data, $lang) ) { + foreach ($tryLanguages as $lang) { + if ($name = $this->getEntityDisplayName($data, $lang)) { $newlist[$entityid]['name'] = $name; continue; } } - if ( empty($newlist[$entityid]['name']) ) { + if (empty($newlist[$entityid]['name'])) { $newlist[$entityid]['name'] = $entityid; } - foreach ( $tryLanguages as $lang ) { - if ( !empty($data['description'][$lang]) ) { + foreach ($tryLanguages as $lang) { + if (!empty($data['description'][$lang])) { $newlist[$entityid]['description'] = $data['description'][$lang]; continue; } } - if ( !empty($data['icon']) ) { + 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']); - }); + usort( + $newlist, + function ($idpentry1, $idpentry2) { + return strcasecmp($idpentry1['name'], $idpentry2['name']); + } + ); $t->data['idplist'] = $newlist; $t->data['preferredidp'] = $preferredIdP; @@ -633,11 +636,11 @@ class IdPDisco private function getEntityDisplayName(array $idpData, $language) { - if(isset($idpData['UIInfo']['DisplayName'][$language]) ) { + if (isset($idpData['UIInfo']['DisplayName'][$language])) { return $idpData['UIInfo']['DisplayName'][$language]; - } elseif ( isset($idpData['name'][$language]) ) { + } elseif (isset($idpData['name'][$language])) { return $idpData['name'][$language]; - } elseif ( isset($idpData['OrganizationDisplayName'][$language]) ) { + } elseif (isset($idpData['OrganizationDisplayName'][$language])) { return $idpData['OrganizationDisplayName'][$language]; } return null; diff --git a/metadata-templates/saml20-idp-hosted.php b/metadata-templates/saml20-idp-hosted.php index 582af8ee93dd43babb6155f9a990af4160166d77..ecb05ce111e82712e65647eeb6f039f43b80fc1b 100644 --- a/metadata-templates/saml20-idp-hosted.php +++ b/metadata-templates/saml20-idp-hosted.php @@ -26,10 +26,10 @@ $metadata['__DYNAMIC:1__'] = [ /* Uncomment the following to use the uri NameFormat on attributes. */ /* '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'], + ], */ /* @@ -39,13 +39,13 @@ $metadata['__DYNAMIC:1__'] = [ * for more information. */ /* - 'RegistrationInfo' => array( + 'RegistrationInfo' => [ 'authority' => 'urn:mace:example.org', 'instant' => '2008-01-17T11:28:03Z', - 'policies' => array( + 'policies' => [ 'en' => 'http://example.org/policy', 'es' => 'http://example.org/politica', - ), - ), + ], + ], */ ]; diff --git a/metadata-templates/saml20-idp-remote.php b/metadata-templates/saml20-idp-remote.php index 49f44f02848603cd54b9b63e4cd3d56ae507bdd8..d390647e6c4492223c149a1812c3f3409280d130 100644 --- a/metadata-templates/saml20-idp-remote.php +++ b/metadata-templates/saml20-idp-remote.php @@ -4,7 +4,5 @@ * * Remember to remove the IdPs you don't use from this file. * - * See: https://simplesamlphp.org/docs/stable/simplesamlphp-reference-idp-remote + * See: https://simplesamlphp.org/docs/stable/simplesamlphp-reference-idp-remote */ - - diff --git a/metadata-templates/saml20-sp-remote.php b/metadata-templates/saml20-sp-remote.php index 92ff45da1ddb604dfca7f1f31951eb65cfdfefb8..a9940e8202da870bfc23199c7794c18b60454452 100644 --- a/metadata-templates/saml20-sp-remote.php +++ b/metadata-templates/saml20-sp-remote.php @@ -15,8 +15,8 @@ $metadata['https://saml2sp.example.org'] = [ /* * This example shows an example config that works with G Suite (Google Apps) for education. - * What is important is that you have an attribute in your IdP that maps to the local part of the email address - * 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 + * What is important is that you have an attribute in your IdP that maps to the local part of the email address 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'] = [ diff --git a/metadata-templates/shib13-idp-remote.php b/metadata-templates/shib13-idp-remote.php index 0757aa83bea4b8e0c65e0e629cea9c5cd311dc61..69c1ef324edad0fc605baf4fc95963e1dbca1cb4 100644 --- a/metadata-templates/shib13-idp-remote.php +++ b/metadata-templates/shib13-idp-remote.php @@ -8,8 +8,8 @@ */ /* -$metadata['theproviderid-of-the-idp'] = array( +$metadata['theproviderid-of-the-idp'] = [ 'SingleSignOnService' => 'https://idp.example.org/shibboleth-idp/SSO', 'certificate' => 'example.pem', -); +]; */ diff --git a/metadata-templates/shib13-sp-remote.php b/metadata-templates/shib13-sp-remote.php index 8d6a3247992f1810997f24b3efc6f89f86d7fe6e..f60174e28841f75a9cbf426621ca25e10abb4d0a 100644 --- a/metadata-templates/shib13-sp-remote.php +++ b/metadata-templates/shib13-sp-remote.php @@ -13,4 +13,3 @@ $metadata['https://sp.shiblab.feide.no'] = [ 'audience' => 'urn:mace:feide:shiblab', 'base64attributes' => false, ]; - diff --git a/modules/authfacebook/extlibinc/base_facebook.php b/modules/authfacebook/extlibinc/base_facebook.php index ea661c7a9a28f64f543335f576c5ea447ed58212..aa1a23efb24e0139820037d699d1809a0d82b509 100644 --- a/modules/authfacebook/extlibinc/base_facebook.php +++ b/modules/authfacebook/extlibinc/base_facebook.php @@ -828,7 +828,7 @@ abstract class BaseFacebook $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; } @@ -849,10 +849,13 @@ abstract class BaseFacebook $params['api_key'] = $this->getAppId(); $params['format'] = 'json-strings'; - $result = json_decode($this->_oauthRequest( - $this->getApiUrl($params['method']), - $params - ), true); + $result = json_decode( + $this->_oauthRequest( + $this->getApiUrl($params['method']), + $params + ), + true + ); // results are returned, errors are thrown if (is_array($result) && isset($result['error_code'])) { @@ -910,10 +913,13 @@ abstract class BaseFacebook $domainKey = 'graph'; } - $result = json_decode($this->_oauthRequest( - $this->getUrl($domainKey, $path), - $params - ), true); + $result = json_decode( + $this->_oauthRequest( + $this->getUrl($domainKey, $path), + $params + ), + true + ); // results are returned, errors are thrown if (is_array($result) && isset($result['error'])) { diff --git a/modules/core/lib/Auth/Process/PHP.php b/modules/core/lib/Auth/Process/PHP.php index 5f6168522bf062b696b91f6246952540e6f89b03..cd424c76e9a01e1b4705eb217014eab2c9ec5ed1 100644 --- a/modules/core/lib/Auth/Process/PHP.php +++ b/modules/core/lib/Auth/Process/PHP.php @@ -49,7 +49,10 @@ class PHP extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($request)); assert(array_key_exists('Attributes', $request)); - $function = function (/** @scrutinizer ignore-unused */ &$attributes, /** @scrutinizer ignore-unused */ &$state) { + $function = function ( + /** @scrutinizer ignore-unused */ &$attributes, + /** @scrutinizer ignore-unused */ &$state + ) { eval($this->code); }; $function($request['Attributes'], $request); diff --git a/modules/core/www/frontpage_config.php b/modules/core/www/frontpage_config.php index 75bfc2856857fae5b9f26037081d7589ff53ccbb..02accc6fb8da3ceaa3cf1e30abd9ec4f0af4f2ed 100644 --- a/modules/core/www/frontpage_config.php +++ b/modules/core/www/frontpage_config.php @@ -59,7 +59,7 @@ $allLinks = [ $current = $config->getVersion(); if ($config->getBoolean('admin.checkforupdates', true) && $current !== 'master') { if (!function_exists('curl_init')) { - $warnings[] = [ '{core:frontpage:warnings_curlmissing}' ]; + $warnings[] = ['{core:frontpage:warnings_curlmissing}']; } else { $latest = $session->getData("core:latest_simplesamlphp_version", "version"); diff --git a/modules/core/www/frontpage_federation.php b/modules/core/www/frontpage_federation.php index 1d00be38e7873e5702d2331965dad4fb20bb1b28..267a54a53ff1c0911924375e53cf60a6562d656f 100644 --- a/modules/core/www/frontpage_federation.php +++ b/modules/core/www/frontpage_federation.php @@ -121,7 +121,7 @@ foreach ($metaentries['hosted'] as $index => $entity) { $metaentries['hosted'][$index][$new] = $entity[$old][$defaultLanguage]; } elseif (isset($entity[$old][$fallbackLanguage])) { $metaentries['hosted'][$index][$new] = $entity[$old][$fallbackLanguage]; - } + } } } foreach ($metaentries['remote'] as $key => $set) { diff --git a/modules/oauth/lib/Registry.php b/modules/oauth/lib/Registry.php index 0ff3b5105fed72f94ca1d3d13fa210d488ed73c0..0939be6f410ce90c587c388c7ffa15e7cbc89c12 100644 --- a/modules/oauth/lib/Registry.php +++ b/modules/oauth/lib/Registry.php @@ -11,6 +11,17 @@ namespace SimpleSAML\Module\oauth; class Registry { + public static function requireOwnership($entry, $userid) + { + if (!isset($entry['owner'])) { + throw new \Exception('OAuth Consumer has no owner. Which means no one is granted access, not even you.'); + } elseif ($entry['owner'] !== $userid) { + throw new \Exception( + 'OAuth Consumer has an owner that is not equal to your userid, hence you are not granted access.' + ); + } + } + protected function getStandardField($request, &$entry, $key) { if (array_key_exists('field_'.$key, $request)) { diff --git a/modules/oauth/www/registry.edit.php b/modules/oauth/www/registry.edit.php index c9a50b2f32f5fd4f683f122910f89a6b9e9779eb..a367c482050addb0af428e566bcdc40a6b1564bc 100644 --- a/modules/oauth/www/registry.edit.php +++ b/modules/oauth/www/registry.edit.php @@ -22,22 +22,10 @@ if ($session->isValid($authsource)) { $as->initLogin(\SimpleSAML\Utils\HTTP::getSelfURL()); } -function requireOwnership($entry, $userid) -{ - if (!isset($entry['owner'])) { - 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.' - ); - } -} - if (array_key_exists('editkey', $_REQUEST)) { $entryc = $store->get('consumers', $_REQUEST['editkey'], ''); $entry = $entryc['value']; - requireOwnership($entry, $userid); + \SimpleSAML\Module\oauth\Registry::requireOwnership($entry, $userid); } else { $entry = [ 'owner' => $userid, @@ -53,7 +41,7 @@ if (isset($_POST['submit'])) { $entry = $editor->formToMeta($_POST, [], ['owner' => $userid]); - requireOwnership($entry, $userid); + \SimpleSAML\Module\oauth\Registry::requireOwnership($entry, $userid); $store->set('consumers', $entry['key'], '', $entry); diff --git a/modules/oauth/www/registry.php b/modules/oauth/www/registry.php index 3f3403bf1193b9400332adf41b511f18b1b89642..4431835a63786095977605465fdb10254b097940 100644 --- a/modules/oauth/www/registry.php +++ b/modules/oauth/www/registry.php @@ -21,23 +21,11 @@ if ($session->isValid($authsource)) { $as->initLogin(\SimpleSAML\Utils\HTTP::getSelfURL()); } -function requireOwnership($entry, $userid) -{ - if (!isset($entry['owner'])) { - 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.' - ); - } -} - if (isset($_REQUEST['delete'])) { $entryc = $store->get('consumers', $_REQUEST['delete'], ''); $entry = $entryc['value']; - requireOwnership($entry, $userid); + \SimpleSAML\Module\oauth\Registry::requireOwnership($entry, $userid); $store->remove('consumers', $entry['key'], ''); } diff --git a/tests/BuiltInServer.php b/tests/BuiltInServer.php index e98a4a61c43341ebdd426d964d1596f8ffda7408..0695e8c7eed2d5a37ffbe53596881130a6f92ad0 100644 --- a/tests/BuiltInServer.php +++ b/tests/BuiltInServer.php @@ -9,7 +9,6 @@ namespace SimpleSAML\Test; - class BuiltInServer { diff --git a/tests/Utils/ClearStateTestCase.php b/tests/Utils/ClearStateTestCase.php index 2cecc16b4c5d46af5774f50ee9332737f34b2389..d7d11c8919b324b830c0b68421bc755c447703d5 100644 --- a/tests/Utils/ClearStateTestCase.php +++ b/tests/Utils/ClearStateTestCase.php @@ -2,7 +2,7 @@ namespace SimpleSAML\Test\Utils; -include(dirname(__FILE__) . '/StateClearer.php'); +include(dirname(__FILE__).'/StateClearer.php'); use PHPUnit\Framework\TestCase; diff --git a/tests/Utils/ReduceSpillOverTest.php b/tests/Utils/ReduceSpillOverTest.php index 82f82da397dd832ccd2d30b05502851c3592fbbf..c744e2a5fda3cfdb43249715a709f06527ff1a81 100644 --- a/tests/Utils/ReduceSpillOverTest.php +++ b/tests/Utils/ReduceSpillOverTest.php @@ -17,7 +17,7 @@ class ReduceSpillOverTest extends ClearStateTestCase $_SERVER['QUERY_STRING'] = 'a=b'; \SimpleSAML\Configuration::loadFromArray(['a' => 'b'], '[ARRAY]', 'simplesaml'); $this->assertEquals('b', \SimpleSAML\Configuration::getInstance()->getString('a')); - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); } /** diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 4ec9274b9b08c126d52bc3286c5b9c877eed2a4e..82ed397dc1f01a6d83f49ee20bbb44c2dff15267 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,7 +1,7 @@ <?php $projectRoot = dirname(__DIR__); -require_once($projectRoot . '/vendor/autoload.php'); +require_once($projectRoot.'/vendor/autoload.php'); // Current SSP autoloader can't resolve classes from the tests folder. -include($projectRoot . '/tests/Utils/ClearStateTestCase.php'); +include($projectRoot.'/tests/Utils/ClearStateTestCase.php'); diff --git a/tests/lib/SimpleSAML/Auth/StateTest.php b/tests/lib/SimpleSAML/Auth/StateTest.php index 210d7ddfc9e22354890a0cfdf8e41f4aae23e757..cb78b81197a5fa0f349b202b17db90a152631a5f 100644 --- a/tests/lib/SimpleSAML/Auth/StateTest.php +++ b/tests/lib/SimpleSAML/Auth/StateTest.php @@ -1,18 +1,19 @@ <?php +namespace SimpleSAML\Test\Auth; + use PHPUnit\Framework\TestCase; /** * Tests for \SimpleSAML\Auth\State */ -class Auth_StateTest extends TestCase +class StateTest extends TestCase { /** * Test the getPersistentAuthData() function. */ public function testGetPersistentAuthData() { - $mandatory = [ 'Attributes' => [], 'Expire' => 1234, diff --git a/tests/lib/SimpleSAML/ConfigurationTest.php b/tests/lib/SimpleSAML/ConfigurationTest.php index 9f7d4dcd385d742bf94fa10e98280a7d7f38bc22..474495e84443c5485883c89bfee1183d7d9269da 100644 --- a/tests/lib/SimpleSAML/ConfigurationTest.php +++ b/tests/lib/SimpleSAML/ConfigurationTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test; + use \SimpleSAML\Configuration; /** * Tests for \SimpleSAML\Configuration */ -class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase +class ConfigurationTest extends \SimpleSAML\Test\Utils\ClearStateTestCase { /** * Test \SimpleSAML\Configuration::getVersion() @@ -208,7 +210,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase public function testGetBaseDir() { $c = Configuration::loadFromArray([]); - $this->assertEquals($c->getBaseDir(), dirname(dirname(dirname(dirname(__FILE__)))) . '/'); + $this->assertEquals($c->getBaseDir(), dirname(dirname(dirname(dirname(__FILE__)))).'/'); $c = Configuration::loadFromArray([ 'basedir' => '/basedir', @@ -364,7 +366,8 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase /** * Test \SimpleSAML\Configuration::getValueValidate() */ - public function testGetValueValidate() { + public function testGetValueValidate() + { $c = Configuration::loadFromArray([ 'opt' => 'b', ]); @@ -439,7 +442,8 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase } /** - * Test \SimpleSAML\Configuration::getArrayizeString() option with an array that contains something that isn't a string. + * Test \SimpleSAML\Configuration::getArrayizeString() option + * with an array that contains something that isn't a string. * @expectedException Exception */ public function testGetArrayizeStringWrongValue() @@ -483,8 +487,8 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase { $c = Configuration::loadFromArray([ 'opts' => [ - 'a' => ['opt1' => 'value1'], - 'b' => ['opt2' => 'value2'], + 'a' => ['opt1' => 'value1'], + 'b' => ['opt2' => 'value2'], ], ]); $this->assertEquals($c->getConfigList('missing_opt', '--missing--'), '--missing--'); @@ -751,7 +755,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase try { $c->getDefaultEndpoint('SingleLogoutService', $valid_bindings); $this->fail('Failed to detect invalid endpoint binding.'); - } catch (Exception $e) { + } catch (\Exception $e) { $this->assertEquals( '[ARRAY][\'SingleLogoutService\']:Could not find a supported SingleLogoutService '.'endpoint.', $e->getMessage() @@ -762,7 +766,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase try { $c->getDefaultEndpoint('SingleSignOnService'); $this->fail('No valid metadata set specified.'); - } catch (Exception $e) { + } catch (\Exception $e) { $this->assertStringStartsWith('Missing default binding for', $e->getMessage()); } } @@ -865,7 +869,7 @@ class Test_Configuration extends SimpleSAML\Test\Utils\ClearStateTestCase $c = Configuration::loadFromArray($a); try { $c->getEndpoints('SingleSignOnService'); - } catch (Exception $e) { + } catch (\Exception $e) { $this->assertStringEndsWith($msgs[$i], $e->getMessage()); } } diff --git a/tests/lib/SimpleSAML/DatabaseTest.php b/tests/lib/SimpleSAML/DatabaseTest.php index 82f292c4dfb1415d067facba93eb42f92d135527..f48246fd2b7503135e4f378cff0ac68ed0d7b2aa 100644 --- a/tests/lib/SimpleSAML/DatabaseTest.php +++ b/tests/lib/SimpleSAML/DatabaseTest.php @@ -1,5 +1,7 @@ <?php +namespace SimpleSAML\Test; + use PHPUnit\Framework\TestCase; /** @@ -35,7 +37,7 @@ class DatabaseTest extends TestCase */ protected static function getMethod($getMethod) { - $class = new ReflectionClass('SimpleSAML\Database'); + $class = new \ReflectionClass('SimpleSAML\Database'); $method = $class->getMethod($getMethod); $method->setAccessible(true); return $method; @@ -65,7 +67,7 @@ class DatabaseTest extends TestCase $this->assertInstanceOf('SimpleSAML\Configuration', $this->config); $this->assertEquals($config['database.dsn'], $this->config->getString('database.dsn')); - $this->db = SimpleSAML\Database::getInstance($this->config); + $this->db = \SimpleSAML\Database::getInstance($this->config); // Ensure that we have a functional database class. $this->assertInstanceOf('SimpleSAML\Database', $this->db); @@ -92,7 +94,7 @@ class DatabaseTest extends TestCase ]; $this->config = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); - SimpleSAML\Database::getInstance($this->config); + \SimpleSAML\Database::getInstance($this->config); } @@ -176,7 +178,7 @@ class DatabaseTest extends TestCase { $getSlave = self::getMethod('getSlave'); - $master = spl_object_hash(PHPUnit_Framework_Assert::readAttribute($this->db, 'dbMaster')); + $master = spl_object_hash(\PHPUnit_Framework_Assert::readAttribute($this->db, 'dbMaster')); $slave = spl_object_hash($getSlave->invokeArgs($this->db, [])); $this->assertTrue(($master == $slave), "getSlave should have returned the master database object"); @@ -199,7 +201,7 @@ class DatabaseTest extends TestCase $sspConfiguration = new \SimpleSAML\Configuration($config, "test/SimpleSAML/DatabaseTest.php"); $msdb = \SimpleSAML\Database::getInstance($sspConfiguration); - $slaves = PHPUnit_Framework_Assert::readAttribute($msdb, 'dbSlaves'); + $slaves = \PHPUnit_Framework_Assert::readAttribute($msdb, 'dbSlaves'); $gotSlave = spl_object_hash($getSlave->invokeArgs($msdb, [])); $this->assertEquals( @@ -248,7 +250,7 @@ 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)", - ['ssp_key' => [$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."); diff --git a/tests/lib/SimpleSAML/Locale/LocalizationTest.php b/tests/lib/SimpleSAML/Locale/LocalizationTest.php index 0d67caa0ed42b785ec037f5204cd44d6187b9ff4..cc58f1ebe66632efcd6ffac4b9d4ce21e5391c8a 100644 --- a/tests/lib/SimpleSAML/Locale/LocalizationTest.php +++ b/tests/lib/SimpleSAML/Locale/LocalizationTest.php @@ -45,5 +45,4 @@ class LocalizationTest extends TestCase $this->assertArrayHasKey($newDomain, $registeredDomains); $this->assertEquals($registeredDomains[$newDomain], $newDomainLocaleDir); } - } diff --git a/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php b/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php index ce301db53d5c21324ebd4a9b7486810e54cddf3d..7e8f918f7f0af6703f3df62fdfafee039bf267ad 100644 --- a/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php +++ b/tests/lib/SimpleSAML/Metadata/MetaDataStorageSourceTest.php @@ -1,16 +1,19 @@ <?php +namespace SimpleSAML\Test\Metadata; + /** * Class MetaDataStorageSourceTest */ -class MetaDataStorageSourceTest extends PHPUnit_Framework_TestCase +class MetaDataStorageSourceTest extends \PHPUnit_Framework_TestCase { /** * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig XML bad source * @expectedException \Exception */ - public function testBadXMLSource() { + public function testBadXMLSource() + { \SimpleSAML\Metadata\MetaDataStorageSource::getSource(["type"=>"xml", "foo"=>"baa"]); } @@ -18,7 +21,8 @@ class MetaDataStorageSourceTest extends PHPUnit_Framework_TestCase * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig invalid static XML source * @expectedException Exception */ - public function testInvalidStaticXMLSource() { + public function testInvalidStaticXMLSource() + { $strTestXML = " <EntityDescriptor ID=\"_12345678-90ab-cdef-1234-567890abcdef\" entityID=\"https://saml.idp/entityid\" xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\"> </EntityDescriptor> @@ -29,7 +33,8 @@ class MetaDataStorageSourceTest extends PHPUnit_Framework_TestCase /** * Test \SimpleSAML\Metadata\MetaDataStorageSourceTest::getConfig XML static XML source */ - public function testStaticXMLSource() { + public function testStaticXMLSource() + { $testEntityId = "https://saml.idp/entityid"; $strTestXML = " <EntityDescriptor ID=\"_12345678-90ab-cdef-1234-567890abcdef\" entityID=\"$testEntityId\" xmlns=\"urn:oasis:names:tc:SAML:2.0:metadata\"> @@ -49,8 +54,8 @@ xmlns:fed=\"http://docs.oasis-open.org/wsfed/federation/200706\"> // As a secondary thing, check that the entity ID from the static source provided can be extracted $source = \SimpleSAML\Metadata\MetaDataStorageSource::getSource(["type"=>"xml", "xml"=>$strTestXML]); $idpSet = $source->getMetadataSet("saml20-idp-remote"); - $this->assertArrayHasKey($testEntityId, $idpSet, "Did not extract expected IdP entity ID from static XML source"); - // Finally verify that a different entity ID does not get loaded + $this->assertArrayHasKey($testEntityId, $idpSet, "Did not extract expected IdP entity ID from static XML source"); + // Finally verify that a different entity ID does not get loaded $this->assertCount(1, $idpSet, "Unexpectedly got metadata for an alternate entity than that defined"); } } diff --git a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php index c06cb54672d07d53723fd2e24bb6b2e42a25a84a..008a26063c5278b949007add51ac873bb0aa8b60 100644 --- a/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php +++ b/tests/lib/SimpleSAML/Metadata/SAMLBuilderTest.php @@ -1,5 +1,7 @@ <?php +namespace SimpleSAML\Test\Metadata; + use PHPUnit\Framework\TestCase; use SimpleSAML\Metadata\SAMLBuilder; @@ -160,26 +162,26 @@ class SAMLBuilderTest extends TestCase $spDesc = $samlBuilder->getEntityDescriptor(); $acs = $spDesc->getElementsByTagName("AttributeConsumingService"); - $acs1 = $acs->item(0); + $acs1 = $acs->item(0); $this->assertFalse($acs1->hasAttribute("isDefault")); - $metadata['attributes.isDefault'] = true; + $metadata['attributes.isDefault'] = true; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); $spDesc = $samlBuilder->getEntityDescriptor(); $acs = $spDesc->getElementsByTagName("AttributeConsumingService"); - $acs1 = $acs->item(0); + $acs1 = $acs->item(0); $this->assertTrue($acs1->hasAttribute("isDefault")); $this->assertEquals("true", $acs1->getAttribute("isDefault")); - $metadata['attributes.isDefault'] = false; + $metadata['attributes.isDefault'] = false; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); $spDesc = $samlBuilder->getEntityDescriptor(); $acs = $spDesc->getElementsByTagName("AttributeConsumingService"); - $acs1 = $acs->item(0); + $acs1 = $acs->item(0); $this->assertTrue($acs1->hasAttribute("isDefault")); $this->assertEquals("false", $acs1->getAttribute("isDefault")); } @@ -207,18 +209,18 @@ class SAMLBuilderTest extends TestCase $spDesc = $samlBuilder->getEntityDescriptor(); $acs = $spDesc->getElementsByTagName("AttributeConsumingService"); - $acs1 = $acs->item(0); + $acs1 = $acs->item(0); $this->assertTrue($acs1->hasAttribute("index")); $this->assertEquals("0", $acs1->getAttribute("index")); - $metadata['attributes.index'] = 15; + $metadata['attributes.index'] = 15; $samlBuilder = new SAMLBuilder($entityId); $samlBuilder->addMetadata($set, $metadata); $spDesc = $samlBuilder->getEntityDescriptor(); $acs = $spDesc->getElementsByTagName("AttributeConsumingService"); - $acs1 = $acs->item(0); + $acs1 = $acs->item(0); $this->assertTrue($acs1->hasAttribute("index")); $this->assertEquals("15", $acs1->getAttribute("index")); } diff --git a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php index cfed7b198546d7e3c0a79b9d1840062afc2f9eb0..a443d0e313f0acca03e12101d47189deeb9f44c5 100644 --- a/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php +++ b/tests/lib/SimpleSAML/Metadata/SAMLParserTest.php @@ -1,6 +1,6 @@ <?php -namespace SimpleSAML\Metadata; +namespace SimpleSAML\Test\Metadata; use PHPUnit\Framework\TestCase; @@ -9,7 +9,6 @@ use PHPUnit\Framework\TestCase; */ class SAMLParserTest extends TestCase { - /** * Test Registration Info is parsed */ @@ -38,7 +37,6 @@ XML // RegistrationInfo is accessible in the SP or IDP metadata accessors $metadata = $entities['theEntityID']->getMetadata20SP(); $this->assertEquals($expected, $metadata['RegistrationInfo']); - } /** @@ -125,11 +123,14 @@ XML $this->assertEquals("Example service", $metadata['name']['en']); $this->assertEquals("Dit is een voorbeeld voor de unittest.", $metadata['description']['nl']); - $expected_a = ["urn:mace:dir:attribute-def:eduPersonPrincipalName", "urn:mace:dir:attribute-def:mail", "urn:mace:dir:attribute-def:displayName"]; + $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/Utils/ConfigTest.php b/tests/lib/SimpleSAML/Utils/ConfigTest.php index 43525cf30c356a9fbdd4697352cd3f3814524ac9..6077a6301c45627eb860ac672343b29217ad21f0 100644 --- a/tests/lib/SimpleSAML/Utils/ConfigTest.php +++ b/tests/lib/SimpleSAML/Utils/ConfigTest.php @@ -20,7 +20,7 @@ class ConfigTest extends TestCase putenv('SIMPLESAMLPHP_CONFIG_DIR'); $configDir = Config::getConfigDir(); - $this->assertEquals($configDir, dirname(dirname(dirname(dirname(__DIR__)))) . '/config'); + $this->assertEquals($configDir, dirname(dirname(dirname(dirname(__DIR__)))).'/config'); } @@ -29,7 +29,7 @@ class ConfigTest extends TestCase */ public function testEnvVariableConfigDir() { - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); $configDir = Config::getConfigDir(); $this->assertEquals($configDir, __DIR__); @@ -40,7 +40,7 @@ class ConfigTest extends TestCase */ public function testEnvRedirectVariableConfigDir() { - putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); $configDir = Config::getConfigDir(); $this->assertEquals($configDir, __DIR__); @@ -51,8 +51,8 @@ class ConfigTest extends TestCase */ public function testEnvRedirectPriorityVariableConfigDir() { - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . dirname(__DIR__)); - putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + putenv('SIMPLESAMLPHP_CONFIG_DIR='.dirname(__DIR__)); + putenv('REDIRECT_SIMPLESAMLPHP_CONFIG_DIR='.__DIR__); $configDir = Config::getConfigDir(); $this->assertEquals($configDir, dirname(__DIR__)); @@ -65,13 +65,13 @@ class ConfigTest extends TestCase public function testInvalidEnvVariableConfigDirThrowsException() { // I used a random hash to ensure this test directory is always invalid - $invalidDir = __DIR__ . '/e9826ad19cbc4f5bf20c0913ffcd2ce6'; - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . $invalidDir); + $invalidDir = __DIR__.'/e9826ad19cbc4f5bf20c0913ffcd2ce6'; + putenv('SIMPLESAMLPHP_CONFIG_DIR='.$invalidDir); $this->setExpectedException( 'InvalidArgumentException', - 'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. ' . - 'Given: "' . $invalidDir . '"' + 'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. '. + 'Given: "'.$invalidDir.'"' ); Config::getConfigDir(); diff --git a/tests/lib/SimpleSAML/Utils/CryptoTest.php b/tests/lib/SimpleSAML/Utils/CryptoTest.php index db0080f56df6a43a7244e8010dd0ab594899cec9..23194596991d1cde678606bcb22061b0d012a0dd 100644 --- a/tests/lib/SimpleSAML/Utils/CryptoTest.php +++ b/tests/lib/SimpleSAML/Utils/CryptoTest.php @@ -34,7 +34,7 @@ class CryptoTest extends TestCase * * @expectedException \InvalidArgumentException * - * @covers \SimpleSAML\Utils\Crypto::_aesDecrypt + * @covers \SimpleSAML\Utils\Crypto::aesDecrypt */ public function testAesDecryptBadInput() { @@ -50,7 +50,7 @@ class CryptoTest extends TestCase * * @expectedException \InvalidArgumentException * - * @covers \SimpleSAML\Utils\Crypto::_aesEncrypt + * @covers \SimpleSAML\Utils\Crypto::aesEncrypt */ public function testAesEncryptBadInput() { @@ -65,7 +65,7 @@ class CryptoTest extends TestCase * Test that aesDecrypt() works properly, being able to decrypt some previously known (and correct) * ciphertext. * - * @covers \SimpleSAML\Utils\Crypto::_aesDecrypt + * @covers \SimpleSAML\Utils\Crypto::aesDecrypt */ public function testAesDecrypt() { @@ -86,8 +86,8 @@ class CryptoTest extends TestCase /** * Test that aesEncrypt() produces ciphertexts that aesDecrypt() can decrypt. * - * @covers \SimpleSAML\Utils\Crypto::_aesDecrypt - * @covers \SimpleSAML\Utils\Crypto::_aesEncrypt + * @covers \SimpleSAML\Utils\Crypto::aesDecrypt + * @covers \SimpleSAML\Utils\Crypto::aesEncrypt */ public function testAesEncrypt() { diff --git a/tests/lib/SimpleSAML/Utils/HTTPTest.php b/tests/lib/SimpleSAML/Utils/HTTPTest.php index 986a813b1758bc096d2fc600010cebac97d8955b..295c18636bb3f699293a22cc9471f0c7bfbc4c6e 100644 --- a/tests/lib/SimpleSAML/Utils/HTTPTest.php +++ b/tests/lib/SimpleSAML/Utils/HTTPTest.php @@ -1,4 +1,5 @@ <?php + namespace SimpleSAML\Test\Utils; use PHPUnit\Framework\TestCase; diff --git a/tests/lib/SimpleSAML/Utils/SystemTest.php b/tests/lib/SimpleSAML/Utils/SystemTest.php index 7363c34f671e626479c8c280a47501e6e328d930..99a77ebe08a0890f345b26583cbac427e79fb182 100644 --- a/tests/lib/SimpleSAML/Utils/SystemTest.php +++ b/tests/lib/SimpleSAML/Utils/SystemTest.php @@ -115,10 +115,10 @@ class SystemTest extends TestCase */ public function testWriteFileBasic() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); - $filename = $this->root_directory . DIRECTORY_SEPARATOR . 'test'; + $filename = $this->root_directory.DIRECTORY_SEPARATOR.'test'; System::writeFile($filename, ''); @@ -133,10 +133,10 @@ class SystemTest extends TestCase */ public function testWriteFileContents() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); - $filename = $this->root_directory . DIRECTORY_SEPARATOR . 'test'; + $filename = $this->root_directory.DIRECTORY_SEPARATOR.'test'; $contents = 'TEST'; System::writeFile($filename, $contents); @@ -155,10 +155,10 @@ class SystemTest extends TestCase */ public function testWriteFileMode() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); - $filename = $this->root_directory . DIRECTORY_SEPARATOR . 'test'; + $filename = $this->root_directory.DIRECTORY_SEPARATOR.'test'; $mode = 0666; System::writeFile($filename, '', $mode); @@ -177,7 +177,7 @@ class SystemTest extends TestCase */ public function testGetTempDirBasic() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); $res = System::getTempDir(); @@ -195,7 +195,7 @@ class SystemTest extends TestCase */ public function testGetTempDirNonExistant() { - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . 'nonexistant'; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.'nonexistant'; $config = $this->setConfigurationTempDir($tempdir); $res = System::getTempDir(); @@ -220,7 +220,7 @@ class SystemTest extends TestCase $bad_uid = posix_getuid() + 1; - $tempdir = $this->root_directory . DIRECTORY_SEPARATOR . self::DEFAULTTEMPDIR; + $tempdir = $this->root_directory.DIRECTORY_SEPARATOR.self::DEFAULTTEMPDIR; $config = $this->setConfigurationTempDir($tempdir); chown($tempdir, $bad_uid); diff --git a/tests/lib/SimpleSAML/Utils/XMLTest.php b/tests/lib/SimpleSAML/Utils/XMLTest.php index fe3694d131830c7808f4c71b2730e2881b0a3b10..a81e6eb4b668fd1c6356abc13bf2ee3c18eb2ae6 100644 --- a/tests/lib/SimpleSAML/Utils/XMLTest.php +++ b/tests/lib/SimpleSAML/Utils/XMLTest.php @@ -135,7 +135,7 @@ class XMLTest extends TestCase $element->appendChild(new \DOMText($data2)); $res = XML::getDOMText($element); - $expected = $data1 . $data2 . $data1 . $data2; + $expected = $data1.$data2.$data1.$data2; $this->assertEquals($expected, $res); } diff --git a/tests/lib/SimpleSAML/XML/ErrorsTest.php b/tests/lib/SimpleSAML/XML/ErrorsTest.php index 5710650a2a684f6b28d328c9b6efec64378a8b5d..4c0f929139c4b7ee1d467eb1d43e171f3f74723f 100644 --- a/tests/lib/SimpleSAML/XML/ErrorsTest.php +++ b/tests/lib/SimpleSAML/XML/ErrorsTest.php @@ -9,7 +9,6 @@ * @package simplesamlphp/simplesamlphp */ - namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; diff --git a/tests/lib/SimpleSAML/XML/ParserTest.php b/tests/lib/SimpleSAML/XML/ParserTest.php index acd2bd9c946d7f7b2329f3c8739a19adb376623b..2e4e1891e1479496fc778c5ad9ceb49a21897dfc 100644 --- a/tests/lib/SimpleSAML/XML/ParserTest.php +++ b/tests/lib/SimpleSAML/XML/ParserTest.php @@ -8,7 +8,6 @@ * file that was distributed with this source code. */ - namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; diff --git a/tests/lib/SimpleSAML/XML/SignerTest.php b/tests/lib/SimpleSAML/XML/SignerTest.php index fda19f8f2aa9cf58fcfba155694bd7bf7e9a135d..f14ef5111b3fff4d1239583676a2b432c5900ad9 100644 --- a/tests/lib/SimpleSAML/XML/SignerTest.php +++ b/tests/lib/SimpleSAML/XML/SignerTest.php @@ -1,6 +1,6 @@ <?php -namespace SimpleSAML\Test\Utils; +namespace SimpleSAML\Test\XML; use PHPUnit\Framework\TestCase; use \SimpleSAML\Configuration; diff --git a/tests/lib/SimpleSAML/XML/ValidatorTest.php b/tests/lib/SimpleSAML/XML/ValidatorTest.php index bc8a197a604a6264dfc10da7b8458c7a54d8c467..b274ad9a89a7d3b9612228188ae397236052afbf 100644 --- a/tests/lib/SimpleSAML/XML/ValidatorTest.php +++ b/tests/lib/SimpleSAML/XML/ValidatorTest.php @@ -202,7 +202,7 @@ NOWDOC; $result = $validator->getX509Certificate(); // getX509Certificate returns a certificate with a newline - $expected = $this->good_certificate . "\n"; + $expected = $this->good_certificate."\n"; $this->assertEquals($result, $expected); } diff --git a/tests/modules/consent/lib/Auth/Process/ConsentTest.php b/tests/modules/consent/lib/Auth/Process/ConsentTest.php index d6b4e8b7158c50feaf7e94ef26f5d7b9c549a2d5..1e162314720ab0cdeda95d15f02456c15b9c8a94 100644 --- a/tests/modules/consent/lib/Auth/Process/ConsentTest.php +++ b/tests/modules/consent/lib/Auth/Process/ConsentTest.php @@ -185,9 +185,15 @@ class ConsentTest extends TestCase { $reflection = new \ReflectionClass('\SimpleSAML\Module\consent\Auth\Process\Consent'); - foreach ([ - 'includeValues', 'checked', 'focus', 'hiddenAttributes', 'noconsentattributes', 'showNoConsentAboutService' - ] as $v) { + $values = [ + 'includeValues', + 'checked', + 'focus', + 'hiddenAttributes', + 'noconsentattributes', + 'showNoConsentAboutService' + ]; + foreach ($values as $v) { $instanceVars[$v] = $reflection->getProperty($v); $instanceVars[$v]->setAccessible(true); } @@ -209,10 +215,12 @@ class ConsentTest extends TestCase $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['showNoConsentAboutService']->getValue($testcase), + $config['showNoConsentAboutService'] + ); - $deprecated = $reflection->newInstance(['noconsentattributes' => $config['attributes.exclude'],], null); + $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 c84fbc95e14e36bb95c2b05f2ea3c96b17354652..50cf5b3d19186357255dce4c649cd817524ab005 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeAddTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeAddTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:AttributeAdd filter. */ -class Test_Core_Auth_Process_AttributeAdd extends TestCase +class AttributeAddTest extends TestCase { /** diff --git a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php index 45421547057821896c038fe6a8e7ab001c42930c..b8f9c7bb9b2649f041ea15c3b61797c6b6e39521 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeAlterTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:AttributeAlter filter. */ -class Test_Core_Auth_Process_AttributeAlter extends TestCase +class AttributeAlterTest extends TestCase { /** @@ -91,9 +93,11 @@ class Test_Core_Auth_Process_AttributeAlter extends TestCase $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes, + $this->assertEquals( + $attributes, ['something' => ['somevalue'], - 'somethingelse' => ['someothervalue']]); + 'somethingelse' => ['someothervalue']] + ); } /** diff --git a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php index cedd9432219d948c7fc97d9d95b1475a21cccc8d..538bd10e09464b607fa351ba0e2e2770485cf2e6 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeCopyTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:AttributeCopy filter. */ -class Test_Core_Auth_Process_AttributeCopy extends TestCase +class AttributeCopyTest extends TestCase { /** @@ -17,7 +19,7 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase */ private static function processFilter(array $config, array $request) { - $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeCopy($config, NULL); + $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeCopy($config, null); $filter->process($request); return $request; } @@ -46,7 +48,7 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase public function testArray() { $config = [ - 'test' => ['new1','new2'], + 'test' => ['new1', 'new2'], ]; $request = [ 'Attributes' => ['test' => ['AAP']], @@ -95,14 +97,14 @@ class Test_Core_Auth_Process_AttributeCopy extends TestCase 'test2' => 'new2', ]; $request = [ - 'Attributes' => ['test1' => ['val1'], 'test2' => ['val2.1','val2.2']], + 'Attributes' => ['test1' => ['val1'], 'test2' => ['val2.1', 'val2.2']], ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $this->assertArrayHasKey('new1', $attributes); $this->assertEquals($attributes['new1'], ['val1']); $this->assertArrayHasKey('new2', $attributes); - $this->assertEquals($attributes['new2'], ['val2.1','val2.2']); + $this->assertEquals($attributes['new2'], ['val2.1', 'val2.2']); } /** diff --git a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php index 9bc2260cea3e266123abb56939417f0a8c83fd3c..01e2a6bee53060c72a1c9a3aae39e8a1b82b1267 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeLimitTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:AttributeLimit filter. */ -class Test_Core_Auth_Process_AttributeLimitTest extends TestCase +class AttributeLimitTest extends TestCase { /** * Helper function to run the filter with a given configuration. @@ -16,7 +18,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase */ private static function processFilter(array $config, array $request) { - $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeLimit($config, NULL); + $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeLimit($config, null); $filter->process($request); return $request; } @@ -40,7 +42,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase 'Destination' => [ ], 'Source' => [ - 'attributes' => ['cn','mail'], + 'attributes' => ['cn', 'mail'], ], ]; @@ -54,7 +56,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $config = [ 'cn', - 'default' => TRUE, + 'default' => true, ]; $result = self::processFilter($config, $request); @@ -64,8 +66,6 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertArrayNotHasKey('eduPersonTargetedID', $attributes); $this->assertArrayNotHasKey('eduPersonAffiliation', $attributes); $this->assertCount(2, $attributes); - - } /** @@ -100,7 +100,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $config = [ 'cn', - 'default' => TRUE, + 'default' => true, ]; $result = self::processFilter($config, $request); @@ -139,7 +139,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase 'mail' => ['user@example.org'], ], 'Destination' => [ - 'attributes' => ['cn','mail'], + 'attributes' => ['cn', 'mail'], ], 'Source' => [ ], @@ -168,7 +168,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testDefaultWithMetadata() { $config = [ - 'default' => TRUE, + 'default' => true, ]; $result = self::processFilter($config, self::$request); @@ -184,7 +184,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testDefaultWithAttrs() { $config = [ - 'default' => TRUE, + 'default' => true, 'eduPersonTargetedID', 'eduPersonAffiliation', ]; @@ -205,7 +205,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testInvalidConfig() { $config = [ - 'invalidArg' => TRUE, + 'invalidArg' => true, ]; self::processFilter($config, self::$request); @@ -219,7 +219,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testInvalidAttributeName() { $config = [ - null + null ]; self::processFilter($config, self::$request); @@ -232,7 +232,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testMatchAttributeValues() { $config = [ - 'eduPersonAffiliation' => ['member'] + 'eduPersonAffiliation' => ['member'] ]; $result = self::processFilter($config, self::$request); @@ -242,7 +242,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); $config = [ - 'eduPersonAffiliation' => ['member','staff'] + 'eduPersonAffiliation' => ['member', 'staff'] ]; $result = self::processFilter($config, self::$request); @@ -252,22 +252,22 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); $config = [ - 'eduPersonAffiliation' => ['student'] + 'eduPersonAffiliation' => ['student'] ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); $config = [ - 'eduPersonAffiliation' => ['student','staff'] + 'eduPersonAffiliation' => ['student', 'staff'] ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; $this->assertCount(0, $attributes); } - public function testBadOptionsNotTreatedAsValidValues() { - + public function testBadOptionsNotTreatedAsValidValues() + { // Ensure really misconfigured ignoreCase and regex options are not interpretted as valid valus $config = [ 'eduPersonAffiliation' => ['ignoreCase' => 'member', 'nomatch'], @@ -282,7 +282,8 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase * Verify that the true value for ignoreCase doesn't get converted into a string ('1') by * php and matched against an attribute value of '1' */ - public function testThatIgnoreCaseOptionNotMatchBooleanAsStringValue() { + public function testThatIgnoreCaseOptionNotMatchBooleanAsStringValue() + { $config = [ 'someAttribute' => ['ignoreCase' => true, 'someValue'] ]; @@ -314,7 +315,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertEquals($attributes['eduPersonAffiliation'], ['member']); $config = [ - 'eduPersonAffiliation' => ['ignoreCase' => true, 'membeR','sTaff'] + 'eduPersonAffiliation' => ['ignoreCase' => true, 'membeR', 'sTaff'] ]; $result = self::processFilter($config, self::$request); @@ -331,7 +332,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase $this->assertCount(0, $attributes); $config = [ - 'eduPersonAffiliation' => ['ignoreCase' => true, 'studeNt','sTaff'] + 'eduPersonAffiliation' => ['ignoreCase' => true, 'studeNt', 'sTaff'] ]; $result = self::processFilter($config, self::$request); $attributes = $result['Attributes']; @@ -473,7 +474,7 @@ class Test_Core_Auth_Process_AttributeLimitTest extends TestCase public function testNoIntersection() { $config = [ - 'default' => TRUE, + 'default' => true, ]; $request = [ diff --git a/tests/modules/core/lib/Auth/Process/AttributeMapTest.php b/tests/modules/core/lib/Auth/Process/AttributeMapTest.php index 5c50f59bd533ddad04c7299028717dae6ade71eb..7a14dc76c4a944c7dac0db8033431a998c9d87e4 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeMapTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeMapTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:AttributeMap filter. */ -class Test_Core_Auth_Process_AttributeMap extends TestCase +class AttributeMapTest extends TestCase { /** * Helper function to run the filter with a given configuration. diff --git a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php index 9821cf275432cb06f2089d83ed03b7e6d053bcd2..f7d0ef60637720f0041bd85d1e4d0b9e8bfcf9ac 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeRealmTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:AttributeRealm filter. */ -class Test_Core_Auth_Process_AttributeRealm extends TestCase +class AttributeRealmTest extends TestCase { /** @@ -17,7 +19,7 @@ class Test_Core_Auth_Process_AttributeRealm extends TestCase */ private static function processFilter(array $config, array $request) { - $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeRealm($config, NULL); + $filter = new \SimpleSAML\Module\core\Auth\Process\AttributeRealm($config, null); $filter->process($request); return $request; } diff --git a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php index 23904bd67cdbb02cb583ab8411d3b2c5cbbae60d..ddf07427342248d0bd30e86c8374cfbe9c44b359 100644 --- a/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php +++ b/tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php @@ -151,7 +151,7 @@ class AttributeValueMapTest extends TestCase $attributes = $result['Attributes']; $this->assertArrayHasKey('memberOf', $attributes); $this->assertArrayHasKey('eduPersonAffiliation', $attributes); - $this->assertEquals($attributes['eduPersonAffiliation'], ['someValue','member']); + $this->assertEquals($attributes['eduPersonAffiliation'], ['someValue', 'member']); } diff --git a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php index ebf43b9c5c42779bc80c67c0defcf5b6ff4406c8..533bb9f1187e1e52646e847376598416cf65d48e 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalitySingleTest.php @@ -1,4 +1,7 @@ <?php + +namespace SimpleSAML\Test\Module\core\Auth\Process; + // Alias the PHPUnit 6.0 ancestor if available, else fall back to legacy ancestor if (class_exists('\PHPUnit\Framework\TestCase', true) and !class_exists('\PHPUnit_Framework_TestCase', true)) { class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase', true); @@ -7,7 +10,7 @@ if (class_exists('\PHPUnit\Framework\TestCase', true) and !class_exists('\PHPUni /** * Test for the core:CardinalitySingle filter. */ -class Test_Core_Auth_Process_CardinalitySingleTest extends \PHPUnit_Framework_TestCase +class CardinalitySingleTest extends \PHPUnit_Framework_TestCase { private $http; diff --git a/tests/modules/core/lib/Auth/Process/CardinalityTest.php b/tests/modules/core/lib/Auth/Process/CardinalityTest.php index da6e2e30d47bdcb9a8ab91174e0e7c6a2b7b11cd..1dec455bb82065eac4257f6d461fb9f2587aea38 100644 --- a/tests/modules/core/lib/Auth/Process/CardinalityTest.php +++ b/tests/modules/core/lib/Auth/Process/CardinalityTest.php @@ -1,5 +1,7 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + // Alias the PHPUnit 6.0 ancestor if available, else fall back to legacy ancestor if (class_exists('\PHPUnit\Framework\TestCase', true) and !class_exists('\PHPUnit_Framework_TestCase', true)) { class_alias('\PHPUnit\Framework\TestCase', '\PHPUnit_Framework_TestCase', true); @@ -8,7 +10,7 @@ if (class_exists('\PHPUnit\Framework\TestCase', true) and !class_exists('\PHPUni /** * Test for the core:Cardinality filter. */ -class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase +class CardinalityTest extends \PHPUnit_Framework_TestCase { private $http; @@ -242,6 +244,6 @@ class Test_Core_Auth_Process_CardinalityTest extends \PHPUnit_Framework_TestCase 'mail' => ['joe@example.com', 'bob@example.com'], ], ]; - self::processFilter($config, $request); + $this->processFilter($config, $request); } } diff --git a/tests/modules/core/lib/Auth/Process/PHPTest.php b/tests/modules/core/lib/Auth/Process/PHPTest.php index 67bf33b706d36cc24e6675e47957944d45700df4..e37bee1adb2bd60098c1c04ed4ef789e55526a7e 100644 --- a/tests/modules/core/lib/Auth/Process/PHPTest.php +++ b/tests/modules/core/lib/Auth/Process/PHPTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:PHP filter. */ -class Test_Core_Auth_Process_PHP extends TestCase +class PHPTest extends TestCase { /** * Helper function to run the filter with a given configuration. diff --git a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php index 6bc4d276f90dc7be8e59b0bced8ea9ca2874c64c..52b29234c3029dcafda913c7673a8c6217395731 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeAttributeTest.php @@ -1,13 +1,14 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:ScopeAttribute filter. */ -class Test_Core_Auth_Process_ScopeAttribute extends TestCase +class ScopeAttributeTest extends TestCase { - /* * Helper function to run the filter with a given configuration. * @@ -17,7 +18,7 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase */ private static function processFilter(array $config, array $request) { - $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeAttribute($config, NULL); + $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeAttribute($config, null); $filter->process($request); return $request; } @@ -63,7 +64,10 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['library-walk-in@example.edu', 'member@example.com']); + $this->assertEquals( + $attributes['eduPersonScopedAffiliation'], + ['library-walk-in@example.edu', 'member@example.com'] + ); } /* @@ -165,12 +169,15 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase $request = [ 'Attributes' => [ 'eduPersonPrincipalName' => ['jdoe@example.com'], - 'eduPersonAffiliation' => ['member','staff','faculty'], + 'eduPersonAffiliation' => ['member', 'staff', 'faculty'], ] ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; - $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['member@example.com','staff@example.com','faculty@example.com']); + $this->assertEquals( + $attributes['eduPersonScopedAffiliation'], + ['member@example.com', 'staff@example.com', 'faculty@example.com'] + ); } /* @@ -194,26 +201,26 @@ class Test_Core_Auth_Process_ScopeAttribute extends TestCase $this->assertEquals($attributes['eduPersonScopedAffiliation'], ['student@example.org']); } - /* - * When the target attribute exists and onlyIfEmpty is set - */ - public function testOnlyIfEmpty() - { - $config = [ + /* + * When the target attribute exists and onlyIfEmpty is set + */ + public function testOnlyIfEmpty() + { + $config = [ 'scopeAttribute' => 'schacHomeOrganization', 'sourceAttribute' => 'eduPersonAffiliation', 'targetAttribute' => 'eduPersonScopedAffiliation', - 'onlyIfEmpty' => true, - ]; + 'onlyIfEmpty' => true, + ]; $request = [ 'Attributes' => [ 'schacHomeOrganization' => ['example.org'], 'eduPersonAffiliation' => ['student'], - 'eduPersonScopedAffiliation' => ['staff@example.org', 'member@example.org'], + 'eduPersonScopedAffiliation' => ['staff@example.org', 'member@example.org'], ] ]; $result = self::processFilter($config, $request); $attributes = $result['Attributes']; $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 0e5aace085379d0e6475324a8e04ee3841f1d247..a0abea39a7c0e1ae02383eb78cff579050cb6e77 100644 --- a/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php +++ b/tests/modules/core/lib/Auth/Process/ScopeFromAttributeTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:ScopeFromAttribute filter. */ -class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase +class ScopeFromAttributeTest extends TestCase { /* @@ -17,7 +19,7 @@ class Test_Core_Auth_Process_ScopeFromAttribute extends TestCase */ private static function processFilter(array $config, array $request) { - $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeFromAttribute($config, NULL); + $filter = new \SimpleSAML\Module\core\Auth\Process\ScopeFromAttribute($config, null); $filter->process($request); return $request; } diff --git a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php index 51f5c6b1da60f7f23e2776036db3e59eb917a77a..b4ef4ee4b0b11fbe32da02223e64cca8bbdc94d6 100644 --- a/tests/modules/core/lib/Auth/Process/TargetedIDTest.php +++ b/tests/modules/core/lib/Auth/Process/TargetedIDTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth\Process; + use PHPUnit\Framework\TestCase; /** * Test for the core:TargetedID filter. */ -class Test_Core_Auth_Process_TargetedID extends TestCase +class TargetedIDTest extends TestCase { /** * Helper function to run the filter with a given configuration. @@ -16,7 +18,7 @@ class Test_Core_Auth_Process_TargetedID extends TestCase */ private static function processFilter(array $config, array $request) { - $filter = new \SimpleSAML\Module\core\Auth\Process\TargetedID($config, NULL); + $filter = new \SimpleSAML\Module\core\Auth\Process\TargetedID($config, null); $filter->process($request); return $request; } @@ -26,12 +28,11 @@ class Test_Core_Auth_Process_TargetedID extends TestCase // */ // public function testBasic() // { -// $config = array( -// ); -// $request = array( +// $config = []; +// $request = [ // 'Attributes' => [], // 'UserID' => 'user2@example.org', -// ); +// ]; // $result = self::processFilter($config, $request); // $attributes = $result['Attributes']; // $this->assertArrayHasKey('eduPersonTargetedID', $attributes); @@ -44,22 +45,21 @@ class Test_Core_Auth_Process_TargetedID extends TestCase // */ // public function testWithSrcDst() // { -// $config = array( -// ); -// $request = array( -// 'Attributes' => array( +// $config = []; +// $request = [ +// 'Attributes' => [ // 'eduPersonTargetedID' => 'dummy', -// ), +// ], // 'UserID' => 'user2@example.org', -// 'Source' => array( +// 'Source' => [ // 'metadata-set' => 'saml20-idp-hosted', // 'entityid' => 'urn:example:src:id', -// ), -// 'Destination' => array( +// ], +// 'Destination' => [ // 'metadata-set' => 'saml20-sp-remote', // 'entityid' => 'joe', -// ), -// ); +// ], +// ]; // $result = self::processFilter($config, $request); // $attributes = $result['Attributes']; // $this->assertArrayHasKey('eduPersonTargetedID', $attributes); @@ -71,26 +71,28 @@ class Test_Core_Auth_Process_TargetedID extends TestCase // */ // public function testNameIdGeneration() // { -// $config = array( +// $config = [ // 'nameId' => true, -// ); +// ]; // $request = array( -// 'Attributes' => array( -// ), +// 'Attributes' => [], // 'UserID' => 'user2@example.org', -// 'Source' => array( +// 'Source' => [ // 'metadata-set' => 'saml20-idp-hosted', // 'entityid' => 'urn:example:src:id', -// ), -// 'Destination' => array( +// ], +// 'Destination' => [ // 'metadata-set' => 'saml20-sp-remote', // 'entityid' => 'joe', -// ), +// ], // ); // $result = self::processFilter($config, $request); // $attributes = $result['Attributes']; // $this->assertArrayHasKey('eduPersonTargetedID', $attributes); -// $this->assertRegExp('#^<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2\.0:assertion" NameQualifier="urn:example:src:id" SPNameQualifier="joe" Format="urn:oasis:names:tc:SAML:2\.0:nameid-format:persistent">[0-9a-f]{40}</saml:NameID>$#', $attributes['eduPersonTargetedID'][0]); +// $this->assertRegExp( +// '#^<saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2\.0:assertion" NameQualifier="urn:example:src:id" SPNameQualifier="joe" Format="urn:oasis:names:tc:SAML:2\.0:nameid-format:persistent">[0-9a-f]{40}</saml:NameID>$#', +// $attributes['eduPersonTargetedID'][0] +// ); // } // // /** @@ -98,30 +100,29 @@ class Test_Core_Auth_Process_TargetedID extends TestCase // */ // public function testIdIsPersistent() // { -// $config = array( -// ); -// $request = array( -// 'Attributes' => array( +// $config = []; +// $request = [ +// 'Attributes' => [ // 'eduPersonTargetedID' => 'dummy', -// ), +// ], // 'UserID' => 'user2@example.org', -// 'Source' => array( +// 'Source' => [ // 'metadata-set' => 'saml20-idp-hosted', // 'entityid' => 'urn:example:src:id', -// ), -// 'Destination' => array( +// ], +// 'Destination' => [ // 'metadata-set' => 'saml20-sp-remote', // 'entityid' => 'joe', -// ), -// ); +// ], +// ]; // for ($i = 0; $i < 10; ++$i) { -// $result = self::processFilter($config, $request); -// $attributes = $result['Attributes']; -// $tid = $attributes['eduPersonTargetedID'][0]; -// if (isset($prevtid)) { -// $this->assertEquals($prevtid, $tid); -// $prevtid = $tid; -// } +// $result = self::processFilter($config, $request); +// $attributes = $result['Attributes']; +// $tid = $attributes['eduPersonTargetedID'][0]; +// if (isset($prevtid)) { +// $this->assertEquals($prevtid, $tid); +// $prevtid = $tid; +// } // } // } // @@ -130,33 +131,31 @@ class Test_Core_Auth_Process_TargetedID extends TestCase // */ // public function testIdIsUnique() // { -// $config = array( -// ); -// $request = array( -// 'Attributes' => array( -// ), +// $config = []; +// $request = [ +// 'Attributes' => [], // 'UserID' => 'user2@example.org', -// 'Source' => array( +// 'Source' => [ // 'metadata-set' => 'saml20-idp-hosted', // 'entityid' => 'urn:example:src:id', -// ), -// 'Destination' => array( +// ], +// 'Destination' => [ // 'metadata-set' => 'saml20-sp-remote', // 'entityid' => 'joe', -// ), -// ); -// $result = self::processFilter($config, $request); -// $tid1 = $result['Attributes']['eduPersonTargetedID'][0]; +// ], +// ]; +// $result = self::processFilter($config, $request); +// $tid1 = $result['Attributes']['eduPersonTargetedID'][0]; // // $request['UserID'] = 'user3@example.org'; -// $result = self::processFilter($config, $request); -// $tid2 = $result['Attributes']['eduPersonTargetedID'][0]; +// $result = self::processFilter($config, $request); +// $tid2 = $result['Attributes']['eduPersonTargetedID'][0]; // // $this->assertNotEquals($tid1, $tid2); // // $request['Destination']['entityid'] = 'urn:example.org:another-sp'; -// $result = self::processFilter($config, $request); -// $tid3 = $result['Attributes']['eduPersonTargetedID'][0]; +// $result = self::processFilter($config, $request); +// $tid3 = $result['Attributes']['eduPersonTargetedID'][0]; // // $this->assertNotEquals($tid2, $tid3); // } diff --git a/tests/modules/core/lib/Auth/UserPassBaseTest.php b/tests/modules/core/lib/Auth/UserPassBaseTest.php index e3e1d25d7473324bf9959378059a586e9b591251..cd5a328acad88345e76d28676b4ab543697743cb 100644 --- a/tests/modules/core/lib/Auth/UserPassBaseTest.php +++ b/tests/modules/core/lib/Auth/UserPassBaseTest.php @@ -1,5 +1,7 @@ <?php +namespace SimpleSAML\Test\Module\core\Auth; + class UserPassBaseTest extends \PHPUnit_Framework_TestCase { public function testAuthenticateECPCallsLoginAndSetsAttributes() diff --git a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php index 90816896b7b349274586d9743d8b4dcf06a6eb42..7db0605b0679f534d9ea46d0a1c38db81d663e14 100644 --- a/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php +++ b/tests/modules/core/lib/Auth/UserPassOrgBaseTest.php @@ -25,13 +25,10 @@ class UserPassOrgBaseTest extends \PHPUnit_Framework_TestCase ] ]; - // 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(['AuthId' => 'my-org'], []))) + $mockUserPassOrgBase = $this->getMockBuilder(\SimpleSAML\Module\core\Auth\UserPassOrgBase::class) ->setConstructorArgs([['AuthId' => 'my-org'], &$config]) ->setMethods([]) ->getMockForAbstractClass(); - $this->assertTrue($mockUserPassOrgBase->getRememberOrganizationEnabled()); } } diff --git a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php index 49b17fd611d9180e7b33838f406e92a9a46bccf1..1d8f4d700006abf1c780d938902aae6cea14a498 100644 --- a/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php +++ b/tests/modules/core/lib/Storage/SQLPermanentStorageTest.php @@ -1,11 +1,13 @@ <?php +namespace SimpleSAML\Test\Module\core\Storage; + use PHPUnit\Framework\TestCase; /** * Test for the SQLPermanentStorage class. */ -class Test_Core_Storage_SQLPermanentStorage extends TestCase +class SQLPermanentStorageTest extends TestCase { private static $sql; diff --git a/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php b/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php index b7c502e4e1c335025859cd07150a54a2862a4912..05f808ee55512182656552cd23be9ac50b09c890 100644 --- a/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php +++ b/tests/modules/ldap/lib/Auth/Process/BaseFilterTest.php @@ -1,8 +1,10 @@ <?php +namespace SimpleSAML\Test\Module\ldap\Auth\Process; + use PHPUnit\Framework\TestCase; -class BaseFilter_Test extends TestCase +class BaseFilterTest extends TestCase { public function testVarExportHidesLdapPassword() { diff --git a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php index fbcf3796c3a95ff415cd6dde4531d37c5efe191c..f20ee5b377935f3d9e204be8fd949d5f1b84a41f 100644 --- a/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php +++ b/tests/modules/saml/lib/Auth/Process/NameIDAttributeTest.php @@ -1,4 +1,7 @@ <?php + +namespace SimpleSAML\Test\Module\saml\Auth\Process; + /** * Test for the saml:NameIDAttribute filter. * 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 f3634818d9bb5ffcde328ee09fecfa301248193b..c1310986c847bbca8c195bfdd4fab7e6e2de8367 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 @@ -32,7 +32,7 @@ class ExitTestException extends \Exception * - Use introspection to make startSSO2Test available * - Override sendSAML2AuthnRequest() to catch the AuthnRequest being sent */ -class SP_Tester extends \SimpleSAML\Module\saml\Auth\Source\SP +class SPTester extends \SimpleSAML\Module\saml\Auth\Source\SP { public function __construct($info, $config) @@ -68,7 +68,7 @@ class SP_Tester extends \SimpleSAML\Module\saml\Auth\Source\SP /** * Set of test cases for \SimpleSAML\Module\saml\Auth\Source\SP. */ -class SP_Test extends TestCase +class SPTest extends TestCase { private $idpMetadata = null; @@ -141,7 +141,7 @@ class SP_Test extends TestCase { $info = ['AuthId' => 'default-sp']; $config = []; - $as = new SP_Tester($info, $config); + $as = new SPTester($info, $config); /** @var \SAML2\AuthnRequest $ar */ $ar = null; diff --git a/tests/modules/saml/lib/IdP/SAML2Test.php b/tests/modules/saml/lib/IdP/SAML2Test.php index 1dce810fa0c439817be83cb2755ea85e8eb0d988..c6701cbd34cf550c513625050934c16ddba176d5 100644 --- a/tests/modules/saml/lib/IdP/SAML2Test.php +++ b/tests/modules/saml/lib/IdP/SAML2Test.php @@ -1,5 +1,7 @@ <?php +namespace SimpleSAML\Test\Module\saml\IdP; + class SAML2Test extends \PHPUnit_Framework_TestCase { public function testProcessSOAPAuthnRequest() diff --git a/www/_include.php b/www/_include.php index 9daa9a398864d097563448ca7aca993a32a0d6b6..1960627f87cb594f71cd95355bec4f4d57ca05ca 100644 --- a/www/_include.php +++ b/www/_include.php @@ -16,7 +16,7 @@ function SimpleSAML_exception_handler($exception) } elseif ($exception instanceof \Exception) { $e = new \SimpleSAML\Error\Error('UNHANDLEDEXCEPTION', $exception); $e->show(); - } else if (class_exists('Error') && $exception instanceof \Error) { + } elseif (class_exists('Error') && $exception instanceof \Error) { $code = $exception->getCode(); $errno = ($code > 0) ? $code : E_ERROR; $errstr = $exception->getMessage(); diff --git a/www/admin/metadata-converter.php b/www/admin/metadata-converter.php index e88dff061e890e7b7bb3708e98d14ddde6c9cd22..5ce928ac5987d8aa3b00ea5ea716613cf7988550 100644 --- a/www/admin/metadata-converter.php +++ b/www/admin/metadata-converter.php @@ -34,7 +34,6 @@ if (!empty($xmldata)) { foreach ($output as $type => &$entities) { $text = ''; foreach ($entities as $entityId => $entityMetadata) { - if ($entityMetadata === null) { continue; } diff --git a/www/assets/css/src/default-rtl.css b/www/assets/css/src/default-rtl.css index abce8dcdfa252cc6111e3991bfad236ae7f78ee2..3df1c9ce86998b56833c14cdb020a736ab6318e0 100644 --- a/www/assets/css/src/default-rtl.css +++ b/www/assets/css/src/default-rtl.css @@ -2,173 +2,173 @@ /* THE BIG GUYS */ html { - direction: rtl; + direction: rtl; } #header{ - background: linear-gradient(-141deg, #b8002c 0%, #db0100 51%, #e8410c 75%); + background: linear-gradient(-141deg, #b8002c 0%, #db0100 51%, #e8410c 75%); } #footer{ - background: linear-gradient(-141deg, #b8002c 0%, #db0100 51%, #e8410c 75%); + background: linear-gradient(-141deg, #b8002c 0%, #db0100 51%, #e8410c 75%); } /* LISTS */ ul { - margin: .3em 2em 1.5em 0; + margin: .3em 2em 1.5em 0; } li { - margin-right: 2em; + margin-right: 2em; } /* TYPOGRAPHY */ dl dd { - margin-right: 3em; + margin-right: 3em; } .efieldlist { - border-right: 1px solid #e6e6e6; + border-right: 1px solid #e6e6e6; } div.caution { - padding: .2em 60px .2em .2em; - background-position: right; + padding: .2em 60px .2em .2em; + background-position: right; } th.rowtitle { - text-align: right; + text-align: right; } .enablebox table { - margin-right: 1em; + margin-right: 1em; } .enablebox.mini table { - float: left; + float: left; } .enablebox tr td { - padding: .5px .5em 1px 1em; + padding: .5px .5em 1px 1em; } /* Attribute presentation in example page */ table.attributes td.attrname { - text-align: left; + text-align: left; } fieldset.fancyfieldset { - margin: 2em 0px 1em 1em; + margin: 2em 0px 1em 1em; } fieldset.fancyfieldset legend { - margin-right: 2em; + margin-right: 2em; } /* Reverse Float Left <-> Right */ .right { - float: left; + float: left; } .left { - float: right; + float: right; } .v-center-right{ - right: 0; + right: 0; } .logo-footer-right{ - left:0; - right: auto; + left:0; + right: auto; } .message-box { - border-left-style: initial; - border-left-width: 0; - border-left-color: none; - border-right-style: solid; - border-right-width: 0.3125rem; + border-left-style: initial; + order-left-width: 0; + border-left-color: none; + border-right-style: solid; + border-right-width: 0.3125rem; } .message-box.error{ - border-right-color: #cc4b37; + border-right-color: #cc4b37; } .message-box.success{ - border-right-color: #46cc48; + border-right-color: #46cc48; } .code-box-title .clipboard-btn { - right: auto; - left: 0; - margin-left: 4px; - margin-right: auto; + right: auto; + left: 0; + margin-left: 4px; + margin-right: auto; } /*selectize elements*/ div .item{ - float: right; + float: right; } .selectize-input{ - padding-right:8px; + padding-right:8px; } .selectize-input:after{ - transform: translate(-8px, 0); + transform: translate(-8px, 0); } /*purecss elements*/ .pure-form-aligned .pure-control-group label { - text-align: left; - margin: 0 0 0 1em; + text-align: left; + margin: 0 0 0 1em; } @media only screen and (max-width : 480px) { - .pure-form-aligned .pure-control-group label { - text-align: right; - } + .pure-form-aligned .pure-control-group label { + text-align: right; + } } .pure-form-aligned .pure-controls { - margin: 1.5em 11em 0 0; + margin: 1.5em 11em 0 0; } .pure-form .pure-help-inline, .pure-form-message-inline { - padding-left: 0; - padding-right: 0.3em; + padding-left: 0; + padding-right: 0.3em; } .pure-select{ - float: left; + float: left; } .pure-table-attributes ul{ - margin:0; + margin:0; } .pure-table-attributes li{ - margin:0; + margin:0; } /* language side menu on medium and small screens*/ #layout.active #menu { - right: initial; - left: 11em; + right: initial; + left: 11em; } #layout.active .menu-link { - right: initial; - left: 11em; + right: initial; + left: 11em; } #menu { - right: initial; - margin-right: 0; - margin-left: -11em; /* "#menu" width */ - left: 0; + right: initial; + margin-right: 0; + margin-left: -11em; /* "#menu" width */ + left: 0; } #menu a { - padding: 0.6em 0.6em 0.6em 0em; + padding: 0.6em 0.6em 0.6em 0em; } .menu-link { - right: initial; - left: 0; /* "#menu width" */ + right: initial; + left: 0; /* "#menu width" */ } /* -- Responsive Styles (Media Queries) ------------------------------------- */ @media screen and (max-width: 0em), screen and (min-width: 40em) { - #layout.active { - right: auto; - left: 11em; - } - #menuLink.menu-link.active { - right: auto; - left: 13em; - } - #foot.active { - margin-right: auto; - margin-left: 11em; - } + #layout.active { + right: auto; + left: 11em; + } + #menuLink.menu-link.active { + right: auto; + left: 13em; + } + #foot.active { + margin-right: auto; + margin-left: 11em; + } } diff --git a/www/assets/js/src/language.js b/www/assets/js/src/language.js index 6666a5504637abbaf9627510c5e32048d485b836..0f4484728bd92788c217c3cc2248827fe0a3c10a 100644 --- a/www/assets/js/src/language.js +++ b/www/assets/js/src/language.js @@ -1,7 +1,7 @@ -$(document).ready(function() { +$(document).ready(function () { // get available languages - var languages = $.map($('#language_selector option') ,function(option) { + var languages = $.map($('#language_selector option') ,function (option) { return option.text.toLowerCase(); }); @@ -9,8 +9,7 @@ $(document).ready(function() { if (-1 !== $.inArray( $('#language_selector-selectized').prev().text().toLowerCase(), languages - ) - ) { + )) { e.currentTarget.submit(); } }); diff --git a/www/assets/js/src/script.js b/www/assets/js/src/script.js index 7748abb05c26559a912f457f106f5e117eee4759..61e710f17f404359af63b5ac95d974625169fb18 100644 --- a/www/assets/js/src/script.js +++ b/www/assets/js/src/script.js @@ -3,11 +3,12 @@ * * @param id The id of the element which should receive focus. */ -function SimpleSAML_focus(id) { - element = document.getElementById(id); - if(element != null) { - element.focus(); - } +function SimpleSAML_focus(id) +{ + element = document.getElementById(id); + if (element != null) { + element.focus(); + } } @@ -16,13 +17,14 @@ function SimpleSAML_focus(id) { * * @param id The id of the element which should be shown. */ -function SimpleSAML_show(id) { - element = document.getElementById(id); - if (element == null) { - return; - } +function SimpleSAML_show(id) +{ + element = document.getElementById(id); + if (element == null) { + return; + } - element.style.display = 'block'; + element.style.display = 'block'; } @@ -31,38 +33,39 @@ function SimpleSAML_show(id) { * * @param id The id of the element which should be hidden. */ -function SimpleSAML_hide(id) { - element = document.getElementById(id); - if (element == null) { - return; - } +function SimpleSAML_hide(id) +{ + element = document.getElementById(id); + if (element == null) { + return; + } - element.style.display = 'none'; + element.style.display = 'none'; } // Attach the `fileselect` event to all file inputs on the page -$(document).on('change', ':file', function() { +$(document).on('change', ':file', function () { var input = $(this), numFiles = input.get(0).files ? input.get(0).files.length : 1, label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); input.trigger('fileselect', [numFiles, label]); }); -$(document).ready(function() { +$(document).ready(function () { $('.language-menu').selectize(); $('#organization').selectize(); new ClipboardJS('.clipboard-btn'); // Watch for custom `fileselect` event - $(':file').on('fileselect', function(event, numFiles, label) { + $(':file').on('fileselect', function (event, numFiles, label) { var input = $(this).parents('.pure-button-group').find(':text'), log = numFiles > 1 ? numFiles + ' files selected' : label; - if( input.length ) { + if (input.length) { input.val(log); } else { - if( log ) { + if (log) { document.getElementById('show-file').innerHTML = log; } } diff --git a/www/assets/js/src/side_menu.js b/www/assets/js/src/side_menu.js index 4ba1b214b5df8e2cf8fe0ff4a15e76cb3c18b7b0..ef81946439db1fa19384a8c8bd23ff5622ad35c2 100644 --- a/www/assets/js/src/side_menu.js +++ b/www/assets/js/src/side_menu.js @@ -6,12 +6,13 @@ content = document.getElementById('content'); footer = document.getElementById('foot'); - function toggleClass(element, className) { + function toggleClass(element, className) + { var classes = element.className.split(/\s+/), length = classes.length, i = 0; - for(; i < length; i++) { + for (; i < length; i++) { if (classes[i] === className) { classes.splice(i, 1); break; @@ -25,7 +26,8 @@ element.className = classes.join(' '); } - function toggleAll(e) { + function toggleAll(e) + { var active = 'active'; e.preventDefault(); @@ -39,7 +41,7 @@ toggleAll(e); }; - content.onclick = function(e) { + content.onclick = function (e) { if (menu.className.indexOf('active') !== -1) { toggleAll(e); } diff --git a/www/module.php b/www/module.php index c53d595f67bf915920f167dcdb58f2a669d6c5c2..caac395fb2ae60a16b314ffcdba0f5810e36c86d 100644 --- a/www/module.php +++ b/www/module.php @@ -81,7 +81,6 @@ $moduleDir = SimpleSAML\Module::getModuleDir($module).'/www/'; // check for '.php/' in the path, the presence of which indicates that another php-script should handle the request for ($phpPos = strpos($url, '.php/'); $phpPos !== false; $phpPos = strpos($url, '.php/', $phpPos + 1)) { - $newURL = substr($url, 0, $phpPos + 4); $param = substr($url, $phpPos + 4); diff --git a/www/resources/default-rtl.css b/www/resources/default-rtl.css index 0113f82f1059079f5ec98d560e8843968ed850b4..df092c3d2ba09a3e277878d5d607357cb38936f2 100644 --- a/www/resources/default-rtl.css +++ b/www/resources/default-rtl.css @@ -2,69 +2,69 @@ /* THE BIG GUYS */ html { - direction: rtl; + direction: rtl; } /* LISTS */ ul { - margin: .3em 2em 1.5em 0; + margin: .3em 2em 1.5em 0; } li { - margin-right: 2em; + margin-right: 2em; } #wrap { - text-align: right; + text-align: right; } /* TYPOGRAPHY */ dl dd { - margin-right: 3em; + margin-right: 3em; } .efieldlist { - border-right: 1px solid #e6e6e6; + border-right: 1px solid #e6e6e6; } div.caution { - padding: .2em 60px .2em .2em; - background-position: right; + padding: .2em 60px .2em .2em; + background-position: right; } th.rowtitle { - text-align: right; + text-align: right; } .enablebox table { - margin-right: 1em; + margin-right: 1em; } .enablebox.mini table { - float: left; + float: left; } .enablebox tr td { - padding: .5px .5em 1px 1em; + padding: .5px .5em 1px 1em; } /* Attribute presentation in example page */ table.attributes td.attrname { - text-align: left; + text-align: left; } fieldset.fancyfieldset { - margin: 2em 0px 1em 1em; + margin: 2em 0px 1em 1em; } fieldset.fancyfieldset legend { - margin-right: 2em; + margin-right: 2em; } -.ui-tabs .ui-tabs-nav li { - float: right; +.ui-tabs .ui-tabs-nav li { + float: right; } /* Reverse Float Left <-> Right */ .float-r { - float: left; + float: left; } .float-l { - float: right; + float: right; } diff --git a/www/resources/default.css b/www/resources/default.css index 3c0371bb5cffa5add05af9b70e4fa132be57d426..f033b771621ec1542e5ce77240e5adf123545e84 100644 --- a/www/resources/default.css +++ b/www/resources/default.css @@ -2,474 +2,467 @@ /* THE BIG GUYS */ * { - margin: 0; - padding: 0; + margin: 0; + padding: 0; } body { - text-align: center; - padding: 10px 0; - background: #1c1c1c; -/* background-image: url(icons/ssplogo-fish.png); - background-repeat: no-repeat; */ - color: #333; - font: 83%/1.5 arial,tahoma,verdana,sans-serif; + text-align: center; + padding: 10px 0; + background: #1c1c1c; +/* background-image: url(icons/ssplogo-fish.png); */ +/* background-repeat: no-repeat; */ + color: #333; + font: 83%/1.5 arial,tahoma,verdana,sans-serif; } .body-embed { - padding: 0; - background: #ffffff; - font: 83%/1.5 arial,tahoma,verdana,sans-serif; + padding: 0; + background: #ffffff; + font: 83%/1.5 arial,tahoma,verdana,sans-serif; } img { - border: none; - display: block; + border: none; + display: block; } hr { - margin: 1em 0; - background: #eee; - height: 1px; - color: #eee; - border: none; - clear: both; + margin: 1em 0; + background: #eee; + height: 1px; + color: #eee; + border: none; + clear: both; } /* LINKS */ a, a:link, a:link, a:link, a:hover { - - text-decoration: none; - color: #777; - border-bottom: 1px dotted #ccc; - font-weight: normal; + text-decoration: none; + color: #777; + border-bottom: 1px dotted #ccc; + font-weight: normal; } - a:link, a:visited { - text-decoration: none; - color: #777; - border-bottom: 1px dotted #ccc; - font-weight: normal; + text-decoration: none; + color: #777; + border-bottom: 1px dotted #ccc; + font-weight: normal; } .ui-tabs-nav a { - border: none ! important; - text-decoration: none; + border: none ! important; + text-decoration: none; } a:visited { - color: #999; + color: #999; } a:hover, a:active { - color: #069; - text-decoration: none; - color: #333; - border-bottom: 1px solid #333; + color: #069; + text-decoration: none; + color: #333; + border-bottom: 1px solid #333; } #header a { - color: #fff; - text-decoration: none; + color: #fff; + text-decoration: none; } /* LISTS */ ul { - margin: .3em 0 1.5em 2em; + margin: .3em 0 1.5em 2em; } ul.related { - margin-top: -1em; + margin-top: -1em; } li { - margin-left: 2em; + margin-left: 2em; } dt { - font-weight: bold; + font-weight: bold; } #wrap { - background: #fff; + background: #fff; - border: 1px solid #fff; - position: relative; - text-align: left; + border: 1px solid #fff; + position: relative; + text-align: left; - margin: 20px 75px 2em 75px; - max-width: 950px; + margin: 20px 75px 2em 75px; + max-width: 950px; } #languagebar { - padding-left: 10px; - padding-right: 10px; + padding-left: 10px; + padding-right: 10px; } #languagebar a:link, #languagebar a:visited { - text-decoration: none; - color: #777; - border-bottom: 1px dotted #ccc; - font-weight: normal; + text-decoration: none; + color: #777; + border-bottom: 1px dotted #ccc; + font-weight: normal; } #languagebar a:hover { - text-decoration: none; - color: #333; - border-bottom: 1px solid #333; - + text-decoration: none; + color: #333; + border-bottom: 1px solid #333; } #header { - background: #666 url("header-bkg.png") repeat-x 0 100%; - margin: 0px; - padding: 0 0 8px; + background: #666 url("header-bkg.png") repeat-x 0 100%; + margin: 0px; + padding: 0 0 8px; } #header h1 { - color: #fff; - font-size: 145%; - padding: 20px 20px 12px; + color: #fff; + font-size: 145%; + padding: 20px 20px 12px; } - #content, #footer { - padding: 0 20px; + padding: 0 20px; } /* TYPOGRAPHY */ p, ul, ol { - margin: 0 0 1.5em; + margin: 0 0 1.5em; } h1, h2, h3, h4, h5, h6 { - letter-spacing: -1px; - font-family: arial,verdana,sans-serif; - margin: 1.2em 0 .3em; - color: #000; - border-bottom: 1px solid #eee; - padding-bottom: .1em; + letter-spacing: -1px; + font-family: arial,verdana,sans-serif; + margin: 1.2em 0 .3em; + color: #000; + border-bottom: 1px solid #eee; + padding-bottom: .1em; } h1 { - font-size: 196%; - margin-top: 0; - border: none; + font-size: 196%; + margin-top: 0; + border: none; } h2 { - font-size: 136%; + font-size: 136%; } h3 { - font-size: 126%; + font-size: 126%; } h4 { - font-size: 116%; - font-weight: bold; + font-size: 116%; + font-weight: bold; } h5 { - font-size: 106%; + font-size: 106%; } h6 { - font-size: 96%; + font-size: 96%; } input { - border: 1px solid #ddd; - border-radius: 3px; - padding: 5px; - line-height: 1.5em; + border: 1px solid #ddd; + border-radius: 3px; + padding: 5px; + line-height: 1.5em; } h1 a { - text-decoration: none; - border: none ! important; - color: white; + text-decoration: none; + border: none ! important; + color: white; } h1 a:hover { - border-bottom: 1px dotted #eee; + border-bottom: 1px dotted #eee; } #content { - margin-top: 2em; + margin-top: 2em; } .old { - text-decoration: line-through; + text-decoration: line-through; } dl dt { - color: #333; + color: #333; } dl dd { - color: #666; - margin-left: 3em; -/* font-family: monospace; */ + color: #666; + margin-left: 3em; +/* font-family: monospace; */ } .efieldlist { - padding: .4em; - margin: .8em; - border-top: 1px solid #e6e6e6; - border-left: 1px solid #e6e6e6; + padding: .4em; + margin: .8em; + border-top: 1px solid #e6e6e6; + border-left: 1px solid #e6e6e6; } .efieldlist.warning { - background-color: #922; - border: 1px solid #333; - color: white; + background-color: #922; + border: 1px solid #333; + color: white; } .efieldlist.warning h5 { - color: white; + color: white; } .efieldlist h5 { - font-weight: bold; - color: #200; - margin: .3em; + font-weight: bold; + color: #200; + margin: .3em; } .trackidtext { - border: 1px dashed #aaa; - background: #eaeaea; - padding: .6em; - margin: .4em; + border: 1px dashed #aaa; + background: #eaeaea; + padding: .6em; + margin: .4em; } .trackidtext .trackid { - border: 1px solid #ccc; - background: #eee; - margin: .4em; - padding: .4em; - font-family: monospace; - font-size: large; + border: 1px solid #ccc; + background: #eee; + margin: .4em; + padding: .4em; + font-family: monospace; + font-size: large; } div.caution { - background-color: #FF9; - background-image: url('icons/experience/gtk-dialog-warning.48x48.png'); - background-repeat: no-repeat; - border: thin solid #444; - padding: .2em .2em .2em 60px; - margin: 1em 0px 1em 0px; + background-color: #FF9; + background-image: url('icons/experience/gtk-dialog-warning.48x48.png'); + background-repeat: no-repeat; + border: thin solid #444; + padding: .2em .2em .2em 60px; + margin: 1em 0px 1em 0px; } th.rowtitle { - text-align: left; + text-align: left; } .enablebox table { - border: 1px solid #eee; - - margin-left: 1em; + border: 1px solid #eee; + margin-left: 1em; } .enablebox.mini table { - float: right; + float: right; } .enablebox tr td { - padding: .5px 1em 1px .5em; - margin: 0px; + padding: .5px 1em 1px .5em; + margin: 0px; } .enablebox { - font-size: 85%; + font-size: 85%; } .enablebox tr.enabled td { - background: #eee; + background: #eee; } .enablebox tr.disabled td { - background: #ccc; + background: #ccc; } .metadatabox { - overflow: scroll; - border: 1px solid #eee; - padding: 0.5em; - border-radius: 3px; + overflow: scroll; + border: 1px solid #eee; + padding: 0.5em; + border-radius: 3px; } div.preferredidp { - border: 1px dashed #ccc; - background: #eee; - padding: 2px 2em 2px 2em; + border: 1px dashed #ccc; + background: #eee; + padding: 2px 2em 2px 2em; } table.modules { - border-collapse: collapse; + border-collapse: collapse; } table.modules tr td { - border-bottom: 1px solid #ddd; + border-bottom: 1px solid #ddd; } table.modules tr.even td { - background: #f0f0f0; + background: #f0f0f0; } /* Attribute presentation in example page */ table.attributes { - width: 100%; - margin: 0px; - border: 1px solid #bbb; - border-collapse: collapse; + width: 100%; + margin: 0px; + border: 1px solid #bbb; + border-collapse: collapse; } table.attributes td.attrname { - text-align: right; + text-align: right; } table.attributes tr.even td { - background: #eee; + background: #eee; } table.attributes tr td { - border-bottom: 1px solid #bbb; - border-left: 0px; - border-right: 0px; - background: #fff; - padding-top: 5px; - padding-left: 1em; - padding-right: 1em; - - vertical-align: top; + border-bottom: 1px solid #bbb; + border-left: 0px; + border-right: 0px; + background: #fff; + padding-top: 5px; + padding-left: 1em; + padding-right: 1em; + vertical-align: top; } .attrvalue { - word-break: break-all; - word-wrap: break-word; + word-break: break-all; + word-wrap: break-word; } table#table_with_attributes tr:last-child td { - border-bottom: none; + border-bottom: none; } fieldset.fancyfieldset { - margin: 2em 1em 1em 0px; - border: 1px solid #bbb; + margin: 2em 1em 1em 0px; + border: 1px solid #bbb; } fieldset.fancyfieldset legend { - margin-left: 2em; - padding: 3px 2em 3px 2em; - border: 1px solid #bbb; + margin-left: 2em; + padding: 3px 2em 3px 2em; + border: 1px solid #bbb; } div#confirmation input { - margin-top: .5em; - margin-bottom: .5em; + margin-top: .5em; + margin-bottom: .5em; } div#confirmation { - border: 1px solid #aaa; - background: #eee; - padding: .6em 1em .1em 1em; + border: 1px solid #aaa; + background: #eee; + padding: .6em 1em .1em 1em; } caption { - display: none; + display: none; } /* Left-to-Right CSS for RTL (Right to Left Support) */ .float-r { - float: right; + float: right; } .float-l { - float: left; + float: left; } #mobile_remember_username, #mobile_remember_me { - display: none; + display: none; } @media handheld, only screen and (max-width: 480px), only screen and (max-device-width: 480px) { - #header, #languagebar, #footer, .erroricon, .loginicon, .logintext, - #regular_remember_username, #regular_remember_me { - display: none; - } - body { - font-size: 20px; - } - #wrap { - margin: 0; - } - h1,h2,h3,h4 { - font-size: 110%; - } - - #content { - margin-bottom: 10px; - padding: 0; - padding-left: 5px; - } - input[type="text"], input[type="password"] { - height: 1.5em; - font-size: 1em; - } - .youareadmin { - font-size: 50%; - } - #mobilesubmit, #mobile_remember_username, #mobile_remember_me { - display: table-row; - } + #header, #languagebar, #footer, .erroricon, .loginicon, .logintext, + #regular_remember_username, #regular_remember_me { + display: none; + } + body { + font-size: 20px; + } + #wrap { + margin: 0; + } + h1,h2,h3,h4 { + font-size: 110%; + } + + #content { + margin-bottom: 10px; + padding: 0; + padding-left: 5px; + } + input[type="text"], input[type="password"] { + height: 1.5em; + font-size: 1em; + } + .youareadmin { + font-size: 50%; + } + #mobilesubmit, #mobile_remember_username, #mobile_remember_me { + display: table-row; + } } .btn, .btnaddonright { - color: #000000; - border: 1px solid #eee; - border-radius: 3px; - background-color: #eee; - background-image: linear-gradient(#fcfcfc, #eee); - text-align: center; - padding: 5px; - cursor: hand; + color: #000000; + border: 1px solid #eee; + border-radius: 3px; + background-color: #eee; + background-image: linear-gradient(#fcfcfc, #eee); + text-align: center; + padding: 5px; + cursor: hand; } .btn:hover, .btnaddonright:hover { - border-color: #ccc; - background-color: #ddd; - background-image: linear-gradient(#eee, #ddd); - + border-color: #ccc; + background-color: #ddd; + background-image: linear-gradient(#eee, #ddd); } .btn img, .btnaddonright img { - max-height: 15px; - max-width: 15px; + max-height: 15px; + max-width: 15px; } .topright { - position: absolute; - right: 2em; + position: absolute; + right: 2em; } .input-group { - display: table; + display: table; } .input-group pre { - background: white; - position: relative; - width: 100%; - vertical-align: middle; - border: 1px solid #eee; - padding: 0.5em; - display: table-cell; + background: white; + position: relative; + width: 100%; + vertical-align: middle; + border: 1px solid #eee; + padding: 0.5em; + display: table-cell; } .input-group .btnaddonright { - position: relative; - display: inline-block; - border-bottom-left-radius: 0; - border-bottom-right-radius: 3px; - border-top-left-radius: 0; - border-top-right-radius: 3px; - border-left: none; + position: relative; + display: inline-block; + border-bottom-left-radius: 0; + border-bottom-right-radius: 3px; + border-top-left-radius: 0; + border-top-right-radius: 3px; + border-left: none; } .input-group .btnaddonright:hover { - border-left: 1px solid #ccc; + border-left: 1px solid #ccc; } .input-group .input-left { - border-bottom-left-radius: 3px; - border-bottom-right-radius: 0; - border-top-left-radius: 3px; - border-top-right-radius: 0; + border-bottom-left-radius: 3px; + border-bottom-right-radius: 0; + border-top-left-radius: 3px; + border-top-right-radius: 0; } diff --git a/www/resources/post.js b/www/resources/post.js index f551736512e1afdcdb94a81ed0c92783d130ec38..043bec73322079eb6d6e8bfd9f39bbb3b654615f 100644 --- a/www/resources/post.js +++ b/www/resources/post.js @@ -2,6 +2,6 @@ * Automatically click the input button to redirect the user to * the SSO */ -window.onload = function(){ +window.onload = function () { document.getElementById('postLoginSubmitButton').click(); -}; \ No newline at end of file +}; diff --git a/www/resources/script.js b/www/resources/script.js index 3adf1b1f88e7573cc37c8dad40769a5e5fac264b..a195c24cb8fa8a1180dbec33e05796be5490af42 100644 --- a/www/resources/script.js +++ b/www/resources/script.js @@ -3,11 +3,12 @@ * * @param id The id of the element which should receive focus. */ -function SimpleSAML_focus(id) { - element = document.getElementById(id); - if(element != null) { - element.focus(); - } +function SimpleSAML_focus(id) +{ + element = document.getElementById(id); + if (element != null) { + element.focus(); + } } @@ -16,13 +17,14 @@ function SimpleSAML_focus(id) { * * @param id The id of the element which should be shown. */ -function SimpleSAML_show(id) { - element = document.getElementById(id); - if (element == null) { - return; - } +function SimpleSAML_show(id) +{ + element = document.getElementById(id); + if (element == null) { + return; + } - element.style.display = 'block'; + element.style.display = 'block'; } @@ -31,11 +33,12 @@ function SimpleSAML_show(id) { * * @param id The id of the element which should be hidden. */ -function SimpleSAML_hide(id) { - element = document.getElementById(id); - if (element == null) { - return; - } +function SimpleSAML_hide(id) +{ + element = document.getElementById(id); + if (element == null) { + return; + } - element.style.display = 'none'; + element.style.display = 'none'; } diff --git a/www/resources/slo.css b/www/resources/slo.css index f1ac2fd4daa4278f68565efafe3b9e1190703d26..13946bcbaa5fb1175d41cfd65d315194b0c22294 100644 --- a/www/resources/slo.css +++ b/www/resources/slo.css @@ -1,19 +1,18 @@ table#slostatustable { -/* width: 100%; */ - border-collapse: collapse; - margin-bottom: 1em; +/* width: 100%; */ + border-collapse: collapse; + margin-bottom: 1em; } table#slostatustable tr td { -/* border-top: 1px solid #ccc; */ - padding-left: 4px; - padding-right: 4px; +/* border-top: 1px solid #ccc; */ + padding-left: 4px; + padding-right: 4px; } table#slostatustable tr td.statustext { - min-width: 5em; - padding-left: 0px; + min-width: 5em; + padding-left: 0px; } - table#slostatustable tr td.statustext span { display: none; } table#slostatustable tr.completed td.statustext span.completed { display: inline; } table#slostatustable tr.onhold td.statustext span.onhold { display: inline; } @@ -21,66 +20,62 @@ table#slostatustable tr.inprogress td.statustext span.inprogress { display: inli table#slostatustable tr.failed td.statustext span.failed { display: inline; } table#slostatustable tr td.icons img { -/* margin: 3px; */ - display: none; +/* margin: 3px; */ + display: none; } table#slostatustable tr.completed td.icons img.completed { display: inline; } table#slostatustable tr.onhold td.icons img.onhold { display: inline; } table#slostatustable tr.inprogress td.icons img.inprogress { display: inline; } table#slostatustable tr.failed td.icons img.failed { display: inline; } - iframe.hiddeniframe { - display: none; + display: none; } /* From old CSS - - div.allcompleted#interrupt { - display: none; + display: none; } div#interrupt a:link { - color: #036; - border-bottom: 1px dotted #036; - text-decoration: none; + color: #036; + border-bottom: 1px dotted #036; + text-decoration: none; } div#interrupt a:hover { - border-bottom: 1px solid #036; + border-bottom: 1px solid #036; } div#interrupt { - display: block; - border: 3px solid #036; - background: #39F; - padding: 1em; - margin: .2em; + display: block; + border: 3px solid #036; + background: #39F; + padding: 1em; + margin: .2em; } div#iscompleted { - display: none; - border: 3px solid #993; - background: #FF9; - padding: 1em; - margin: .2em; + display: none; + border: 3px solid #993; + background: #FF9; + padding: 1em; + margin: .2em; } div.allcompleted#iscompleted { - display: block ! important; + display: block ! important; } div.inprogress, div.loggedout { - - background: #eee; - color: #444; - padding: .2em 1em; - margin: .2em; + background: #eee; + color: #444; + padding: .2em 1em; + margin: .2em; } div.inprogress { - border: 1px dotted #888; + border: 1px dotted #888; } div.loggedout { - border: 1px solid #888; - background: #9f9 ! important ; + border: 1px solid #888; + background: #9f9 ! important; } iframe.hiddeniframe { - display: none; + display: none; } - */ +*/ diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php index a1779bf09963dfe6cda64bd914397ec5c214dc1e..4d2532a7565a1851393656c92bef875b16c252d7 100644 --- a/www/saml2/idp/metadata.php +++ b/www/saml2/idp/metadata.php @@ -222,7 +222,11 @@ try { 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]['comment'] = ( + $availableCerts[$availableCert]['certFingerprint'][0] === 'afe71c28ef740bc87425be13a2263d37971da1f9' ? + 'This is the default certificate. Generate a new certificate if this is a production system.' : + '' + ); } $t->data['certdata'] = $certdata; $t->data['header'] = 'saml20-idp'; // TODO: Replace with headerString in 2.0