Server
Seal Report includes a Web Report Server to publish your reports on the Web.
On Windows OS, the server must have Internet Information Server (IIS) installed with the current ASP.Net Core Runtime (Hosting Bundle).
On Linux OS, the server must have ASP .NET Core installed (Refer to https://docs.microsoft.com/en-us/dotnet/core/install/).
Note that the Web Report Server may also act as a Report Scheduler if necessary.
Web Report Server Publication Wizard (IIS)
To publish the Web Report Server, run the Server Manager and select the menuIf the site was previously published, use the button Publish only files to update the current site.
Web Report Server Publication on Linux or Azure
Server Configuration
Use the
The server configuration has various properties (Format properties.
Server Scripts
Configure theAudit Script to log the following events in a database: Login, Logout, Report Execution.Dedicated audit Data Sources and reports are provided and may be adapted to query your audit database.
Use the
Report Creation Script to change the default report object when it is created (Report Execution Init Script to modify the report before the execution (The
Schedule Check Script limits the schedules (Feedbacks on the reports
If the optionalReport Feedback Script of the server configuration (category Scripts) is defined, the Web Report Server shows a Feedback button at the bottom left of the reports: any user, guests included, may tell that a value seems wrong (with the expected value and its source), that a presentation is missing or that something is hard to understand.
The script receives a ReportFeedback holding the values typed and the context set by the server from the execution: report path and name, restrictions having a value, number of rows, user (User.IsGuest), culture, IP address and browser.
It also holds the versions of what was commented: ReportModification (date of the report file), ReportHash (hash of its content, unchanged by a copy or a deployment) and ApplicationVersion (version of Seal Report with its build, the git commit of the sources, feedback.Refusal to refuse it (feedback.Reply to change the message shown.The server limits the feedbacks to 10 per session and per hour, truncates the texts and ignores the forms filled by robots. Each feedback is audited (event type
ReportFeedback, kind and element commented in the detail) without the text typed.
The button can be hidden for a report with the parameter Display: Show Feedback button of its root view.The AI tool
feedback_send sends a feedback to the same script from the chat of an AI agent or from a client of the MCP server, at the request of the user: feedback.Origin is then AI or MCP, the report is loaded but not executed, and it is optional for a proposal of a new report or of missing data (feedback.Kind Proposal). The tool is limited to 10 feedbacks per user and per hour.
Server source code and dynamic assemblies
Share source code amongst your report scripts by saving .cs files in the repository folder Assemblies\Dynamics.The file will be compiled into a .dll assembly that will be loaded automatically.
In the Server Manager, the Check Syntax (F8) of the editor compiles the file exactly as it is done at startup: errors are located at their line and column (
Sample of .cs source code:
using Seal;
using Seal.Model;
namespace MyNamespace
{
public class MyClass
{
public static int MyInt = 2;
public static void MyMethod(Report report)
{
string message = "this is a test";
System.Diagnostics.Debugger.Break(); //To use debugger in Visual Studio
report.LogMessage(message);
}
}
}
Server is local (No internet) property equals true if your server has no access to the internet.In this case all the Java Scripts and CSS files used in the report result will be loaded from the server.
Colors of the web site
The colors of the Web Report Server (banner, folder tree and primary buttons) are defined in the file wwwroot\css\site-colors.css of the web site. The file is referenced by theWeb CSS Files property and loaded after the Seal Report stylesheets, thus its rules override the default ones.Edit the colors to adapt the site to your corporate identity: no restart is needed, just reload the page. An existing site-colors.css is never overwritten by the setup or by the Web Server publication.
The PowerShell script site-colors-gen.ps1 installed in the Core folder generates the whole file from a single primary color:
powershell -ExecutionPolicy Bypass -File "C:\Program Files\Seal Report\Core\site-colors-gen.ps1" -Primary "#908A85" -Out "C:\inetpub\wwwroot\Seal Report\wwwroot\css\site-colors.css"
Session cookie and several instances on the same web site
The session cookie is scoped to the application: its path and its name are built from the application path of each request (Several instances published as sub-applications of the same web site (
Set the
SessionCookiePath property in the appsettings.json file only if the path seen by the browser differs from the application path (ASP Session Storage (Pull Request 46)
Session management options
- In memory - stored individually in memory not shared between nodes (default)
- In SQL Server - the ASP.NET Core session is stored in database, in one table.
ip_hash or a cookie-based affinity): all the requests of a user must reach the same node.
The SQL Server option shares only the ASP.NET Core session (the identifier of the Seal session). The Seal session itself (logged user, repository, navigation, report executions and their results) is kept in the memory of the node that created it and is never shared:
without session affinity, a request routed to another node finds no logged user. If a node stops, its users have to log in again.
"SealConfiguration": {
"SessionProvider": {
"SqlServer": {
"ConnectionString": "Server=localhost;Database=Audit;Trusted_Connection=True;TrustServerCertificate=True;",
"SchemaName": "dbo",
"TableName": "CacheSessions"
}
}
}
SQL Server session storage
dotnet tool install --global dotnet-sql-cache
Usage: dotnet sql-cache create [arguments] [options]
Arguments:
[connectionString] The connection string to connect to the database.
[schemaName] Name of the table schema.
[tableName] Name of the table to be created.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].CacheSessions(
[Id] [nvarchar](449) NOT NULL,
[Value] [varbinary](max) NOT NULL,
[ExpiresAtTime] [datetimeoffset](7) NOT NULL,
[SlidingExpirationInSeconds] [bigint] NULL,
[AbsoluteExpiration] [datetimeoffset](7) NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF,
ALLOW_ROW_LOCKS = ON,
ALLOW_PAGE_LOCKS = ON,
OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Server Tools
The Server Manager has also
- Check Data Sources checks the current Data Source amongst the database (tables, joins and enumerated lists).
- Refresh Enumerated Lists updates all the values of dynamic enumerated lists. The Data Source must then be saved.
- Synchronize Report Schedules checks all the schedule of the reports in the repository and synchronize them in the Windows Task Scheduler. The schedule is defined with SYSTEM user.
- Synchronize Report Schedules with the logged user performs the same but the schedule is defined with the user running the Server Manager.
System Reports
Several useful reports are available in the Reports/System Repository sub-folder to show the current security implementation, to inventory the reports, to check the reports executions, to query the audit database, etc.System: 100 Configuration - Security Summary System: 200 Audit - Search System: 300 Reports - Inventory
Web Security
Use the
The Web Security defines the login process to the Web Report Server through Security Provider and all the user rights through the Security Groups.
Security Provider
The Security Provider defines how the authentication is done when a user wants to login.
All the default Security Providers are defined in *.cshtml files in the /Security/Providers Repository sub-folder.
A Security Script is executed to define the name and the groups of the user. If the user has no group, the authentication has failed.
Depending on his type, a security provider may have parameters (
Check the
Security Script to have more information.
- Basic Authentication shows a simple user/password authentication from the user name and password of the login window.
- Basic Windows Authentication use Windows authentication to validate the user name and password, and define the groups: Windows group names must match group names defined in the security.
- Database Authentication shows a sample of querying the database to authenticate and get the groups.
- Integrated Windows Authentication is the same as Basic Windows Authentication but relies on the integrated authentication provided by IIS.
- LDAP Authentication shows a sample of using the LdapConnection object to authenticate and get the groups.
- JWT shows how to authenticate a user having a JSON Web Token (JWT) generated by another server sharing a secret key.
- OpenID shows the use of the OpenID authentication.
- No Security just adds a security group to the user.
Three optional features can be enabled in the security configuration (they are disabled by default):
-
Two-Factor Authentication (
Enable Two-Factor Authentication): requires two scripts, oneGeneration Scriptto generate the code sent by Email or SMS, oneCheck Scriptto validate the code. -
Reset Password (
Enable Reset Password): requires two scripts, one to initiate the reset (e.g. send an email with a reset link), one to apply the new password. -
Change Password (
Enable Change Password): allows users having a login defined in the security file to change their password. An optionalChange Password Scriptmay be defined to customize the behavior.
Set the option Hide login user name and password to true to hide the user name and password fields in the login page (
@{
SecurityUser user = Model;
//Basic authentication script: use the user name and password to authenticate the user and set his name and security groups...
//user.WebUserName -> user name from the login screen
//user.WebPassword -> password from the login screen
user.Name = user.WebUserName; //Display name
if (string.IsNullOrEmpty(user.WebUserName)) {
user.AddDefaultSecurityGroup();
}
else if (user.WebUserName == "userName" && user.WebPassword == "password")
{
user.AddSecurityGroup("aGroupName");
}
else {
//Authenticate and set the groups defined in the security login
if (!user.LoginAuthentication(user.WebUserName, user.WebPassword)) {
throw new Exception("Invalid user name or password");
}
}
}
Besides the display name and the security groups, the script may set the personal folder name (user.PersonalFolderName) and the business context of the user in user.Properties, a dictionary of key/value strings (user.GetProperty("key") (Report.SecurityContext, report or AI tool scripts
A script may also add to user.SecurityGroups a SecurityGroup built in memory (folders and rights, personal folder, data sources): rights defined per customer or per user can then come from a database instead of the security file.
Authentication from the user name only
The server itself executes the Security Provider for a user who is not in front of the login page:user.ForSchedule is then true, user.WebUserName contains the user name and there is no password, no HTTP request (user.Request and user.WebPrincipal are null) and no Two-Factor Authentication.
This is the case for:
- every request of the MCP server of the AI Agents, with a personal access token or an OAuth access token: the user is loaded again at each request, so a change of his groups, or a user removed from the directory, applies immediately,
- the Web Schedules executed by the Seal Report Scheduler,
- the scheduled outputs having a
User nameifExecute the provider for scheduled outputsis set.
if (user.ForSchedule):
- Basic Authentication:
user.LoginAuthentication()does not check the password ifuser.ForScheduleis true. - Basic Windows Authentication and Integrated Windows Authentication: the user and his groups are read from the Active Directory (
Groups matching: Method used to get the Windows groups, Domain if empty), the account of the server must be allowed to read the directory. - LDAP Authentication: the user is searched with the Service account parameters (user name and password, or the account of the server if empty, search base and user filter).
- Database Authentication: the user is checked by the
Service user queryexecuted with theService connection string. - JWT, OpenID and Claims Principal: the token or the claims are not available, the user is loaded from the logins of the security (
user.LoginAuthentication()); change the script to load him from another source (e.g. a database ). - No Security: the users have no name, the MCP access tokens and the web schedules are not available.
user.WebUserName with a stable identifier (Test your security provider
Once your Security Provider is configured, use the helperTest a login to fully test a login process with given name and password.
Security Group
After a successful authentication process, the user belongs to one or several Security Groups.
A Security Group allows to configure:
- which repository folders are published for the user,
- if the user can view reports,
- if the user has personal folders,
- if a Startup report is executed at login,
A Security Group has a collection of repository Folders, each folder has a given relative path and right (from No Right to Edit Reports).
Consistency check
When the security is saved, the Server Manager checks each group and shows the warnings before saving (SealSecurity.CheckConsistency()):
- an AI Agent assigned whose tools will be refused: an agent editing the Data Sources (
e.g. Data Source Manager ) without the right Read and write on the repository folder\Sourcesor without the Metadata and SQL level, an agent writing reports (e.g. Schedule & Output ) without a report folder having the right Edit or a personal folder for reports, a skill creating reports from SQL with the Metadata only level. Only the agents dedicated to the task are checked: an optional skill of an agent (e.g. 'manage-data-source' for the Report Designer ) is simply refused without the right; - an agent, a data source or an output device that does not exist;
- a sensitive repository folder published (
\Security,\Settings,\SpecialFolderswhich contains the personal folders of all the users, or the root), or a repository folder in the Reports folder (ignored); - the provider No Security with the MCP server or the Seal Report Scheduler: the users have no user name, so the MCP access tokens and the web schedules are not available;
- a sub-report folder that does not exist in the
\SubReportsfolder, or the root of the sub-reports declared (all the sub-reports are then protected).
The checks are done per group: a right given by another group of the user is not considered.
The AI tool security_check (skill audit-security-and-activity, agent System Admin) returns the same warnings with the effective security of the current user, to explain why an agent or a tool is refused. It checks the groups of the user, or all the groups if the user can execute the System reports.
Sub-report folders
The sub-reports of the repository folder \SubReports are not published in the folders: they are executed from the navigation links of the reports (\Reports folder requires a right on its folder, and a report of a personal folder must be in the personal folder of the user.
By default, a sub-report can be executed by all the users from the reports they can execute. The Sub-report folders of a Security Group restrict the sub-reports of a folder (path relative to \SubReports) to some groups:
- a folder is protected once a group declares it: only the users of a group having the right
Executeon the folder can then execute its sub-reports, the folders declared by no group stay free; Include sub-foldersapplies the definition to the sub-folders, the most specific folder declared by a group wins;Executeset to false protects a folder without giving the right (e.g. to exclude );\HR\Salaryfrom the group having the right on\HR- the rights of the groups of the user are added.
The navigation links to a sub-report that the user cannot execute are not displayed in the report result.
\SubReports\HR and add the sub-report folder \HR to the group HR: the other users do not see the link and cannot execute it.
The System report 100 Configuration - Security Summary lists the sub-report folders of the groups (prefix [SubReports]) in the tab Folders.
Rights on the data
The rights on the sub-reports control who can open them, not the rows they return: when the data must be filtered per user, the filter must be done in the Data Source (Report.SecurityContextDownload and Upload rights
In addition to its right, each folder has two flags, both disabled by default:
Allow Report Download: the user can download the report files (*.srex) of the folder from the Web Report Server. Downloading a report is the only way to extract its definition from the web (e.g. to edit it with the Report Designer ).Allow Upload: the user can upload files to the folder.
The same two flags exist on the Security Group for the user's Personal folder.
Report code level
Web users and AI Agents can save reports (upload, AI tools). The Report code level of the Security Group defines the code they can write in a report:
Metadata only(default): elements, restrictions, views and outputs built from the Data Source metadata, no SQL and no script.Metadata and SQL: also custom SQL of elements and restrictions, SQL models, enumerated lists (except the lists of the values of a column generated by the AI tools) and joins defined in the report, restriction expressions other than[restriction] AND/OR/NOT, and the raw SQL queries of the AI tools (database_*,report_create_from_sql). Dynamic filters set for security purpose are not applied to raw SQL.Metadata, SQL and scripts: also Razor scripts (cell scripts, model and task scripts, custom templates, Pre/Post SQL...), connections, tasks and table templates (with their parameters) defined in the report, and code rendered in the browser. Any text starting with@is a Razor script.
The level of a user is the highest level of his groups. It replaces the former SQL models option: a group saved with this option enabled is read as Metadata and SQL.
For an AI tool, the level applied is the lowest between the level of the user and the Maximum report code level of the AI Agent (
Code rendered in the browser is also checked below the Scripts level:
- The view parameters rendered without encoding by their view template (
e.g. the colors, sizes or CSS of a chart, the additional JavaScript of the report , detected from the@Raw()calls of the template and its partial templates, or declared withCodeLevelin the template configuration): a value must be one of the values proposed by the template, a plain value without quote, parenthesis, brace, angle bracket, equal sign, ampersand or backslash, or a value of the type expected by the parameter:- colors (
chartjs_colors,echarts_colors,plotly_colors...): a list of CSS color names,#hex,rgb(),rgba(),hsl()orhsla()with numeric arguments (e.g. ['#1f77b4','green'] ); - color mappings (
chartjs_color_mappings,plotly_color_mappings): label and color pairs, the labels quoted without quote, backslash, angle bracket or new line (e.g. 'ok':'green','ko':'red' ); the colors and the mappings are saved in a canonical form; - CSS (
*_css,additional_css): declarationsproperty: value;withouturl(,expression(,@import, angle bracket, brace, double quote or backslash; CSS classes (*_class): class names; - HTML summaries (
model_summary,report_summary,restrictions_header,restrictions_footer): no active content, as for the Guide; widget_exec_report: the path of an existing report of the Reports or the Personal folder that the user can execute.
additional_js, requires the Scripts level. - colors (
- The HTML texts (report
Guide, email body): no active content (script, frame, embedded object, event handler or script URL).
The AI tools managing the Data Sources (datasource_*) require the Metadata and SQL level, and a text starting with @ in their arguments (table SQL, column SQL, join clause, names...) requires Metadata, SQL and scripts: it would be compiled as a Razor script each time the source is used.
An uploaded report, or a file renamed or copied as a report, is checked as a new report. A report copied or moved on the server keeps its content. Each refusal is written in the audit (type
ReportCodeRefused).The Report Designer and the Server Manager are not checked, and the files uploaded to the Repository Folders (Danger Zone) are outside of this check.
For the Reports folders
- Folders: The highest right is used (No right, Execute reports / View files, Execute reports and outputs / View files, Edit schedules / View files, Edit reports / Manage files).
- Allow Report Download, Allow Upload: Enabled if one group enables it.
- Personal folder: The highest right is used (No personal folder, Personal folder for files only, Personal folder for reports and files).
- Show empty parent folders: True if one group has this flag set to true.
- Folders, Folder Detail and Menu Scripts are executed sequentially sorted by group name.
-
The options (Edit Profile, Culture, Logo, Startup, Execution mode) are taken from the group having the highest
Weight.
A Meta Column may have a Security tag property. This text can be used to define rights for the designers.
List the current right definitions
The System Report '100 Configuration - Security Summary' generates also a full security summary.To display rights per user, it may be adapted to match the security provider used.
System: 100 Configuration - Security Summary
Repository Folders
A Security Group can also publish Repository Folders: folders located anywhere under the repository root, outside the Reports tree (
Each Repository Folder is defined with a relative path, a right (No right, Read only to view and download files, Read write to manage files) and an Allow Upload flag.
Custom Publications
In addition to the security applied on report folders, dedicated scripts (properties of a Security Group) allow to modify the reports published to the logged user.
-
Folder Script: Optional script executed to define/modify the folders published in the Web Report Server. -
Folder Detail Script: Optional script executed to define/modify the reports published in the Web Report Server for a given folder. -
Menu Script: Optional script executed to define/modify the reports of the logged user.
If the user belongs to several groups, scripts are executed sequentially sorted by group name.
Folder Detail Script sample to filter 'Charts' reports in the /Samples folder:
@{
SecurityUser user = Model;
if (user.FolderDetail.folder.path == @"\Samples") {
//Sample to filter reports
user.FolderDetail.files = user.FolderDetail.files.Where(i => i.name.Contains("Charts")).ToList();
}
}
Startup Report
Once logged with the Web Report Server, a startup report defined in the Report executed on startup property of a Security Group can be executed automatically.
This allows to fully customize the login page for given users.
Check the following sample Startup Reports
- 40-Startup Report: Defines a Welcome page with several options to execute reports and to browse specific folders.
- 41-Startup Folder: Forces a specific folder after the login and disable most of navigation and execution links.
Seal Web Interface
Once installed, the Web Report Server offers a simple interface to ease the integration of Seal Report into existing web sites.
Contribute to Seal Report
Give a Star!
You like Seal Report? The simplest contribution takes one click: star the project on GitHub to increase its visibility and help the community grow.Enhance the documentation and samples
Want to share your experience or to add a new topic ? Something is not clear in the documentation ? Do you have an interesting recipe ?As the site for the documentation is part of the solution, you are welcome to Pull a Request at GitHub.
Sponsor the project
If you are using Seal Report in a business application, please consider to sponsor the product to ensure its maintenance, quality and independence.Please check Support and Sponsor.
And more...
You are also welcome to help us in several different areas:- Beta testing.
- Libraries of Data Sources and Reports on standard databases.
- Additional View templates.
- New features development.