Skip to content

Commit

Permalink
Merge branch 'release/6.37.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Feb 5, 2024
2 parents 38e234d + a6c511f commit 628b352
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Authors>VirtoCommerce</Authors>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>6.36.0</VersionPrefix>
<VersionPrefix>6.37.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage

protected override async Task AddAuthenticationAsync(HttpRequestMessage request)
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", await GetOrRenewTokenAsync());
if (!request.Headers.Contains("Authorization") && !request.RequestUri.AbsoluteUri.Contains("/connect/token"))
{
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", await GetOrRenewTokenAsync());
}
}

private async Task<string> GetOrRenewTokenAsync()
Expand Down
16 changes: 16 additions & 0 deletions VirtoCommerce.Storefront/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,22 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
.Send();
}));

app.UseWhen(
context => context.Request.Path.Value.EndsWith("connect/token"),
appInner => appInner
.RunProxy(context => context
.ForwardTo(platformEndpointOptions.Url)
.AddXForwardedHeaders()
.Send()));

app.UseWhen(
context => context.Request.Path.StartsWithSegments("/api/files"),
appInner => appInner
.RunProxy(context => context
.ForwardTo(platformEndpointOptions.Url)
.AddXForwardedHeaders()
.Send()));

// It will be good to rewrite endpoint routing as described here, but it's not easy to do:
// https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio#routing-startup-code
app.UseMvc(routes =>
Expand Down

0 comments on commit 628b352

Please sign in to comment.