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] TYPO3 v11 and v12 compatibility #9

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open

Conversation

andreaswolf
Copy link
Collaborator

I built upon the other two MRs and did some more lifting:

  • the Client entity now does something actually useful (and has all its data, not just an arbitrary subset dictated by the interfaces/traits)
  • redundant comments were removed
  • PhpStan integration w/ level 8 and 0 errors
  • the tests can actually be run (PHPUnit and friends were missing as dependencies…)

I have, however, not tested this in any way, so it might break or eat your cat or whatever. Need to setup a local test instance w/ the required data later on.

wandoliver and others added 17 commits October 26, 2021 13:11
Fatal error: During inheritance of JsonSerializable: Uncaught TYPO3\CMS\Core\Error\Exception: PHP Deprecation Notice: Return type of FGTCLB\OAuth2Server\Domain\Entity\Scope::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/public/typo3conf/ext/oauth2_server/Classes/Domain/Entity/Scope.php line 16 in /var/www/html/vendor/helhum/typo3-console/Classes/Console/Error/ErrorHandler.php:88
This also changes the repository to use the client entity itself where
possible. The entity instances are created using a factory method, which
will in the future ease changes in the table's schema.
@bresam
Copy link

bresam commented Mar 22, 2023

@andreaswolf Will you guys ever merge this and future PRs as well or is this project cold?
If you are reactive and open for participations i'd like to participate to that repository related to t3v12+

@andreaswolf
Copy link
Collaborator Author

This will definitely be merged, I just did not get to test it yet. If anyone can confirm that this actually works in the current state, I'm happy to merge this PR.
Maybe it would also help if we had some CI setup for this, that also includes some automated tests for the authentication. I just always shied away from the effort that this would require, since we most likely need a full-blown setup with a separate client site that uses the OAuth2 implementation within TYPO3. Sounds like quite some setup effort that I just did not manage to do yet.

And of course help for v12 is always welcome, so thanks for the offer @bresam :)

In favour of TYPO3 Core Build and Testing the file phpstan.neon is
removed.
Instead the file inside Build/phpstan is used for running locally and in
pipelines
Run commands
`composer --dev remove nimut/testing-framework`
`composer --dev require typo3/testing-framework:^7.0`
Changed UnitTestCase from nimut to TYPO3 Core Testing Framework
command:
`composer req --dev friendsofphp/php-cs-fixer:^v3.52`
command:
`Build/Scripts/runTests.sh -s cgl`
command:
`composer req --dev phpspec/prophecy-phpunit:^v2.2`
* Add Code and Message expectation
* Add associative array keys to data provider
* rename test cases for clearer test states
@calien666 calien666 self-assigned this Mar 25, 2024
@calien666 calien666 force-pushed the typo3-11 branch 2 times, most recently from a74a179 to aaa0ee6 Compare April 5, 2024 14:52
* adds successful login redirect test with logged-in user
* adds login redirect to login page if no logged-in user
As the ResourceServer needs absolute file path to key files,
Configuration class returns now the system internal correct file path.
Unit Test expected the values from LocalConfiguration "as is", which now
is no longer given. In this case, we only check, if the values are given
to configuration and handled correct
Use a DataProvider for recurring test cases
Adds basic test for generating a Bearer Token from oauth2_server
Adds basic test for generating a Bearer Token from oauth2_server
Add tests for failing auth with access_token
For a clearer handling with more possibilities, the ResourceServer
handling needs to be improved.

* Add ResourceHandlerInterface
* Add AbstractResourceHandler
* Add DefaultResourceHandler with 501 Not implemented response
* Add CompilerPass for ResourceHandlerPass to implement tagged handlers
* Rework Middleware handling with the handler and return a Response
The current implementation has hard-coded OAuth endpoints. With this
commit endpoints for authorization, token generation and refreshing and
resource handling are made dynamic via Extension configuration.
Additionally, the lifetimes of tokens and authCode are made dynamic with
fallback to the previous defined default.
@calien666
Copy link
Member

I'm working with high speed, getting this ext v11 compatible. As I changed some behaviour according to the Resource Server handling, I'll also write documentation.

In preparation for TYPO3 v12 and phpunit v10 support, dataProviders now
are static to avoid deprecation warning with phpunit 10
* Add github action for v12 testing
* change signatures for phpstan
@calien666 calien666 changed the title [TASK] TYPO3 v11 [FEATURE] TYPO3 v11 and v12 compatibility Apr 8, 2024
Adds Functional test for refreshing token and moves test preparation
requests to AbstractOauth2ServerTestCase
@calien666 calien666 marked this pull request as ready for review April 9, 2024 11:07
@calien666
Copy link
Member

Closes #8
Closes #7

ResourceServer handles with identity returns.
Rename the handlers to IdentityHandler
Generated auth tokens named like a given var in method. Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants