-
Notifications
You must be signed in to change notification settings - Fork 362
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
Bff yarp proxy improvements #1734
Merged
Erwinvandervalk
merged 3 commits into
DuendeSoftware:main
from
Erwinvandervalk:bff-yarp-proxy
Feb 4, 2025
Merged
Bff yarp proxy improvements #1734
Erwinvandervalk
merged 3 commits into
DuendeSoftware:main
from
Erwinvandervalk:bff-yarp-proxy
Feb 4, 2025
Conversation
This file contains 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
Erwinvandervalk
commented
Jan 27, 2025
c35e9a9
to
1c9cff5
Compare
Thanks Erwin! This looks very good! Could you also add a migration guide from the old extensibility points to the YARP ones? |
2babc49
to
4d66640
Compare
leastprivilege
approved these changes
Jan 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't do a full code review (someone else must do that) - but changes look good to me.
josephdecock
reviewed
Feb 3, 2025
2ad0cba
to
21ec988
Compare
Erwinvandervalk
commented
Feb 4, 2025
1e0b0aa
to
61e01fc
Compare
dd03b5f
to
355bcf7
Compare
josephdecock
approved these changes
Feb 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
The wireup of YARP in the BFF is now simplified by relying more on the functionality
of the BFF. This has several advantages, aside from the simplification. For example,
tracing and service discovery are automatically wired up correctly.
Most of the for configuring the AccessTokenRequestTransform has been moved from the Map extension method and the DefaultMessageInvokerFactory into the extension method MapRemoteBffApiEndpoint.
Breaking changes:
Removed DefaultMessageInvokerFactory
The class DefaultMessageInvokerFactory and it's interface IHttpMessageInvokerFactory have been removed. This class was used to configure the message invoker and was a point for mocking. If you wish to inject a http handler for unit testing, you can inject a custom IForwarderHttpClientFactory. For example:
Removed class DefaultHttpTransformerFactory and IHttpTransformerFactory.
This class was used to configure the default transforms. This has now been changed in favor of allowing you to inject a delegate that configures Yarp into the method MapRemoteBffApiEndpoint(). The default logic has been moved to DefaultTransformers.DirectProxyWithAccessToken(). If you wish to extend this logic, you can wrap this function in a different method and inject that into it.
If you used a custom implementation of IHttpTransformerFactory to change the default behavior of MapRemoteBffApiEndpoint(),
for example to add additional transforms, then you can now inject a custom delegate into the di container:
Removed method RemoteApiEndpoint.Map(localpath, apiAddress).
The Map method was no longer needed as most of the logic had been moved to either the MapRemoteBffApiEndpoint and the DefaultTransformers. The map method also wasn't very explicit about what it did and a number of test scenario's tried to verify if it wasn't called wrongly. You are now expected to call the method MapRemoteBffApiEndpoint. This method now has a nullable parameter that allows you to inject your own transformers.
AccessTokenRetrievalContext properties are now typed
The LocalPath and ApiAddress properties are now typed. They used to be strings. If you rely on these, for example for implementing
a custom IAccessTokenRetriever, then you should adjust their usage accordingly.
Tasks:
fixes #1692
fixes #1693