aspnetcore: AccessDeniedPath wrong

Describe the bug

https://localhost:5001/Account/AccessDenied?ReturnUrl=%2FPrivacy

To Reproduce

Steps to reproduce the behavior:

  1. New ASP.Net Core 2.2 Web Application
  2. Add package <PackageReference Include="Microsoft.AspNetCore.Authentication.AzureADB2C.UI" Version="2.2.0" />
  3. Authorize Privacy.cshtml.cs
    [Authorize(Roles = "myb2capp-power-user")]
    public class PrivacyModel : PageModel
  1. configure “AzureAdB2C” in appsettings.json
  2. F5 to run
  3. click Privacy
  4. got 404

No webpage was found for the web address: https://localhost:5001/Account/AccessDenied?ReturnUrl=%2FPrivacy HTTP ERROR 404

Expected behavior

shoule redirect to

https://localhost:5001/AzureADB2C/Account/AccessDenied?ReturnUrl=%2FPrivacy

Workaround

    services.Configure<CookieAuthenticationOptions>(AzureADB2CDefaults.CookieScheme, options => {
            options.AccessDeniedPath = "/AzureADB2C/Account/AccessDenied";
    });

Findings

When using github code “AzureADB2CSample” project for debugging

internal class CookieOptionsConfiguration : IConfigureNamedOptions<CookieAuthenticationOptions>{
        private string GetAzureADB2CScheme(string name)
        { //name = "AzureADB2CCookie"
        }
}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (15 by maintainers)

Commits related to this issue

Most upvoted comments

different issues. #6669 fixing a clear wrong coding variable name, which always causes 404 for a common condition. @muratg