-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I've created a blazor server project and added basic authentication by creating a custom AuthenticationStateProvider.
Just the very basics like described on this microsoft page
When adding a AuthorizeView component to a razor page (with or without the Authorized and/or NotAuthorized sub-components) it works fine when I add a Roles="xxx" property. If I omit this property it does not work.
So when a user is logged in successfully and has the role "User" the following will happen:
<AuthorizeView>
This does not show.
</AuthorizeView>
<AuthorizeView>
<Authorized>
This does not show.
</Authorized>
<NotAuthorized>
This shows like it should.
</NotAuthorized>
</AuthorizeView>
<AuthorizeView Roles="User">
This shows like it should.
</AuthorizeView>
<AuthorizeView Roles="User">
<Authorized>
This shows like it should.
</Authorized>
<NotAuthorized>
This does not show.
</NotAuthorized>
</AuthorizeView>
Expected Behavior
Show the <Authorized>
contents, even if the Roles property is not assigned a value.
Steps To Reproduce
Just create a new app with the examples as described on
Exceptions (if any)
No response
.NET Version
8.0.100-preview.4.23260.5
Anything else?
Installed products:
Microsoft Visual Studio Community 2022
Version 17.7.0
VisualStudio.17.Release/17.7.0+34003.232
Microsoft .NET Framework
Version 4.8.09032
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA915
Microsoft Visual C++ 2022
ASP.NET and Web Tools 17.7.265.7160
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.7.265.7160
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 17.7.265.7160
Azure Functions and Web Jobs Tools
C# Tools 4.7.0-3.23373.1+7829f6b85177e96de89bc67f32b61d74ac590f5a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.4.34 (main@d5ab18b)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.7.27 (547ea6f)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.7.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.7.3.2333001+0ab18affdf2a37647768d0e25f5f021bee6257a1
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.7.9.2
Microsoft SQL Server Data Tools
TypeScript Tools 17.0.20628.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.7.0-3.23373.1+7829f6b85177e96de89bc67f32b61d74ac590f5a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.7.0-beta.23314.10+e612cf93b989503c89e3a5830090062b7ab5e143
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.7.0.214 (d17-7@a69bacb)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.7.3.9 (remotes/origin/d17-7@796d191def)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android SDK 13.2.1.2 (d17-5/a8a26c7)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d