-
Notifications
You must be signed in to change notification settings - Fork 4
Admin dashboard
Here we assume that a working instance of MongODM on Asp.NET Core has already been configured. If not, you can start with this guide: Startup configuration.
Administration dashbord is contained into the external optional package MongODM.AspNetCore.UI
. You can install it with Package Manager Console or with your preferred project editor:
PM> Install-Package MongODM.AspNetCore.UI
After have added the package we have to configure the dashboard registering components and options. On method ConfigureServices(IServiceCollection services)
add this line of code:
services.AddMongODMAdminDashboard();
This method can also optionally take parameters, let see them next.
Last thing to be sure is that Asp.NET Core Authorization middleware is enabled. MongODM administration dashboard uses it for provide authorized access control. Verify that this line of code is reported in Configure(IApplicationBuilder app)
method after the invoke app.UseRouting()
:
app.UseAuthorization();
The method services.AddMongODMAdminDashboard()
can take an optional configuration:
public class DashboardOptions
{
public IEnumerable<IDashboardAuthFilter> AuthFilters { get; set; }
public string BasePath { get; set; }
}
-
IEnumerable<IDashboardAuthFilter> AuthFilters
This describe a list of authorization filters that have to be all satisfacted for permit user to access to dashboard pages. By default is setted only a filter that accept connections by localhost, but anyIDashboardAuthFilter
custom implementation can be provided -
string BasePath
It defines the base path for reach the dashboard pages, so for example if its value is "admin/dash", the dashboard Index page will be reachable at addresshttps://<mysite.com>/admin/dash
. By default its value is"MongODM"
The interface IDashboardAuthFilter
describes an authorization filter for Dashboard UI. It exposes only an async method Task<bool> AuthorizeAsync(HttpContext context)
that receive an HttpContext
of current request, and return true
for authorization accepted, false
otherwise.
Any provided filter during configuration has to be satisfacted for authorize user to access to the dashboard pages.
- Every registered db context is showed separately
- Can start migration for any database context