Cover authentication, token handling and signatures with tests - #75
Merged
Merged
Conversation
The authentication provider, token and entry point get their OpenID Connect clients from an injected OpenIdConnectClientFactory. Token arguments receive the hash service as an explicit argument. The behaviour of the authentication components does not change. Previously, these classes created clients with "new" and token arguments relied on property injection inside a static factory method. Without Flow's dependency injection, neither could be replaced, so the authentication flow could not be covered by unit tests. The signatures of TokenArguments::fromArray() and fromSignedString() now require a HashService. This is part of the breaking changes of the next major release.
robertlemke
force-pushed
the
task/improve-test-coverage
branch
from
September 11, 2026 08:08
cdb73ed to
681fd0a
Compare
Unit tests now cover the authentication provider, the token, the entry point, the signed token arguments and the signature verification of identity tokens. Previously, only parsing of identity tokens, the JWKS retrieval and the cookie middleware were tested. The security relevant parts had no tests at all. Signatures are now verified against RSA keys generated during the test run, so a forged or modified token is actually rejected rather than only parsed. Deprecations triggered inside dependencies are ignored, because Flow 9.1 itself uses a cast which PHP 8.5 deprecates. Deprecations in this package still fail the tests.
robertlemke
force-pushed
the
task/improve-test-coverage
branch
from
September 11, 2026 09:03
681fd0a to
ac36f3a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds unit tests for the security relevant parts of the package: the authentication provider, the token, the entry point, the signed token arguments and the signature verification of identity tokens. Signatures are verified against RSA keys generated during the test run, so forged or modified tokens are actually rejected in the tests.
To make the authentication flow testable without Flow's dependency injection, the provider, token and entry point now get their clients from an injectable
OpenIdConnectClientFactory, andTokenArgumentsreceives theHashServiceas an argument. This refactoring does not change behaviour, but the signatures ofTokenArguments::fromArray()andfromSignedString()change, which fits into the upcoming 6.0 release.