Class XapiLrsOptions
Options for the LRS added with AddXapiLrs.
public sealed class XapiLrsOptions
- Inheritance
-
XapiLrsOptions
- Inherited Members
Remarks
The options can be bound from a configuration section, such as Lrs in appsettings.json, with
the AddXapiLrs overload that takes an IConfiguration
or with Configure<XapiLrsOptions>(section). Setters do not check values; the options are
validated when the host starts, and invalid ones stop it with an
OptionsValidationException that lists every problem.
Properties
AuthenticationScheme
An ASP.NET Core authentication scheme to authenticate requests with instead of the built-in Basic
credentials, for example "Bearer". Scopes are read from ScopeClaimType claims and
the authority comes from AuthorityFactory.
public string? AuthenticationScheme { get; set; }
Property Value
AuthorityFactory
Maps a principal authenticated with AuthenticationScheme to the authority put on the statements it stores. When null, an Agent with an account on AuthorityHomePage named after the principal's name identifier is used.
public Func<ClaimsPrincipal, Agent>? AuthorityFactory { get; set; }
Property Value
AuthorityHomePage
The homePage of the account in generated authorities. Set it to a URL you control, such as the
LRS's own address, before storing statements you intend to keep: authorities are stored with each
statement and are not rewritten later. Must be absolute.
public Uri AuthorityHomePage { get; set; }
Property Value
Remarks
The text the URI was created from is used as is, without the normalization of AbsoluteUri.
Credentials
The credentials accepted with HTTP Basic authentication. Ignored when AuthenticationScheme is set.
public XapiLrsCredentialList Credentials { get; }
Property Value
Remarks
In configuration, each credential has a Key, a Secret and a Scopes array of xAPI scope
names, for example Lrs:Credentials:0:Key, Lrs:Credentials:0:Secret and
Lrs:Credentials:0:Scopes:0. Startup fails when a key is missing, empty, contains a colon or appears
twice, when a secret is missing or empty, or when a credential has no scope or an unknown one. The messages
name the credential by its index and key, never by its secret.
EnableVersion1_0_3
Whether requests with an X-Experience-API-Version header of 1.0.x are accepted and
handled with xAPI 1.0.3 rules. When false, only 2.0 requests are accepted.
public bool EnableVersion1_0_3 { get; set; }
Property Value
MaxAlternateRequestBytes
The largest form body of an xAPI 1.0.3 Alternate Request Syntax request (a POST with a method
query parameter), in bytes, counting every URL-encoded field. Larger requests get 413. Defaults to 1 MiB,
and must be at least 1.
public long MaxAlternateRequestBytes { get; set; }
Property Value
Remarks
The LRS reads this form before it authenticates the request, because the credentials can be one of its fields. This limit, rather than MaxStatementBytes or the server's request body limit, is what an unauthenticated client can make the LRS read and hold in memory. The statements or document in the form must also fit MaxStatementBytes or MaxDocumentBytes.
MaxAttachmentBytes
The most attachment data accepted in one multipart/mixed statement request, in bytes, counting
every attachment part; larger requests get 413 (IEEE 9274.1.1, 4.1.5). Defaults to 50 MiB, and must not
be negative. The server's request body limit of a multipart/mixed statement request is set to this
value plus MaxStatementBytes and a fixed 1 MiB for part headers and boundaries.
public long MaxAttachmentBytes { get; set; }
Property Value
MaxDocumentBytes
The largest State, Activity Profile or Agent Profile document accepted, in bytes; larger ones get 413
(IEEE 9274.1.1, 4.1.5). Applies to the document stored after a POST merge as well. Defaults to 1 MiB, and
must be at least 1. The server's request body limit (MaxRequestBodySize) of document writes is set
to this value, so it replaces Kestrel's default of about 28.6 MiB on those requests.
public long MaxDocumentBytes { get; set; }
Property Value
MaxStatementBytes
The most statement JSON accepted in one statement PUT or POST, in bytes: the whole body of an
application/json request, or the first part of a multipart/mixed one. A batch counts as a
whole. Larger requests get 413 (IEEE 9274.1.1, 4.1.5). Defaults to 16 MiB, and
must be at least 1.
public long MaxStatementBytes { get; set; }
Property Value
Remarks
The server's request body limit (MaxRequestBodySize) of statement writes is set from this value
and MaxAttachmentBytes, so these options replace Kestrel's default of about 28.6 MiB on
those requests. Servers without a per-request limit, and requests whose body was already read by other
middleware, keep the server's own limit; the LRS still enforces these options while reading.
MaxStatementsPerBatch
The most statements accepted in one statement POST; larger batches get 413 (IEEE 9274.1.1, 4.1.5) before they are parsed. Defaults to 1,000, and must be at least 1.
public int MaxStatementsPerBatch { get; set; }
Property Value
Remarks
A batch is parsed in memory and stored in one transaction, so this bounds what one request costs whatever its byte size: parsing takes about 20 times the JSON's size, and on SQLite every other write waits until the batch is stored. A batch of 1,000 statements of 1 KB takes about 20 MB to parse and 0.3 to 0.5 seconds to store (docs/benchmarks.md). Clients that send larger batches must split them.
MaxStatementsPerPage
The most statements one page of a statement query returns, and the page size when the request asks for
limit=0 or gives no limit. Larger limits are lowered to it. Defaults to 100, and
must be at least 1.
public int MaxStatementsPerPage { get; set; }
Property Value
MigrateOnStartup
Whether the database migrations are applied when the host starts. Off by default, so production
deployments can migrate as a separate step with MigrateXapiLrsDatabaseAsync.
public bool MigrateOnStartup { get; set; }
Property Value
ScopeClaimType
The claim type that carries scopes for AuthenticationScheme, as space-separated xAPI scope
names such as statements/write statements/read. Defaults to scope.
public string ScopeClaimType { get; set; }