Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
VDS-106: Take into account PR notes
Browse files Browse the repository at this point in the history
  • Loading branch information
trueboroda authored and pushnitsa committed Nov 26, 2020
1 parent b825ebd commit 23d3076
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using VirtoCommerce.Storefront.Domain.Security;
using VirtoCommerce.Storefront.Model.Common;

namespace VirtoCommerce.Storefront.Filters
{
Expand All @@ -32,13 +33,13 @@ public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
}

// To avoid an infinite redirect to the login action when no store theme and "Allow anonymous user" of the store is disabled
var isItNoThemeAction = context.RouteData.Values.TryGetValue("controller", out var controller)
var isNoThemeAction = context.RouteData.Values.TryGetValue("controller", out var controller)
&& context.RouteData.Values.TryGetValue("action", out var action)
&& (controller as string).Equals("Common", StringComparison.InvariantCultureIgnoreCase)
&& (action as string).Equals("NoTheme", StringComparison.InvariantCultureIgnoreCase);
&& ((string)controller).EqualsInvariant("Common")
&& ((string)action).EqualsInvariant("NoTheme");

// Don not call filter for ReExecute requests (such as status code pages) and skips all paths marked as AllowAnonymous attribute
if (context.HttpContext.Features.Get<IStatusCodeReExecuteFeature>() != null || context.Filters.Any(x => x is IAllowAnonymousFilter) || isItNoThemeAction)
if (context.HttpContext.Features.Get<IStatusCodeReExecuteFeature>() != null || context.Filters.Any(x => x is IAllowAnonymousFilter) || isNoThemeAction)
{
return;
}
Expand Down

0 comments on commit 23d3076

Please sign in to comment.