Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1', '8.2', '8.3', '8.4']
php-version: ['8.2', '8.3', '8.4', '8.5']

uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.6
with:
Expand All @@ -45,7 +45,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.1', '8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']

steps:
- name: Setup PHP, with composer and extensions
Expand Down Expand Up @@ -85,15 +85,15 @@ jobs:
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run unit tests with coverage
if: ${{ matrix.php-versions == '8.4' }}
if: ${{ matrix.php-versions == '8.5' }}
run: vendor/bin/phpunit

- name: Run unit tests (no coverage)
if: ${{ matrix.php-versions != '8.4' }}
if: ${{ matrix.php-versions != '8.5' }}
run: vendor/bin/phpunit --no-coverage

- name: Save coverage data
if: ${{ matrix.php-versions == '8.4' }}
if: ${{ matrix.php-versions == '8.5' }}
uses: actions/upload-artifact@v6
with:
name: coverage-data
Expand All @@ -108,7 +108,7 @@ jobs:
fail-fast: true
matrix:
operating-system: [windows-latest]
php-versions: ['8.1', '8.2', '8.3', '8.4']
php-versions: ['8.2', '8.3', '8.4', '8.5']

steps:
- name: Setup PHP, with composer and extensions
Expand Down Expand Up @@ -161,8 +161,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
# Should be the higest supported version, so we can use the newest tools
php-version: '8.4'
tools: composer, composer-require-checker, composer-unused, phpcs
php-version: '8.5'
tools: composer, composer-require-checker, composer-unused
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml

- name: Setup problem matchers for PHP
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
run: composer-unused

- name: PHP Code Sniffer
run: phpcs
run: vendor/bin/phpcs

- name: PHPStan
run: |
Expand All @@ -214,7 +214,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
# Should be the lowest supported version
php-version: '8.1'
php-version: '8.2'
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
tools: composer
coverage: none
Expand Down
23 changes: 12 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,27 @@
}
},
"require": {
"php": "^8.1",
"php": "^8.2",
"ext-ctype": "*",
"ext-dom": "*",
"ext-filter": "*",
"ext-libxml": "*",
"ext-SimpleXML": "*",
"ext-session": "*",

"simplesamlphp/assert": "~1.8",
"simplesamlphp/composer-module-installer": "~1.4",
"simplesamlphp/simplesamlphp": "~2.4",
"simplesamlphp/xml-cas": "~1.3",
"simplesamlphp/xml-common": "~1.17",
"simplesamlphp/xml-soap": "~1.5",
"symfony/http-foundation": "~6.4",
"symfony/http-kernel": "~6.4",
"simplesamlphp/saml11": "~1.3"
"beste/clock": "~3.0",
"simplesamlphp/assert": "~1.9",
"simplesamlphp/composer-module-installer": "~1.6",
"simplesamlphp/simplesamlphp": "~2.5@dev",
"simplesamlphp/xml-cas": "~2.0",
"simplesamlphp/xml-common": "~2.0",
"simplesamlphp/xml-soap": "~2.0",
"symfony/http-foundation": "~7.4",
"symfony/http-kernel": "~7.4",
"simplesamlphp/saml11": "~2.0"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "~1.9"
"simplesamlphp/simplesamlphp-test-framework": "~1.10"
},
"support": {
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-casserver/issues",
Expand Down
238 changes: 132 additions & 106 deletions phpstan-baseline.neon

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions phpstan-dev-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
parameters:
ignoreErrors:
-
message: "#^Property SimpleSAML\\\\Module\\\\casserver\\\\Tests\\\\Controller\\\\Cas10ControllerTest\\:\\:\\$sessionMock is never read, only written\\.$#"
message: '#^Property SimpleSAML\\Module\\casserver\\Tests\\Controller\\Cas10ControllerTest\:\:\$sessionMock is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/src/Controller/Cas10ControllerTest.php

-
message: "#^Property SimpleSAML\\\\Module\\\\casserver\\\\Tests\\\\Controller\\\\Cas20ControllerTest\\:\\:\\$sessionMock is never read, only written\\.$#"
message: '#^Property SimpleSAML\\Module\\casserver\\Tests\\Controller\\Cas20ControllerTest\:\:\$sessionMock is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/src/Controller/Cas20ControllerTest.php

-
message: "#^Property SimpleSAML\\\\Module\\\\casserver\\\\Tests\\\\Controller\\\\Cas20ControllerTest\\:\\:\\$ticketValidatorMock is never read, only written\\.$#"
message: '#^Property SimpleSAML\\Module\\casserver\\Tests\\Controller\\Cas20ControllerTest\:\:\$ticketValidatorMock is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/src/Controller/Cas20ControllerTest.php

-
message: "#^Call to an undefined method SimpleSAML\\\\Module\\\\casserver\\\\Cas\\\\TicketValidator\\:\\:expects\\(\\)\\.$#"
message: '#^Call to an undefined method SimpleSAML\\Module\\casserver\\Cas\\TicketValidator\:\:expects\(\)\.$#'
identifier: method.notFound
count: 2
path: tests/src/Controller/Cas30ControllerTest.php

-
message: "#^Property SimpleSAML\\\\Module\\\\casserver\\\\Tests\\\\Controller\\\\Cas30ControllerTest\\:\\:\\$sessionMock is never read, only written\\.$#"
message: '#^Property SimpleSAML\\Module\\casserver\\Tests\\Controller\\Cas30ControllerTest\:\:\$sessionMock is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/src/Controller/Cas30ControllerTest.php

-
message: "#^Parameter \\#2 \\$renew of method SimpleSAML\\\\Module\\\\casserver\\\\Controller\\\\LoginController\\:\\:login\\(\\) expects bool, string given\\.$#"
message: '#^Parameter \#2 \$renew of method SimpleSAML\\Module\\casserver\\Controller\\LoginController\:\:login\(\) expects bool, string given\.$#'
identifier: argument.type
count: 1
path: tests/src/Controller/LoginControllerTest.php

-
message: "#^Property SimpleSAML\\\\Module\\\\casserver\\\\Tests\\\\Controller\\\\LoginControllerTest\\:\\:\\$sspContainer is never read, only written\\.$#"
message: '#^Property SimpleSAML\\Module\\casserver\\Tests\\Controller\\LoginControllerTest\:\:\$sspContainer is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/src/Controller/LoginControllerTest.php
21 changes: 9 additions & 12 deletions src/Cas/AttributeExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,23 @@
*/
class AttributeExtractor
{
/** @var Configuration */
private Configuration $casconfig;

/** @var ProcessingChainFactory */
private ProcessingChainFactory $processingChainFactory;

/** @var State */
/** @var \SimpleSAML\Auth\State */
private State $authState;

/**
* ID of the Authentication Source used during authn.
*/
private ?string $authSourceId = null;


public function __construct(
Configuration $casconfig,
ProcessingChainFactory $processingChainFactory,
protected Configuration $casconfig,
protected ProcessingChainFactory $processingChainFactory,
) {
$this->casconfig = $casconfig;
$this->processingChainFactory = $processingChainFactory;
$this->authState = new State();
}


/**
* Determine the user and any CAS attributes based on the attributes from the
* authsource and the CAS configuration.
Expand Down Expand Up @@ -97,6 +91,7 @@ public function extractUserAndAttributes(?array $state): array
];
}


/**
* Run authproc filters with the processing chain
* Creating the ProcessingChain require metadata.
Expand Down Expand Up @@ -129,14 +124,15 @@ protected function runAuthProcs(array &$state): void
$this->processingChainFactory->build($state)->processState($state);
}


/**
* This is a wrapper around Auth/State::loadState that facilitates testing by
* hiding the static method
*
* @param string $stateId
*
* @return array|null
* @throws NoState
* @throws \SimpleSAML\Error\NoState
*/
public function manageState(string $stateId): ?array
{
Expand All @@ -154,6 +150,7 @@ public function manageState(string $stateId): ?array
return $state;
}


/**
* @param string $id
* @param string $stage
Expand Down
12 changes: 6 additions & 6 deletions src/Cas/CasException.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
*/
class CasException extends Exception
{
/** @var string */
private string $casCode;

/**
* CasException constructor.
*
* @param string $casCode
* @param string $message
*/
public function __construct(string $casCode, string $message)
{
public function __construct(
protected string $casCode,
string $message,
) {
parent::__construct($message);
$this->casCode = $casCode;
}


/**
* @return string
*/
Expand Down
7 changes: 2 additions & 5 deletions src/Cas/Factories/ProcessingChainFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

class ProcessingChainFactory
{
/** @var Configuration */
private Configuration $casconfig;

public function __construct(
Configuration $casconfig,
protected Configuration $casconfig,
) {
$this->casconfig = $casconfig;
}


/**
* @codeCoverageIgnore
* @throws \Exception
Expand Down
Loading
Loading