From f9218078d9cb0b216135b482cfbc1a9ed060650e Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Thu, 18 Oct 2018 18:26:09 +0200 Subject: [PATCH] Fixed array declarations on templates --- config-templates/authsources.php | 160 +++++++++++------------ config-templates/config.php | 152 ++++++++++----------- metadata-templates/saml20-idp-hosted.php | 14 +- metadata-templates/saml20-idp-remote.php | 4 +- metadata-templates/saml20-sp-remote.php | 4 +- metadata-templates/shib13-idp-remote.php | 4 +- metadata-templates/shib13-sp-remote.php | 1 - 7 files changed, 170 insertions(+), 169 deletions(-) diff --git a/config-templates/authsources.php b/config-templates/authsources.php index c637594c9..ac1d1c554 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 f3f776351..ac9b800f2 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/metadata-templates/saml20-idp-hosted.php b/metadata-templates/saml20-idp-hosted.php index 582af8ee9..ecb05ce11 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 49f44f028..d390647e6 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 92ff45da1..a9940e820 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 0757aa83b..69c1ef324 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 8d6a32479..f60174e28 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, ]; - -- GitLab