From 25a0cf778758ef756db788be70b0aa32fdd434f9 Mon Sep 17 00:00:00 2001 From: Polina Tyureva Date: Mon, 30 Nov 2026 17:35:37 +0400 Subject: [PATCH 1/4] add comments --- CS/BlazorAuth/Code/CustomDashboardStorage.cs | 6 ++++-- CS/BlazorAuth/Code/DashboardUserProvider.cs | 4 ++++ CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs | 2 ++ CS/BlazorAuth/Program.cs | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CS/BlazorAuth/Code/CustomDashboardStorage.cs b/CS/BlazorAuth/Code/CustomDashboardStorage.cs index 0e30271..ab4cab5 100644 --- a/CS/BlazorAuth/Code/CustomDashboardStorage.cs +++ b/CS/BlazorAuth/Code/CustomDashboardStorage.cs @@ -10,7 +10,7 @@ public class CustomDashboardStorage : IEditableDashboardStorage { public CustomDashboardStorage(IWebHostEnvironment hostingEnvironment, IDashboardUserProvider dashboardUserProvider) { this.dashboardUserProvider = dashboardUserProvider; this.DashboardStorageFolder = hostingEnvironment.ContentRootFileProvider.GetFileInfo("App_Data/Dashboards").PhysicalPath! - ?? throw new InvalidOperationException("Dashboard storage dashboardPath is not available."); + ?? throw new InvalidOperationException("The dashboard storage folder is not available."); } public IEnumerable GetAvailableDashboardsInfo() { @@ -67,9 +67,11 @@ public void SaveDashboard(string dashboardID, XDocument dashboard) { File.WriteAllText(dashboardPath, dashboard.ToString()); } + // Dashboard IDs and names come from the client. + // Verifies that the resulting path is inside the dashboard storage folder. void ValidateDashboardPath(string dashboardPath) { if(!SafePath.IsRooted(DashboardStorageFolder, dashboardPath)) - throw new InvalidOperationException("Invalid dashboard folder dashboardPath"); + throw new InvalidOperationException("The dashboard path is outside the dashboard storage folder."); } } } \ No newline at end of file diff --git a/CS/BlazorAuth/Code/DashboardUserProvider.cs b/CS/BlazorAuth/Code/DashboardUserProvider.cs index 5a37719..e96f478 100644 --- a/CS/BlazorAuth/Code/DashboardUserProvider.cs +++ b/CS/BlazorAuth/Code/DashboardUserProvider.cs @@ -6,6 +6,7 @@ public interface IDashboardUserProvider { string? GetUserName(); } + // Obtains the current user name from the AuthenticationStateProvider. public class DashboardUserProvider : IDashboardUserProvider { readonly AuthenticationStateProvider authProvider; @@ -13,6 +14,8 @@ public DashboardUserProvider(AuthenticationStateProvider provider) { this.authProvider = provider; } + // Dashboard storage and provider methods are synchronous. + // This method reads the authentication state only if it is already available and does not block the circuit. public string? GetUserName() { var stateTask = authProvider.GetAuthenticationStateAsync(); if(!stateTask.IsCompletedSuccessfully) @@ -27,6 +30,7 @@ public DashboardUserProvider(AuthenticationStateProvider provider) { return ReadName(state); } + // Identity user names are email addresses: "admin@gmail.com" -> "admin". static string? ReadName(AuthenticationState state) { var identity = state.User.Identity; return identity?.IsAuthenticated == true ? identity.Name?.Split('@')[0] : null; diff --git a/CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs b/CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs index 6a8ff02..b3d6086 100644 --- a/CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs +++ b/CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs @@ -16,6 +16,8 @@ public MultiTenantDashboardConfigurator( SetDashboardStorage(dashboardStorage); SetDBSchemaProvider(dbSchemaProvider); + // Restricts unauthorized users and guests: they cannot create, edit, or save dashboards on the server. + // The handler reads the user name on each call, as do the custom storages and providers: the authentication state can change while the circuit is active. VerifyClientTrustLevel += (s, e) => { var userName = dashboardUserProvider.GetUserName(); diff --git a/CS/BlazorAuth/Program.cs b/CS/BlazorAuth/Program.cs index 371f781..6bce3bb 100644 --- a/CS/BlazorAuth/Program.cs +++ b/CS/BlazorAuth/Program.cs @@ -24,6 +24,8 @@ builder.Services.AddDevExpressControls(); builder.Services.AddRazorPages(); +// Register dashboard storages and providers as scoped services. +// In the Blazor circuit, each user connection gets its own instances. builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); From cf29be3a3f1c20a6a7387f6ee0e6d33654ff259a Mon Sep 17 00:00:00 2001 From: Polina Tyureva Date: Mon, 30 Nov 2026 17:35:45 +0400 Subject: [PATCH 2/4] update readme --- README.md | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fa26364..c2ddc9c 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,19 @@ [![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183) [![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives) -# Dashboard for Blazor - How to Implement Multi-Tenant Dashboard Architecture using the ASP.NET Core's Identity Authentication System +# Blazor BI Dashboard - Implement Multi-Tenant Dashboard Architecture using the ASP.NET Core's Identity Authentication System -This example shows how to configure the Dashboard component for Blazor so that it works in the multi-user environment. +This example configures the Dashboard component to work in a multi-user environment. -The example uses ASP.NET Core Identity for authentication and Blazor's `AuthenticationStateProvider` to identify the current user. It configures dashboard storage, data sources, connection strings, and schema access based on that user's identity. +The Dashboard component [processes requests in the Blazor circuit](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit) (the SignalR connection between the browser and the server). The example uses ASP.NET Core Identity for authentication and Blazor's `AuthenticationStateProvider` to determine the current user. Custom storages and providers use the user name to return user-specific dashboards, data sources, connection strings, and database schema. -![](web-dashboard-blazor-auth.png) +![Blazor BI Dashboard](web-dashboard-blazor-auth.png) -## How to Launch +## How to Launch the App -This example was created based on the **Blazor Server App** Visual Studio template with the *Authentication Type = 'Individual Accounts'* setting (see [Secure ASP.NET Core Blazor Server apps](https://docs.microsoft.com/en-us/aspnet/core/blazor/security/server/?view=aspnetcore-5.0&tabs=visual-studio)). The example uses the [ASP.NET Core's Identity mechanism](https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-5.0&tabs=visual-studio) for authentication. For this reason, you need to follow the steps below to initialize the Identity database and register required user accounts in it: +This example is created based on the **Blazor Server App** Visual Studio template with the *Authentication Type = 'Individual Accounts'* setting (see [Secure ASP.NET Core server-side Blazor apps](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/)). The example uses the [ASP.NET Core's Identity mechanism](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity) for authentication. Follow the steps below to initialize the Identity database and register required user accounts in it: -1) Apply the `00000000000000_CreateIdentitySchema` migration to the `aspnet-BlazorAuth-...` database. You can run the following command in the Package Manager Console for this purpose: +1) Apply the `00000000000000_CreateIdentitySchema` migration to the database specified in the [appsettings.json](./CS/BlazorAuth/appsettings.json) file. You can run the following command in the Package Manager Console for this purpose: ``` PM> Update-Database @@ -39,9 +39,11 @@ If the current accounts do not exist, go to the **Register** page (`Identity/Acc ## Example Overview -The [MultiTenantDashboardConfigurator](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) class configures user-specific dashboard storage and data providers. It is registered as a scoped DI service in [Program.cs](./CS/BlazorAuth/Program.cs). +[Program.cs](./CS/BlazorAuth/Program.cs) calls the [AddDevExpressBlazorDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardBlazor.StartupExtensions.AddDevExpressBlazorDashboard(Microsoft.Extensions.DependencyInjection.IServiceCollection)) method so that the Dashboard component processes requests in the Blazor circuit. The file also registers custom storages and providers as scoped services. -In [Dashboard.razor](./CS/BlazorAuth/Pages/Dashboard.razor), the component's `OnInitializedAsync` method retrieves the current authentication state and configures the working mode based on the user name. The configurator and each custom store/provider extracts the user name through DI. +The [DashboardUserProvider](./CS/BlazorAuth/Code/DashboardUserProvider.cs) service obtains the current user name from the `AuthenticationStateProvider`. The [MultiTenantDashboardConfigurator](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) class and each custom storage and provider obtain the user name from this service. + +In [Dashboard.razor](./CS/BlazorAuth/Pages/Dashboard.razor), the `OnInitializedAsync` method specifies the working mode based on the user name. When the application starts, you see the [Index](./CS/BlazorAuth/Pages/Index.razor) view where you can select a user. Use the **Log in** link for this purpose. Below is a table that illustrates the user IDs and their associated rights in this example: @@ -91,7 +93,10 @@ A custom connection string provider allows you to specify connection strings dep ### Working Mode -The Web Dashboard control can operate in `ViewerOnly` mode for unauthorized users. To do this, handle the [DashboardConfigurator.VerifyClientTrustLevel](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.VerifyClientTrustLevel) event and set the `e.ClientTrustLevel` property to `Restricted`. This setting prevents inadvertent or unauthorized modifications of dashboards stored on a server. You can find more information in the following help section: [Security Considerations - Working Mode Access Rights](https://docs.devexpress.com/Dashboard/118651/web-dashboard/general-information/security-considerations#working-mode-access-rights). +Guests and unauthorized users see dashboards in `ViewerOnly` mode: [Dashboard.razor](./CS/BlazorAuth/Pages/Dashboard.razor) sets the `WorkingMode` property based on the user name. The [DashboardConfigurator.VerifyClientTrustLevel](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.VerifyClientTrustLevel) event handler in [MultiTenantDashboardConfigurator.cs](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) sets the `e.ClientTrustLevel` property to `Restricted` for these users, so they cannot create, edit, or save dashboards on the server. For additional information, refer to the following help sections: + +- [Process Dashboard Requests in the Blazor Circuit - Security Considerations](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit#security-considerations) +- [Security Considerations - Working Mode Access Rights](https://docs.devexpress.com/Dashboard/118651/web-dashboard/general-information/security-considerations#working-mode-access-rights) **API**: [DashboardConfigurator.VerifyClientTrustLevel Event](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.VerifyClientTrustLevel) @@ -99,9 +104,9 @@ The Web Dashboard control can operate in `ViewerOnly` mode for unauthorized user ## Documentation -- [Create an ASP.NET Core Dashboard Application](https://docs.devexpress.com/Dashboard/119284/get-started/build-web-dashboard-applications/create-an-aspnet-core-dashboard-application?p=netframework) +- [Process Dashboard Requests in the Blazor Circuit](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit) - [Manage Multi-Tenancy](https://docs.devexpress.com/Dashboard/402924/web-dashboard/dashboard-backend/manage-multi-tenancy) -- [ASP.NET Core Blazor authentication and authorization](https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0) +- [ASP.NET Core Blazor authentication and authorization](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/) ## More Examples From fdbc5e60855cebab87c689db883a15a3dd79ed56 Mon Sep 17 00:00:00 2001 From: Polina T <56310766+pollyndos@users.noreply.github.com> Date: Thu, 3 Dec 2026 17:37:57 +0400 Subject: [PATCH 3/4] Apply batched suggestions from code review Co-authored-by: Elena Khamliuk <80813840+khamlyuk@users.noreply.github.com> --- README.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c2ddc9c..9da4134 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,15 @@ This example configures the Dashboard component to work in a multi-user environment. -The Dashboard component [processes requests in the Blazor circuit](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit) (the SignalR connection between the browser and the server). The example uses ASP.NET Core Identity for authentication and Blazor's `AuthenticationStateProvider` to determine the current user. Custom storages and providers use the user name to return user-specific dashboards, data sources, connection strings, and database schema. +The Dashboard component [processes requests in the Blazor circuit](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit) (the SignalR connection between the browser and the server). The example uses ASP.NET Core Identity for authentication and Blazor `AuthenticationStateProvider` to determine the current user. Custom storages and providers rely on the user name to return user-specific dashboards, data sources, connection strings, and database schema. ![Blazor BI Dashboard](web-dashboard-blazor-auth.png) -## How to Launch the App +## Launch the Application -This example is created based on the **Blazor Server App** Visual Studio template with the *Authentication Type = 'Individual Accounts'* setting (see [Secure ASP.NET Core server-side Blazor apps](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/)). The example uses the [ASP.NET Core's Identity mechanism](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity) for authentication. Follow the steps below to initialize the Identity database and register required user accounts in it: +This example is based on the **Blazor Server App** Visual Studio template with the *Authentication Type = 'Individual Accounts'* option (refer to [Secure ASP.NET Core server-side Blazor apps](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/)). The example uses the [ASP.NET Core Identity mechanism](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity) for authentication. Follow the steps below to initialize the Identity database and register required user accounts: -1) Apply the `00000000000000_CreateIdentitySchema` migration to the database specified in the [appsettings.json](./CS/BlazorAuth/appsettings.json) file. You can run the following command in the Package Manager Console for this purpose: +1) Run the following Package Manager console command to apply the `00000000000000_CreateIdentitySchema` migration to the database (specified in the [appsettings.json](./CS/BlazorAuth/appsettings.json) file): ``` PM> Update-Database @@ -35,29 +35,28 @@ This example is created based on the **Blazor Server App** Visual Studio templat Password: 1*234aD ``` -If the current accounts do not exist, go to the **Register** page (`Identity/Account/Register`) to create and confirm these user accounts. +If current accounts do not exist, visit the **Register** page (`Identity/Account/Register`) to create these user accounts. ## Example Overview -[Program.cs](./CS/BlazorAuth/Program.cs) calls the [AddDevExpressBlazorDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardBlazor.StartupExtensions.AddDevExpressBlazorDashboard(Microsoft.Extensions.DependencyInjection.IServiceCollection)) method so that the Dashboard component processes requests in the Blazor circuit. The file also registers custom storages and providers as scoped services. +In the [Program.cs](./CS/BlazorAuth/Program.cs) file, the application builder calls the [AddDevExpressBlazorDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardBlazor.StartupExtensions.AddDevExpressBlazorDashboard(Microsoft.Extensions.DependencyInjection.IServiceCollection)) method to allow the Dashboard component process requests in the Blazor circuit. In this file, you can also also find custom storage and provider registration (as scoped services). The [DashboardUserProvider](./CS/BlazorAuth/Code/DashboardUserProvider.cs) service obtains the current user name from the `AuthenticationStateProvider`. The [MultiTenantDashboardConfigurator](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) class and each custom storage and provider obtain the user name from this service. In [Dashboard.razor](./CS/BlazorAuth/Pages/Dashboard.razor), the `OnInitializedAsync` method specifies the working mode based on the user name. -When the application starts, you see the [Index](./CS/BlazorAuth/Pages/Index.razor) view where you can select a user. Use the **Log in** link for this purpose. Below is a table that illustrates the user IDs and their associated rights in this example: +When the application starts, you see the [Index](./CS/BlazorAuth/Pages/Index.razor) page where you can select a user (the **Log in** link). The table below lists user IDs and their associated rights used within this example: | Role | Dashboard Storage | DataSource Storage | ConnectionString Provider | DBSchema Provider | Working Mode | Create/Edit | | --- | --- | --- | --- | --- | --- | --- | -| Admin | dashboard1_admin, dashboard2_admin | SqlDataSource, JsonDataSource | Northwind, CarsXtraScheduling | All (Categories, Products, Cars,...) | Designer, Viewer | Yes | +| Admin | dashboard1_admin, dashboard2_admin | SqlDataSource, JsonDataSource | Northwind, CarsXtraScheduling | All (Categories, Products, Cars,…) | Designer, Viewer | Yes | | User | dashboard1_user | SqlDataSource | CarsXtraScheduling | Cars | Designer, Viewer | No | | Guest | dashboard1_guest | - | - | - | ViewerOnly | - | | Unauthorized | - | - | - | - | ViewerOnly | - | -## Example Details +## Implementation Details -You can return the following user-specific content: ### Dashboards @@ -93,7 +92,7 @@ A custom connection string provider allows you to specify connection strings dep ### Working Mode -Guests and unauthorized users see dashboards in `ViewerOnly` mode: [Dashboard.razor](./CS/BlazorAuth/Pages/Dashboard.razor) sets the `WorkingMode` property based on the user name. The [DashboardConfigurator.VerifyClientTrustLevel](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.VerifyClientTrustLevel) event handler in [MultiTenantDashboardConfigurator.cs](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) sets the `e.ClientTrustLevel` property to `Restricted` for these users, so they cannot create, edit, or save dashboards on the server. For additional information, refer to the following help sections: +Guests and unauthorized users view dashboards in `ViewerOnly` mode: [Dashboard.razor](./CS/BlazorAuth/Pages/Dashboard.razor) sets the `WorkingMode` property based on the user name. The [DashboardConfigurator.VerifyClientTrustLevel](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.DashboardConfigurator.VerifyClientTrustLevel) event handler in [MultiTenantDashboardConfigurator.cs](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) sets the `e.ClientTrustLevel` property to `Restricted` for these users, so they cannot create, edit, or save dashboards on the server. For additional information, refer to the following help sections: - [Process Dashboard Requests in the Blazor Circuit - Security Considerations](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit#security-considerations) - [Security Considerations - Working Mode Access Rights](https://docs.devexpress.com/Dashboard/118651/web-dashboard/general-information/security-considerations#working-mode-access-rights) From 24a033d334691587a41d0c13767f61df9f367742 Mon Sep 17 00:00:00 2001 From: Polina Tyureva Date: Thu, 3 Dec 2026 18:22:53 +0400 Subject: [PATCH 4/4] update --- CS/BlazorAuth/Pages/Index.razor | 2 +- README.md | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CS/BlazorAuth/Pages/Index.razor b/CS/BlazorAuth/Pages/Index.razor index 2068b7e..5a820d5 100644 --- a/CS/BlazorAuth/Pages/Index.razor +++ b/CS/BlazorAuth/Pages/Index.razor @@ -9,7 +9,7 @@

Multi-tenant Dashboard for Blazor

-

Log in as one of the user below and navigate to the Web Dashboard page to see the result:

+

Log in as one of the users below and navigate to the Web Dashboard page to see the result:

Email: admin@gmail.com
Password: 1*234aB

diff --git a/README.md b/README.md index 9da4134..d523606 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This example configures the Dashboard component to work in a multi-user environment. -The Dashboard component [processes requests in the Blazor circuit](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit) (the SignalR connection between the browser and the server). The example uses ASP.NET Core Identity for authentication and Blazor `AuthenticationStateProvider` to determine the current user. Custom storages and providers rely on the user name to return user-specific dashboards, data sources, connection strings, and database schema. +The Dashboard component [processes requests in the Blazor circuit](https://docs.devexpress.com/Dashboard/406269/web-dashboard/integrate-dashboard-component/dashboard-component-for-blazor/process-requests-in-blazor-circuit) (the SignalR connection between the browser and the server). The example uses ASP.NET Core Identity for authentication and Blazor [`AuthenticationStateProvider`](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/authentication-state) to determine the current user. Custom storages and providers rely on the user name to return user-specific dashboards, data sources, connection strings, and database schema. ![Blazor BI Dashboard](web-dashboard-blazor-auth.png) @@ -16,13 +16,13 @@ The Dashboard component [processes requests in the Blazor circuit](https://docs. This example is based on the **Blazor Server App** Visual Studio template with the *Authentication Type = 'Individual Accounts'* option (refer to [Secure ASP.NET Core server-side Blazor apps](https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/)). The example uses the [ASP.NET Core Identity mechanism](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity) for authentication. Follow the steps below to initialize the Identity database and register required user accounts: -1) Run the following Package Manager console command to apply the `00000000000000_CreateIdentitySchema` migration to the database (specified in the [appsettings.json](./CS/BlazorAuth/appsettings.json) file): +1) Run the following Package Manager Console command to apply the `00000000000000_CreateIdentitySchema` migration to the SQL Server LocalDB database (specified in the [appsettings.json](./CS/BlazorAuth/appsettings.json) file): ``` PM> Update-Database ``` -2) In this example, the following user accounts were authorized: +2) Run the application and register the following accounts (the **Register** link). After you register an account, click **Click here to confirm your account**: ``` Email: admin@gmail.com @@ -35,13 +35,13 @@ This example is based on the **Blazor Server App** Visual Studio template with t Password: 1*234aD ``` -If current accounts do not exist, visit the **Register** page (`Identity/Account/Register`) to create these user accounts. + The part of the email before `@` determines user rights (see the table below). ## Example Overview -In the [Program.cs](./CS/BlazorAuth/Program.cs) file, the application builder calls the [AddDevExpressBlazorDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardBlazor.StartupExtensions.AddDevExpressBlazorDashboard(Microsoft.Extensions.DependencyInjection.IServiceCollection)) method to allow the Dashboard component process requests in the Blazor circuit. In this file, you can also also find custom storage and provider registration (as scoped services). +In the [Program.cs](./CS/BlazorAuth/Program.cs) file, the application builder calls the [AddDevExpressBlazorDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardBlazor.StartupExtensions.AddDevExpressBlazorDashboard(Microsoft.Extensions.DependencyInjection.IServiceCollection)) method to allow the Dashboard component to process requests in the Blazor circuit. In this file, you can also find custom storage and provider registration (as scoped services). -The [DashboardUserProvider](./CS/BlazorAuth/Code/DashboardUserProvider.cs) service obtains the current user name from the `AuthenticationStateProvider`. The [MultiTenantDashboardConfigurator](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) class and each custom storage and provider obtain the user name from this service. +The [DashboardUserProvider](./CS/BlazorAuth/Code/DashboardUserProvider.cs) service obtains the current user name from the `AuthenticationStateProvider` ([RevalidatingIdentityAuthenticationStateProvider.cs](./CS/BlazorAuth/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs)). The [MultiTenantDashboardConfigurator](./CS/BlazorAuth/Code/MultiTenantDashboardConfigurator.cs) class and each custom storage and provider obtain the user name from this service. In [Dashboard.razor](./CS/BlazorAuth/Pages/Dashboard.razor), the `OnInitializedAsync` method specifies the working mode based on the user name. @@ -54,10 +54,8 @@ When the application starts, you see the [Index](./CS/BlazorAuth/Pages/Index.raz | Guest | dashboard1_guest | - | - | - | ViewerOnly | - | | Unauthorized | - | - | - | - | ViewerOnly | - | - ## Implementation Details - ### Dashboards Custom dashboard storage allows you to specify which dashboards the user can access, edit, and save.