Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[!!!][FEATURE] Compatibility with TYPO3 v11 and v12 #105

Merged
merged 66 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b543314
Merge branch '101-php-82-support' into typo3v12
mabolek Aug 24, 2023
534ecc9
[!!!][TASK] Raise TYPO3 requirement to v11
mabolek Aug 24, 2023
eea8072
[!!!][TASK] Remove TYPO3 <v11 from CI
mabolek Aug 24, 2023
9ebd083
[CLEANUP] CS fixes
mabolek Aug 24, 2023
4e49330
[TASK] Comply with stricter PhpStan rules
mabolek Aug 24, 2023
bef56a2
[FEATURE] Configurable handling of empty files
mabolek Aug 25, 2023
811db39
[CLEANUP] Remove expired CompatibilityUtility references
mabolek Aug 25, 2023
b98057d
[!!!][TASK] Raise TYPO3 requirement to v11
mabolek Aug 24, 2023
fd44bef
[!!!][TASK] Remove TYPO3 <v11 from CI
mabolek Aug 24, 2023
2c940ab
[CLEANUP] CS fixes
mabolek Aug 24, 2023
c0bc39e
[TASK] Comply with stricter PhpStan rules
mabolek Aug 24, 2023
6510aea
[FEATURE] Configurable handling of empty files
mabolek Aug 25, 2023
2365c63
[CLEANUP] Remove expired CompatibilityUtility references
mabolek Aug 25, 2023
7077779
Merge remote-tracking branch 'origin/typo3v12' into typo3v12
mabolek Aug 25, 2023
6d650a7
[TASK] Add TYPO3 v12.4 to composer.json
mabolek Aug 25, 2023
1b2a126
[TASK] Rector code changes for TYPO3 v11
mabolek Aug 25, 2023
ea0025b
[TASK] DDEV: Use PHP 8.1
mabolek Aug 25, 2023
a778790
[CLEANUP] CS fixes
mabolek Aug 25, 2023
98b91e7
[TASK] Further PhpStan corrections
mabolek Aug 25, 2023
bce40dc
[TASK] Remove class that's no longer needed
mabolek Aug 25, 2023
2c02ff6
[WIP] Temporarily exlude HttpBackendUserAuthentication from PhpStan
mabolek Aug 25, 2023
33e5cfc
[TASK] Increase compatibility of tests in TYPO3 v11
mabolek Aug 28, 2023
c9d8415
[TASK] Refactor DB execute calls with Rector
mabolek Aug 28, 2023
cbb7f38
[TASK] Database-related refactoring
mabolek Aug 28, 2023
00af388
[TASK] Simplify conditions
mabolek Aug 28, 2023
e5b3d14
[TASK] TCA types 'file' and 'image' are relational
mabolek Aug 28, 2023
35ece1a
[TASK] Remove field table_local in sys_file_reference for v12
mabolek Aug 28, 2023
4e6032a
[TASK] Always convert array field values to comma separated
mabolek Aug 28, 2023
7ad3e30
[!!!][TASK] Remove deprecated getData() and setData()
mabolek Aug 28, 2023
917da03
[TASK] Add TYPO3 v12 to GitHub CI
mabolek Aug 28, 2023
f7ef6f9
[TASK] Remove support for doctrine/dbal ^2.13.9
mabolek Aug 28, 2023
7fc3f9a
Revert "[TASK] Remove support for doctrine/dbal ^2.13.9"
mabolek Aug 28, 2023
b502762
[TASK] Require at least TYPO3 12.4.3
mabolek Aug 28, 2023
80439b7
[TASK] Remove CI tests for TYPO3 v12 and PHP 8.0
mabolek Aug 28, 2023
8e96de2
[TASK] Remove accidental additional arrays in tests
mabolek Aug 28, 2023
71097af
[CLEANUP] CS fixes
mabolek Aug 28, 2023
ebfc595
[TASK] Exlude CompatibilityUtility from PhpStan
mabolek Aug 28, 2023
cd986b6
[CLEANUP] Remove unused import
mabolek Aug 28, 2023
67ce2ef
[CLEANUP] CS fixes
mabolek Aug 28, 2023
b2ab4eb
[CLEANUP] CS fixes
mabolek Aug 28, 2023
7c10c4e
Revert "[TASK] Exlude CompatibilityUtility from PhpStan"
mabolek Aug 28, 2023
9132c8f
[TASK] Ignore CompatibilityUtility in PhpCS
mabolek Aug 28, 2023
4c08680
[TASK] Implement v12 backportin in tx_interest_remote_id_mapping
mabolek Aug 28, 2023
773b550
[TASK] Remove extbase dependency
mabolek Aug 28, 2023
52ac31a
[TASK] Check if key exists
mabolek Aug 28, 2023
a023717
[TASK] Reintroduce forced zero for empty translation field
mabolek Aug 28, 2023
bc0fdcd
[TASK] Raise doctrine/dbal requirement to ^2.13.9
mabolek Aug 28, 2023
235a9c0
Revert "[TASK] Raise doctrine/dbal requirement to ^2.13.9"
mabolek Aug 28, 2023
b3569fe
[TASK] Raise TYPO3 requirement to ^11.5.8
mabolek Aug 28, 2023
7728951
[TASK] Raise TYPO3 requirement to ^12.4.6
mabolek Aug 28, 2023
b948caa
[TASK] Rewrite authentication code
mabolek Sep 4, 2023
6fea694
[TASK] Ensure compatibility with v11 and v12
mabolek Sep 4, 2023
3c9c03f
[CLEANUP] CS fixes
mabolek Sep 4, 2023
0facad1
[CLEANUP] CS fixes
mabolek Sep 4, 2023
4ede289
[CLEANUP] CS fixes
mabolek Sep 4, 2023
9562cf9
[CLEANUP] CS fixes
mabolek Sep 4, 2023
93aa637
[CLEANUP] CS fixes
mabolek Sep 4, 2023
df61961
[CLEANUP] CS fixes
mabolek Sep 4, 2023
8834330
Revert "[CLEANUP] CS fixes"
mabolek Sep 4, 2023
2dcfdd0
[TASK] Don't use imports for version-dependent classes
mabolek Sep 6, 2023
3354770
[TASK] Don't use imports for version-dependent classes
mabolek Sep 6, 2023
b837825
[TASK] Reintroduce dynamic compatibility class loading
mabolek Sep 11, 2023
36c9aff
[BUGFIX] Remove $imageUpdates overwrite in UpdateRecordOperationTest
mabolek Aug 24, 2023
94f4ad3
[TASK] Require typo3/testing-framework ^7.0.4
mabolek Sep 12, 2023
ed05e4e
[TASK] Set TYPO3 dependency in ext_emconf.php
mabolek Sep 17, 2023
505ea0a
[DOCS] Updates for v11+ and fixes
mabolek Sep 19, 2023
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
2 changes: 1 addition & 1 deletion .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: interest
type: php
docroot: ""
php_version: "7.4"
php_version: "8.1"
webserver_type: nginx-fpm
#router_http_port: "8081"
#router_https_port: "4434"
Expand Down
48 changes: 24 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,6 @@ jobs:
fail-fast: false
matrix:
include:
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^11.5
php-version: 7.4
composer-dependencies: highest
Expand All @@ -157,6 +145,18 @@ jobs:
- typo3-version: ^11.5
php-version: 8.2
composer-dependencies: lowest
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: highest
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: lowest
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: highest
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: lowest
functional-tests:
name: "Functional tests"
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -208,18 +208,6 @@ jobs:
fail-fast: false
matrix:
include:
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^9.5
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: highest
- typo3-version: ^10.4
php-version: 7.4
composer-dependencies: lowest
- typo3-version: ^11.5
php-version: 7.4
composer-dependencies: highest
Expand All @@ -244,3 +232,15 @@ jobs:
- typo3-version: ^11.5
php-version: 8.2
composer-dependencies: lowest
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: highest
- typo3-version: ^12.4
php-version: 8.1
composer-dependencies: lowest
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: highest
- typo3-version: ^12.4
php-version: 8.2
composer-dependencies: lowest
2 changes: 1 addition & 1 deletion .php_cs.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
'no_spaces_inside_parenthesis' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
Expand Down
111 changes: 111 additions & 0 deletions Classes/Authentication/AbstractHttpBackendUserAuthentication.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?php

declare(strict_types=1);

namespace Pixelant\Interest\Authentication;

use Pixelant\Interest\RequestHandler\Exception\InvalidArgumentException;
use Pixelant\Interest\RequestHandler\Exception\UnauthorizedAccessException;
use Pixelant\Interest\Utility\CompatibilityUtility;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Authentication\LoginType;
use TYPO3\CMS\Core\Utility\GeneralUtility;

abstract class AbstractHttpBackendUserAuthentication extends BackendUserAuthentication
{
/**
* Check if user is authenticated.
*
* @return bool
*/
public function isAuthenticated(): bool
{
return $this->getUserId() !== 0;
}

/**
* Returns the user's UID.
*
* @return int
*/
public function getUserId(): int
{
return $this->user['uid'] ?? 0;
}

/**
* Fetches login credentials from basic HTTP authentication header.
*
* @param ServerRequestInterface $request
* @return array
* @throws UnauthorizedAccessException
* @throws InvalidArgumentException
*/
protected function internalGetLoginFormData(ServerRequestInterface $request)
{
if (strtolower($request->getMethod()) !== 'post') {
throw new UnauthorizedAccessException(
'Authorization requires POST method.',
$request
);
}

$authorizationHeader = $request->getHeader('authorization')[0]
?? $request->getHeader('redirect_http_authorization')[0]
?? '';

[$scheme, $authorizationData] = GeneralUtility::trimExplode(' ', $authorizationHeader, true);

if ($scheme === null) {
throw new InvalidArgumentException(
'No authorization scheme provided.',
$request
);
}

if (strtolower($scheme) !== 'basic') {
throw new InvalidArgumentException(
'Unknown authorization scheme "' . $scheme . '".',
$request
);
}

$authorizationData = base64_decode($authorizationData, true);

if (strpos($authorizationData, ':') === false) {
throw new InvalidArgumentException(
'Authorization data couldn\'t be decoded. Missing ":" separating username and password.',
$request
);
}

[$username, $password] = explode(':', $authorizationData);

$loginData = [
'status' => LoginType::LOGIN,
'uname' => $username,
'uident' => $password,
];

if (CompatibilityUtility::typo3VersionIsLessThan('12.0')) {
return $this->processLoginData($loginData);
}

return $this->processLoginData($loginData, $request);
}

/**
* Returns the authentication service configuration with `BE_fetchUserIfNoSession` set to true.
*
* @return array
*/
protected function getAuthServiceConfiguration(): array
{
$configuration = parent::getAuthServiceConfiguration();

$configuration['BE_fetchUserIfNoSession'] = true;

return $configuration;
}
}
Loading
Loading