License Usage Summary
Duende.IdentityServer.Licensing.LicenseUsageSummary
Section titled “Duende.IdentityServer.Licensing.LicenseUsageSummary”Added in 7.1
The LicenseUsageSummary class allows developers to get a
detailed summary of clients, issuers, and features used
during the lifetime of an active .NET application for self-auditing
purposes.
-
LicenseEditionIndicates the current IdentityServer instance’s license edition.
-
ClientsUsedA
stringcollection of clients used with the current IdentityServer instance. -
IssuersUsedA
stringcollection of issuers used with the current IdentityServer instance. -
FeaturesUsedA
stringcollection of features has been used since the IdentityServer instance ran.
Register LicenseUsageSummary Services
Section titled “Register LicenseUsageSummary Services”To make the LicenseUsageSummary class available in your application, you’ll need to make sure it is registered in the service collection at startup.
You can do this by calling the AddLicenseSummary() extension method when registering IdentityServer:
builder.Services.AddIdentityServer() .AddLicenseSummary();Using LicenseUsageSummary with .NET Lifetime Events
Section titled “Using LicenseUsageSummary with .NET Lifetime Events”In .NET, an IHost
implementation allows developers to subscribe to application
lifetime events, including Application Started, Application Stopped,
and Application Stopping. IdentityServer tracks usage metrics internally
and that information may be accessed by developers at any time during the application’s lifetime
from the application’s service collection using the following code snippet.
// from a valid services scopeapp.Services.GetRequiredService<LicenseUsageSummary>();For self-auditing purposes, we recommend using the IHost lifetime event ApplicationStopping as shown
in the example below.
Note, LicenseUsageSummary is read-only.
app.Lifetime.ApplicationStopping.Register(() =>{ var usage = app.Services.GetRequiredService<LicenseUsageSummary>(); // Todo: Substitue a different logging mechanism Console.Write(Summary(usage));});Developers may also use common dependency injection techniques such as property or constructor injection.
// An ASP.NET Core MVC Controllerpublic class MyController : Controller{ public MyController(LicenseUsageSummary summary) { // use the summary information }}Developers can use the license usage summary to determine if their organization is within their current licensing tier or if they need to make adjustments to stay within compliance of Duende licensing terms.