License Information and Usage
Duende.IdentityServer.Licensing.LicenseInformation
Section titled “Duende.IdentityServer.Licensing.LicenseInformation”Added in 8.0
The LicenseInformation class exposes details about the configured license.
IdentityServer registers LicenseInformation as a singleton automatically. You do not need any additional setup to use it.
Properties
Section titled “Properties”CompanyName(string?): Company name from the license.ContactInfo(string?): Contact information from the license.SerialNumber(int?): Serial number of the license.IssuedAt(DateTimeOffset?): Date and time when the license was issued.Expiration(DateTimeOffset?): Date and time when the license expires.IsConfigured(bool):trueif a license was loaded and parsed successfully. Use this to check whether a license is present before displaying license details.EntitledSkus(IReadOnlyCollection<string>): SKU identifiers entitled by the license.
Inject LicenseInformation
Section titled “Inject LicenseInformation”Because LicenseInformation is registered in DI automatically, you can inject it directly into your classes:
public class MyPage(LicenseInformation license) : PageModel{ public void OnGet() { if (license.IsConfigured) { // display license.SerialNumber, license.Expiration, etc. } }}Duende.IdentityServer.Licensing.LicenseUsageSummary
Section titled “Duende.IdentityServer.Licensing.LicenseUsageSummary”The LicenseUsageSummary class lets you get a detailed summary of clients, issuers, and features used
during the lifetime of an active .NET application for self-auditing purposes.
Properties
Section titled “Properties”-
EntitledSkusv8.0+A
stringcollection of SKU identifiers entitled by the configured license. -
LicenseEditionv7.1+A
stringindicating the edition. -
ClientsUsedA
stringcollection of clients used with the current IdentityServer instance. -
IssuersUsedA
stringcollection of issuers used with the current IdentityServer instance. -
FeaturesUsedA
stringcollection of human-readable feature names used since the IdentityServer instance started.
Register LicenseUsageSummary services
Section titled “Register LicenseUsageSummary services”To make LicenseUsageSummary available in your application, call the AddLicenseSummary() extension method
when registering IdentityServer:
builder.Services.AddIdentityServer() .AddLicenseSummary();Use LicenseUsageSummary with .NET lifetime events
Section titled “Use LicenseUsageSummary with .NET lifetime events”The IHost interface lets you subscribe to application lifetime events, including Application Started,
Application Stopped, and Application Stopping. IdentityServer tracks usage metrics internally, and you can
access that information at any time during the application’s lifetime from the service collection:
// from a valid services scopeapp.Services.GetRequiredService<LicenseUsageSummary>();For self-auditing purposes, we recommend using the ApplicationStopping lifetime event:
Note: LicenseUsageSummary is read-only.
app.Lifetime.ApplicationStopping.Register(() =>{ var usage = app.Services.GetRequiredService<LicenseUsageSummary>(); // Substitute a different logging mechanism as needed Console.Write(Summary(usage));});You can also inject LicenseUsageSummary using standard dependency injection:
// An ASP.NET Core MVC controllerpublic class MyController : Controller{ public MyController(LicenseUsageSummary summary) { // use the summary information }}Use the license usage summary to check whether your organization is within its current licensing allowance, or needs to make adjustments to stay within the Duende licensing terms.