Keep configured auth transports when faking an actor - #91
Merged
roxblnfk merged 4 commits intoSep 21, 2026
Merged
Conversation
withActor() replaced the whole TransportRegistry with a fresh one holding a
single transport named "testing". AuthTransportMiddleware, which is how
HttpAuthBootloader wires auth into an application, asks the registry for a
transport by name, so a request through it died with
Spiral\Auth\Exception\TransportException: Undefined auth transport header
AuthMiddleware kept working because it iterates over every transport, which is
why the failure looked like it only happened with a custom transport.
The fake registry is now built from the names the application has configured,
each mapped to the same fake HeaderTransport that reads X-Test-Token, so
whichever name the middleware asks for it gets a transport that finds the test
token. "testing" stays and becomes the default. An application with no registry
bound behaves as before.
The test app had no withActor() coverage at all, so the three tests come with
two middleware stubs: one that runs AuthTransportMiddleware('header') resolved
from the http scope, one that reports the actor into the response body.
For spiral/framework#1231
Contributor
Author
|
added a type for psalm, it didn't know what the container returns. the other psalm errors aren't from this pr i believe |
… the fake one Catching \Throwable hid real failures: a custom transport whose constructor or Autowire throws was silently dropped, and the request then failed with the misleading "Undefined auth transport" message. Only the absence of a registry binding is an expected condition. Assisted-By: Claude Fable 5.1
… stub The named-transport test used the built-in "header" transport, while the reported problem was about transports the application adds itself. A test bootloader registers a "custom" transport through HttpAuthBootloader::addTransport(); without the fix both named-transport tests fail with "Undefined auth transport <name>". AuthTransportMiddleware is resolved by the container from an Autowire bound under an alias in the http scope, the same way an application registers it in a middleware group, so the hand-built HeaderAuthMiddleware stub is no longer needed. Assisted-By: Claude Fable 5.1
roxblnfk
force-pushed
the
fix-fakehttp-custom-auth-transport
branch
from
September 21, 2026 14:27
5291459 to
21d47dc
Compare
roxblnfk
approved these changes
Sep 21, 2026
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.
withActor()replaced the whole TransportRegistry with a single "testing" transport, soAuthTransportMiddlewarefailed with "Undefined auth transport header".The fake registry now keeps the app's transport names, each mapped to the fake header transport.
Refs spiral/framework#1231