Skip to content

Commit

Permalink
General improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jun 12, 2023
1 parent 51d7ee4 commit fdbe001
Show file tree
Hide file tree
Showing 201 changed files with 1,321 additions and 939 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ jobs:
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter/slim@v4
uses: github/super-linter/slim@v5
env:
LOG_LEVEL: NOTICE
VALIDATE_ALL_CODEBASE: true
LINTER_RULES_PATH: 'tools/linters'
VALIDATE_CSS: true
Expand Down
26 changes: 17 additions & 9 deletions modules/admin/src/Controller/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
namespace SimpleSAML\Module\admin\Controller;

use Exception;
use SimpleSAML\Configuration;
use SimpleSAML\{Configuration, Module, Session, Utils};
use SimpleSAML\Locale\Translate;
use SimpleSAML\Metadata\MetaDataStorageHandler;
use SimpleSAML\Module;
use SimpleSAML\Session;
use SimpleSAML\Utils;
use SimpleSAML\XHTML\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\{Request, Response, StreamedResponse};

use function curl_close;
use function curl_exec;
use function curl_getinfo;
use function curl_init;
use function curl_setopt;
use function explode;
use function function_exists;
use function json_decode;
use function ltrim;
use function openssl_x509_check_private_key;
use function phpversion;
use function version_compare;

/**
* Controller class for the admin module.
Expand Down Expand Up @@ -205,11 +213,11 @@ protected function getPrerequisiteChecks(): array
'descr' => [
Translate::noop('PHP %minimum% or newer is needed. You are running: %current%'),
[
'%minimum%' => '7.4',
'%minimum%' => '8.0',
'%current%' => explode('-', phpversion())[0]
]
],
'enabled' => version_compare(phpversion(), '7.4', '>=')
'enabled' => version_compare(phpversion(), '8.0', '>=')
]
];
$store = $this->config->getOptionalString('store.type', null);
Expand Down
30 changes: 16 additions & 14 deletions modules/admin/src/Controller/Federation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,31 @@
namespace SimpleSAML\Module\admin\Controller;

use Exception;
use SimpleSAML\Assert\Assert;
use SimpleSAML\Assert\AssertionFailedException;
use SimpleSAML\Auth;
use SimpleSAML\Configuration;
use SimpleSAML\{Auth, Configuration, Logger, Module, Utils};
use SimpleSAML\Assert\{Assert, AssertionFailedException};
use SimpleSAML\Locale\Translate;
use SimpleSAML\Logger;
use SimpleSAML\Metadata\MetaDataStorageHandler;
use SimpleSAML\Metadata\SAMLBuilder;
use SimpleSAML\Metadata\SAMLParser;
use SimpleSAML\Metadata\Signer;
use SimpleSAML\Module;
use SimpleSAML\Metadata\{MetaDataStorageHandler, SAMLBuilder, SAMLParser, Signer};
use SimpleSAML\Module\adfs\IdP\ADFS as ADFS_IdP;
use SimpleSAML\Module\saml\IdP\SAML2 as SAML2_IdP;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Exception\ArrayValidationException;
use SimpleSAML\SAML2\XML\md\ContactPerson;
use SimpleSAML\Utils;
use SimpleSAML\XHTML\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpFoundation\{Request, Response, ResponseHeaderBag};
use Symfony\Component\VarExporter\VarExporter;

use function array_merge;
use function array_pop;
use function array_values;
use function count;
use function file_get_contents;
use function is_array;
use function sprintf;
use function str_replace;
use function trim;
use function urlencode;
use function var_export;

/**
* Controller class for the admin module.
*
Expand Down
5 changes: 3 additions & 2 deletions modules/admin/src/Controller/Sandbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

namespace SimpleSAML\Module\admin\Controller;

use SimpleSAML\Configuration;
use SimpleSAML\Session;
use SimpleSAML\{Configuration, Session};
use SimpleSAML\XHTML\Template;

use function time;

/**
* Controller class for the admin module.
*
Expand Down
13 changes: 6 additions & 7 deletions modules/admin/src/Controller/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

namespace SimpleSAML\Module\admin\Controller;

use SimpleSAML\{Auth, Configuration, Module, Session, Utils};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Configuration;
use SimpleSAML\Locale\Translate;
use SimpleSAML\Module;
use SimpleSAML\SAML2\XML\saml\NameID;
use SimpleSAML\Session;
use SimpleSAML\Utils;
use SimpleSAML\XHTML\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};

use function is_null;
use function time;
use function urlencode;

/**
* Controller class for the admin module.
Expand Down
10 changes: 7 additions & 3 deletions modules/core/hooks/hook_sanitycheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

declare(strict_types=1);

use SimpleSAML\{Configuration, Module};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Configuration;
use SimpleSAML\Module;

use function in_array;
use function is_array;
use function phpversion;
use function version_compare;

/**
* Hook to do sanitycheck
Expand All @@ -30,7 +34,7 @@ function core_hook_sanitycheck(array &$hookinfo): void
$hookinfo['info'][] = '[core] In config.php technicalcontact_email is set properly';
}

if (version_compare(phpversion(), '7.4', '>=')) {
if (version_compare(phpversion(), '8.0', '>=')) {
$hookinfo['info'][] = '[core] You are running a PHP version suitable for SimpleSAMLphp.';
} else {
$hookinfo['errors'][] = '[core] You are running an old PHP installation. ' .
Expand Down
7 changes: 7 additions & 0 deletions modules/core/src/Auth/Process/AttributeAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;

use function array_key_exists;
use function array_merge;
use function is_array;
use function is_int;
use function is_string;
use function var_export;

/**
* Filter to add attributes.
*
Expand Down
15 changes: 12 additions & 3 deletions modules/core/src/Auth/Process/AttributeAlter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@

namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\{Auth, Error};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Error;

use function array_diff;
use function array_key_exists;
use function array_merge;
use function array_values;
use function is_int;
use function is_string;
use function preg_match;
use function preg_replace;
use function var_export;

/**
* Filter to modify attributes using regular expressions
Expand Down Expand Up @@ -39,7 +48,7 @@ class AttributeAlter extends Auth\ProcessingFilter
* String to replace the pattern found with.
* @var string|false
*/
private $replacement = false;
private string|false $replacement = false;

/**
* Attribute to search in
Expand Down
5 changes: 5 additions & 0 deletions modules/core/src/Auth/Process/AttributeCopy.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;

use function array_key_exists;
use function is_array;
use function is_string;
use function var_export;

/**
* Attribute filter for renaming attributes.
*
Expand Down
14 changes: 11 additions & 3 deletions modules/core/src/Auth/Process/AttributeLimit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@

namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\{Auth, Error, Logger};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Error;
use SimpleSAML\Logger;

use function array_intersect;
use function array_key_exists;
use function array_uintersect;
use function in_array;
use function is_array;
use function is_int;
use function is_string;
use function preg_match;
use function var_export;

/**
* A filter for limiting which attributes are passed on.
Expand Down
15 changes: 12 additions & 3 deletions modules/core/src/Auth/Process/AttributeMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@
namespace SimpleSAML\Module\core\Auth\Process;

use Exception;
use SimpleSAML\{Auth, Configuration, Module};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Configuration;
use SimpleSAML\Module;
use Symfony\Component\Filesystem\Filesystem;

use function array_key_exists;
use function array_merge;
use function array_merge_recursive;
use function count;
use function explode;
use function in_array;
use function is_array;
use function is_int;
use function is_string;
use function var_export;

/**
* Attribute filter for renaming attributes.
*
Expand Down
12 changes: 9 additions & 3 deletions modules/core/src/Auth/Process/AttributeValueMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@

namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\{Auth, Error, Logger};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Error;
use SimpleSAML\Logger;

use function array_intersect;
use function array_key_exists;
use function array_merge;
use function array_unique;
use function count;
use function is_array;
use function is_int;

/**
* Filter to create target attribute based on value(s) in source attribute
Expand Down
15 changes: 10 additions & 5 deletions modules/core/src/Auth/Process/Cardinality.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@

namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\{Auth, Error, Logger, Module, Utils};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Error;
use SimpleSAML\Logger;
use SimpleSAML\Module;
use SimpleSAML\Utils;

use function array_key_exists;
use function count;
use function in_array;
use function is_array;
use function is_int;
use function is_string;
use function sprintf;
use function var_export;

/**
* Filter to ensure correct cardinality of attributes
Expand Down
12 changes: 8 additions & 4 deletions modules/core/src/Auth/Process/CardinalitySingle.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Logger;
use SimpleSAML\Module;
use SimpleSAML\Utils;
use SimpleSAML\{Auth, Logger, Module, Utils};

use function array_key_exists;
use function array_shift;
use function count;
use function implode;
use function in_array;
use function is_array;

/**
* Filter to ensure correct cardinality of single-valued attributes
Expand Down
7 changes: 3 additions & 4 deletions modules/core/src/Auth/Process/ExtendIdPSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\{Auth, Configuration, Session, SessionHandler};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Configuration;
use SimpleSAML\Session;
use SimpleSAML\SessionHandler;

use function time;

/**
* Extend IdP session and cookies.
Expand Down
12 changes: 10 additions & 2 deletions modules/core/src/Auth/Process/GenerateGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@
namespace SimpleSAML\Module\core\Auth\Process;

use Exception;
use SimpleSAML\{Auth, Logger};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Logger;

use function array_key_exists;
use function count;
use function explode;
use function is_string;
use function ord;
use function preg_replace_callback;
use function sprintf;
use function var_export;

/**
* Filter to generate a groups attribute based on many of the attributes of the user.
Expand Down
5 changes: 3 additions & 2 deletions modules/core/src/Auth/Process/LanguageAdaptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\{Auth, Logger};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Locale\Language;
use SimpleSAML\Logger;

use function array_key_exists;

/**
* Filter to set and get language settings from attributes.
Expand Down
5 changes: 3 additions & 2 deletions modules/core/src/Auth/Process/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace SimpleSAML\Module\core\Auth\Process;

use SimpleSAML\{Auth, Error};
use SimpleSAML\Assert\Assert;
use SimpleSAML\Auth;
use SimpleSAML\Error;

use function strval;

/**
* Attribute filter for running arbitrary PHP code.
Expand Down
Loading

0 comments on commit fdbe001

Please sign in to comment.