Blazor WebAPI Appsettings
Regarding "AmtCookieEncryptionKey" |
---|
It is necessary for the "AmtCookieEncryptionKey" key to be the same as the other cookie encryption keys in your AMT environment, also found in the Control Center and Application Center appsettings.json files. |
This page lists all settings found in the appsettings.json file for the ClientBlazor WebAPI. This file is located in the following directory: ..\<AMT root>\Apps\<Application>\ClientBlazor\WebApi\.
Note: the appsettings.json file name is case sensitive and must be lowercased. |
The appsettings file is (sub-)divided into the following sections.
Section | Description |
Amt | The main section where most settings are located. |
BlazorAPI | Section with settings to connect to an app server/manager or transaction server. |
Logging | Section for the logging settings for the Web Application. |
AllowedHosts | Solo settings which restricts the hosts which may access the Web Application. |
AmtCookieEncryptionKey
This setting is explained in Generating Keys.
ApplicationName
The name of the Web Application. Normally there is no need to change the default value.
AuthenticationType
The authentication type used to validate tokens received from the Blazor WebClients, the only valid option is "JWT" (JSON Web Token).
JWT
The 'JWT' section contains settings needed to validate tokens received from Blazor WebClients.
- Authority - The URL of the authorization server.
- Audience - The configured intended recipient of the access token.
- 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 WebClients 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.
"Authority": "https://login.example.org/amt-applications/v2/auth",
"Audience": "amt-blazor-webapi",
"TokenValidationParameters": {
"NameClaimType": "preferred_username"
},
"RequireHttpsMetadata": true
}
ConnectionType
The type of AMT service to which the Blazor WebAPI should connect.
For AMT Lion applications this should be
set to either "AppServer" or to "AppManager" if an application manager is
used.
In the case of an AMT Cobol application, the type should be "TransactionServer".
Finally AMT for CSharp
applications should set the type to "VsWebApi".
ConnectionAddress
The address of the AMT service to which the Blazor WebAPI should connect.
The syntax depends on the ConnectionType settings (see above).
ConnectionType: | Syntax: | Description: |
AppServer / AppManager |
"<host>" | Replace <host> with the address of the application manager/server. If not set, machine name will be used. |
TransactionServer | "GRPC:<address>:<port>" | Replace <address> and <port> with the Transaction Server settings as set in the Control Center. |
VsWebApi | "<address>/api/" | Replace <address> with the Business Logic web address of the application as set in the Control Center. |
ConnectionPort
The port of the AMT service to which the Blazor WebAPI should connect.
Only required when a
AppServer or AppManager is used as ConnectionType, i.e. AMT Lion
applications.
EnableLogging
When enabled, the WebAPI will log debug information / exceptions to logs located in the folder .\App_Data\Logs\<date> inside the WebApi folder.
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).