Blazor WebClient Server Appsettings
This page lists all settings found in the appsettings.json file for the Blazor WebClient Server.
ClientBlazor WebClient Server
The appsettings.json file is located in the following directory: ..\<AMT root>\Apps\<Application>\ClientBlazor\WebClient\Server\.
Note: the appsettings.json file name is case sensitive and must be lowercased. |
Settings
The appsettings file is (sub-)divided into the following sections.
Section | Description |
Amt | The main section where most settings are located. |
Logging | Section for the logging settings for the Web Application. |
AllowedHosts | Solo settings which restricts the hosts which may access the Web Application. |
RuntimeBehaviour
Sets the runtime behaviour to either Lion, Cobol or Natural.
For AMT Lion applications this should be set to Lion.
HttpRequestTimeout
The HTTP request timeout in seconds.
KeepAliveInterval
The number of seconds between keepalive calls to the client, the default value is 60.
MaxRequestLength
By default the maximum size of data uploaded to the AMT Blazor WebClient is limited to 10240 kilobytes (10
megabytes) per HTTP request.
To increase the upload size, for instance to allow for larger files to be uploaded
via the File uploader control, the MaxRequestLength setting can be increased.
Note
that this setting limits the whole HTTP request, not just the file(s) to be uploaded, meaning that the limit should
be set higher than the maximum intended file size.
This setting controls the upload limit in kilobytes, it is a 32 bit integer which limits the setting to a maximum value of 2147483647.
Theme
Theme: The name of the folder located in
wwwroot\app_themes which contains custom theme CSS files that will be used for the styling of the Web
Application.
NoDefaultTheme: When set to true, the default CSS files will not be loaded. Default is false.
The default CSS files will loaded before the custom theme
(unless NoDefaultTheme is set to True). If Theme is set to a value, this custom theme will be loaded as separate CSS files which will override the default CSS styling. |
"NoDefaultTheme": false,
Creating a Custom Application Theme in a Blazor WebClient
It is advised to not make changes in the default theme but to create a custom theme.
To do this first create a new folder named app_themes below the wwwroot folder of the Blazor WebClient.
Next navigate to the
folder ClientBlazor\WebClient\Server\wwwroot\_content\Asysco.Amt.Blazor.Components\app_themes of
your application and copy the folder default (of the default theme) and its complete contents
to a new folder below the previously created app_themes folder. Give this folder a name of
your choice (e.g. MyTheme).
Now navigate back to the folder of the Blazor WebClient of your application and open the file appsettings.json in a
text editor. In this file look for the Amt section located at the top:
"Amt": {
...
},
In this section look if the following entry exists, if not add it to
the top of the Amt section:
"Theme":
"",
Now enter the name of the new theme folder you just created. Following the
given example:
"Theme":
"MyTheme",
Save the appsettings.json file and either recycle the AppPool of the
Blazor WebClient or restart IIS. When the WebClient is now started the new theme will be used, but no
changes will be visible yet.
HideMainMenu
When set to true, the Menu bar at the top of the application will be hidden. (AMT Lion only)
IsVSApplication
If an application is an AMT for CSharp application (Visual Studio) that uses static webpages, this setting should be set to true.
LoadAndRun
The LoadAndRun JavaScript script is a customer specific customization created during migration which can modify the values to and from an AMT web client form by hooking into a form at certain loading stages on runtime. The LoadAndRun script can be enabled with these settings.
ObjectFields: The names of the object fields which must be present in the form for the LoadAndRun script to hook into.
LoadAndRun: Setting the value to "true" will enable the LoadAndRun script for the application.
LoadAndRunJs: The name and location of the script relative to the wwwroot\scripts folder of the web client.
"LoadAndRun": true,
"LoadAndRunJs": "loadandrun",
Customize
If a client specific customize JavaScript script was created for an application during migration, it can be enabled with these settings.
LoadCustomize: Setting the value to "true" will enable the customize script for the application.
CustomizeJs: The name and location of the script relative to the wwwroot\scripts folder of the web client.
"CustomizeJs": "customize",
AdditionalErrorDetails
When set to true, the AmtExceptionPage provides additional error information.
Additional Javascripts
These options can be set if additional javascript files are required in the Web Client.
LoadAdditionalJavascripts: Setting the value to "true" will activate the javascript files set in the
AdditionalJavascripts setting.
AdditionalJavascripts: The location of the scripts relative to the wwwroot\scripts folder of
the web client, multiple scripts can be entered if separated by a semicolon (;). The .js file extension should not be included.
"AdditionalJavascripts": "Javascript1;Javascript2",
UseNotifyBar
UseNotifyBar enables or disables a notification bar in the web client.
When messages are send to the station of a user, a notification bar will appear to display the message and disappear after a set time. The default value is true.
With NotifyBarTime the default visibility duration of the bar can be changed by setting a time in seconds, the default value is 120 seconds (2 minutes).
Alternatively the notification bar can be closed manually by clicking the close button on the bar.
"NotifyBarTime": 120
BlazorWebApi
Settings needed to communicate with the Blazor WebAPI.
Protocol: The protocol to be used for the Blazor WebAPI, either Https or Http.
Domain: This setting should contain the URL of the Blazor WebApi website without the protocol prefix.
Port: Set to 0 for normal operations. Other values are used for debugging.
The port setting is used when debugging Blazor locally without IIS. Set to 0 when hosted on IIS.
"Protocol": "Https",
"Domain": "<domain>[:port]/<path>",
"Port": 0,
},
AuthenticationType
The authentication type used to log into the Blazor WebClient, the only valid option is "OIDC" (OpenID Connect).
AmtOIDC - OIDC
This section holds the settings for OpenID Connect authentication.
- ClientId - The client ID of the application.
- Authority - The OIDC authority URL
- Scope - The scopes to request from the authorization server to allow access tokens to be used to call other resource servers (e.g. CC, AC or Blazor APIs).
- ClientSecret - The client secret of the application, not applicable if client assertion is enabled.
- TokenValidationParameters:
- NameClaimType - The claim type that will be used to identify the user. Commonly preferred_username is used as claim type.
The claim type must be identical to the claim type set in the Blazor WebAPI appsettings.
- NameClaimType - The claim type that will be used to identify the user. Commonly preferred_username is used as claim type.
- RequireHttpsMetadata - If true then HTTPS is required for the authority. The default is true. This should be disabled only in development environments.
"OIDC": {
"ClientId": "amt-blazor-webclient-server",
"Authority": "https://login.example.org/amt-applications/v2/auth",
"Scope": [ "openid profile amt-blazor-webapi-scope" ],
"ClientSecret": "c8A6L7j5E3N0n9Y",
"TokenValidationParameters": {
"NameClaimType": "preferred_username"
},
"RequireHttpsMetadata": true
},
...
AmtOIDC - CookieAuthenticationOptions
The 'CookieAuthenticationOptions' section holds settings for the cookie used for user authentication.
- Name - Name of the authentication cookie that will be used to store the identity token.
- Domain - The domain of the authentication cookie.
- Path - The path of the authentication cookie.
- SameSite - SameSite policy of the authentication cookie. Should be set to None if the application is used in an iframe.
Allowed values are: Undefined the default value which does not set a SameSite field, None to disable SameSite restrictions, Lax to send the cookie with "same-site" requests and with "cross-site" top-level navigations, and Strict to only send the cookie with "same-site" requests.
...
"CookieAuthenticationOptions": {
"Cookie": {
"Name": ".Amt.Blazor.ApplicationName.Auth",
"Domain": "",
"Path": "/",
"SameSite": "None"
}
},
...
AmtOIDC
This section holds the remaining OpenID Connect options.
- DisableRefreshTokens - Set to true to disable the refresh of tokens. Defaults to false.
- RefreshThreshold - The refresh threshold in seconds if enabled. If tokens expire within the configured threshold, the tokens will be refreshed. Defaults to 60 seconds.
- EnableClientAssertion - Set to true to enable client assertion. Defaults to false. If true, a signed token will be used to authenticate users instead of a client secret.
- ClientAssertionAlgorithm - The algorithm used to sign the token to be used as client assertion. Defaults to RS256.
- CertificateConfig - This section must be set if client assertion is enabled. See CertificateConfig.
...
"DisableRefreshTokens": false,
"RefreshThreshold": 60,
"EnableClientAssertion": false,
"ClientAssertionAlgorithm": "RS256",
"CertificateConfig": {
...
AmtOIDC - CertificateConfig
Configuration options for the certificate used to sign the client assertion. This section can be left out if client assertion is disabled.
- AllowInvalid - Set to true if invalid certificates should be allowed. Defaults to false.
- Subject - The subject of the certificate.
- StoreName - The name of the store where the certificate is located. Defaults to 'MY'.
- StoreLocation - The location of the store where the certificate is located. Defaults to 'CurrentUser'.
- Path - The path to the certificate file.
- Password - The password for the certificate. Only necessary when loading the certificate from base64 or file.
...
"CertificateConfig": {
"AllowInvalid": true,
"Subject": "amt-application-cert",
"StoreName": "MY",
"StoreLocation": "LocalMachine",
"Path": "certificate.pfx"
"Password": ""
}
}
Logging
Sets the logging levels for the various ASP.NET Core components of the web application. These settings do not need be
adjusted in a normal situation.
The allowed log levels are, from most to least detailed: Trace, Debug, Information,
Warning, Error, Critical and None.
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"System.Net.Http": "Warning"
}
},
AllowedHosts
In the AllowedHosts section, access to the web application can be restricted to specific hostnames.
The
value is a semicolon-delimited list of host names without port numbers.
By default all hostnames are allowed
by the asterisk (*) wildcard.
Disallowed users will get a HTTP 400 error code (Bad Request).