Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 5 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ jobs:
- name: Merge coverage data
if: ${{ matrix.php-versions == '8.5' }}
run: |
./vendor/bin/phpunit-merger log build/logs/partial_junit/ build/logs/junit.xml
./vendor/bin/phpunit-merger coverage build/logs/partial_clover/ build/logs/clover.xml
./vendor/bin/phpcov merge --clover build/logs/clover.xml build/logs/partial_clover/

- name: Save coverage data
if: ${{ matrix.php-versions == '8.5' }}
Expand Down Expand Up @@ -202,6 +201,10 @@ jobs:
if: always()
run: php vendor/bin/phpcs

- name: Rector
if: always()
run: php vendor/bin/rector --dry-run

- name: Psalm
if: always()
run: php vendor/bin/psalm --show-info=true
Expand Down
191 changes: 100 additions & 91 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,98 +1,107 @@
{
"name": "simplesamlphp/simplesamlphp-module-oidc",
"description": "A SimpleSAMLphp module adding support for the OpenID Connect protocol",
"type": "simplesamlphp-module",
"keywords": [ "oauth2", "openid", "connect", "oidc", "openid connect" ],
"license": "MIT",
"authors": [
{
"name": "Spanish Research and Academic Network"
},
{
"name": "University of Córdoba"
},
{
"name": "Sergio Gómez",
"email": "sergio@uco.es"
}
],
"require": {
"php": "^8.3",
"ext-curl": "*",
"ext-json": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"guzzlehttp/guzzle": "^7.0",
"league/oauth2-server": "^9.4",
"nette/forms": "^3",
"nyholm/psr7": "^1.8",
"psr/container": "^2.0",
"psr/log": "^3",
"psr/simple-cache": "^3",
"simplesamlphp/composer-module-installer": "^1.3",
"simplesamlphp/openid": "~0.6.0",
"simplesamlphp/simplesamlphp": "^2.5.3.1",
"spomky-labs/base64url": "^2.0",
"symfony/cache": "^7.4",
"symfony/expression-language": "^7.4",
"symfony/intl": "^7.4",
"symfony/psr-http-message-bridge": "^7.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
"rector/rector": "^1.2.10",
"simplesamlphp/simplesamlphp-test-framework": "^1.9.3",
"vimeo/psalm": "^6.15.1",
"testcontainers/testcontainers": "^0.2",
"nimut/phpunit-merger": "^2.0"
},
"conflict": {
"rector/rector": "2.3.0"
"name": "simplesamlphp/simplesamlphp-module-oidc",
"description": "A SimpleSAMLphp module adding support for the OpenID Connect protocol",
"type": "simplesamlphp-module",
"keywords": [
"oauth2",
"openid",
"connect",
"oidc",
"openid connect",
"federation",
"vci",
"credential issuer"
],
"license": "MIT",
"authors": [
{
"name": "Spanish Research and Academic Network"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true,
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": true,
"simplesamlphp/composer-xmlprovider-installer": true
},
"cache-dir": "build/composer"
{
"name": "University of Córdoba"
},
"autoload": {
"psr-4": {
"SimpleSAML\\Module\\oidc\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"SimpleSAML\\Test\\Module\\oidc\\unit\\": "tests/unit/src/",
"SimpleSAML\\Test\\Module\\oidc\\integration\\": "tests/integration/src/"
}
{
"name": "Sergio Gómez",
"email": "sergio@uco.es"
}
],
"require": {
"php": "^8.3",
"ext-curl": "*",
"ext-json": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"guzzlehttp/guzzle": "^7.0",
"league/oauth2-server": "^9.4",
"nette/forms": "^3",
"nyholm/psr7": "^1.8",
"psr/container": "^2.0",
"psr/log": "^3",
"psr/simple-cache": "^3",
"simplesamlphp/composer-module-installer": "^1.3",
"simplesamlphp/openid": "~0.6.0",
"simplesamlphp/simplesamlphp": "^2.5.3.1",
"symfony/cache": "^7.4",
"symfony/expression-language": "^7.4",
"symfony/intl": "^7.4",
"symfony/psr-http-message-bridge": "^7.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
"phpunit/phpcov": "^11.0",
"rector/rector": "^2.0",
"simplesamlphp/simplesamlphp-test-framework": "^1.11.6",
"testcontainers/testcontainers": "^0.2",
"vimeo/psalm": "^6.15.1"
},
"conflict": {
"rector/rector": "2.3.0"
},
"config": {
"preferred-install": {
"*": "dist"
},
"extra": {
"branch-alias": {
}
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true,
"phpstan/extension-installer": true,
"simplesamlphp/composer-module-installer": true,
"simplesamlphp/composer-xmlprovider-installer": true
},
"scripts": {
"pre-commit": [
"vendor/bin/phpcbf -pn || true",
"vendor/bin/phpcs -p",
"vendor/bin/psalm",
"vendor/bin/phpunit"
],
"tests": [
"vendor/bin/phpunit --no-coverage"
],
"integration-tests": [
"vendor/bin/phpunit --no-configuration -c phpunit.integration.xml --no-coverage"
],
"unit-tests": [
"vendor/bin/phpunit --no-coverage"
]
"cache-dir": "build/composer"
},
"autoload": {
"psr-4": {
"SimpleSAML\\Module\\oidc\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"SimpleSAML\\Test\\Module\\oidc\\unit\\": "tests/unit/src/",
"SimpleSAML\\Test\\Module\\oidc\\integration\\": "tests/integration/src/"
}
},
"extra": {
"branch-alias": {
}
},
"scripts": {
"pre-commit": [
"vendor/bin/rector",
"vendor/bin/phpcbf -pn || true",
"vendor/bin/phpcs -p",
"vendor/bin/psalm",
"vendor/bin/phpunit"
],
"tests": [
"vendor/bin/phpunit --no-coverage"
],
"integration-tests": [
"vendor/bin/phpunit --no-configuration -c phpunit.integration.xml --no-coverage"
],
"unit-tests": [
"vendor/bin/phpunit --no-coverage"
]
}
}
4 changes: 3 additions & 1 deletion phpunit.integration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
bootstrap="./tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
cacheDirectory="./build/phpunit-cache"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitNotices="false"
failOnPhpunitNotice="false"
>
<coverage>
<report>
Expand Down
4 changes: 3 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
colors="true"
bootstrap="./tests/bootstrap.php"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
cacheDirectory="./build/phpunit-cache"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnPhpunitNotices="false"
failOnPhpunitNotice="false"
>
<coverage>
<report>
Expand Down
37 changes: 18 additions & 19 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,32 @@
declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames();
$rectorConfig->disableParallel();
if (function_exists('sspmodAutoloadPSR4')) {
spl_autoload_unregister('sspmodAutoloadPSR4');
}

$rectorConfig->bootstrapFiles([
//__DIR__ . '/vendor/autoload.php',
]);

$rectorConfig->paths([
return RectorConfig::configure()
->withParallel(timeoutSeconds: 360)
->withImportNames(importDocBlockNames: false)
->withPaths([
// TODO v7 mivanci also go trough commented out paths...
//__DIR__ . '/docker',
//__DIR__ . '/hooks',
//__DIR__ . '/public',
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withPhpSets(php83: true)
->withSkip([
FunctionFirstClassCallableRector::class,
OptionalParametersAfterRequiredRector::class,
])
->withRules([
InlineConstructorDefaultToPropertyRector::class,
DeclareStrictTypesRector::class,
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
$rectorConfig->rule(DeclareStrictTypesRector::class);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
]);
};
4 changes: 4 additions & 0 deletions src/Admin/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ public function __construct(
) {
}


public function isAdmin(): bool
{
$this->loggerService->debug('Authorization::isAdmin');
return $this->sspBridge->utils()->auth()->isAdmin();
}


/**
* @throws \SimpleSAML\Module\oidc\Exceptions\AuthorizationException
*/
Expand Down Expand Up @@ -60,6 +62,7 @@ public function requireAdmin(bool $forceAdminAuthentication = false): void
}
}


/**
* @throws \SimpleSAML\Module\oidc\Exceptions\AuthorizationException
*/
Expand Down Expand Up @@ -93,6 +96,7 @@ public function requireAdminOrUserWithPermission(string $permission): void
$this->requireAdmin(true);
}


public function getUserId(): string
{
return $this->authContextService->getAuthUserId();
Expand Down
Loading
Loading