Skip to content

ServerSide Blazor: Windows authentication not working when enabling windows AND anonymous authentication #17025

@audacity76

Description

@audacity76

Describe the bug

For an internal ServerSide Blazor website I need windows authentication and anonymous access. I enabled both authentication methods in the project properties but the windows authentication does not happen.

To Reproduce

Configure following component page

@page "/authorized"

@attribute [Authorize]

@inject AuthenticationStateProvider AuthenticationStateProvider

<p>User: @User</p>

@code{
    public string User { get; set; }
    
    protected override async Task OnInitializedAsync()
    {
        var auth = await AuthenticationStateProvider.GetAuthenticationStateAsync();
        User = auth.User.Identity.Name; // null!
    }
}

Further technical details

  • ASP.NET Core version 3.0.0
  • VS 16.3.8

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions