Skip to content
Introducing the next era of Duende IdentityServer. Read our CEO’s announcement

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.

  • 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): true if 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.

Because LicenseInformation is registered in DI automatically, you can inject it directly into your classes:

MyPage.cshtml.cs
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.

  • EntitledSkus v8.0+

    A string collection of SKU identifiers entitled by the configured license.

  • LicenseEdition v7.1+

    A string indicating the edition.

  • ClientsUsed

    A string collection of clients used with the current IdentityServer instance.

  • IssuersUsed

    A string collection of issuers used with the current IdentityServer instance.

  • FeaturesUsed

    A string collection of human-readable feature names used since the IdentityServer instance started.

To make LicenseUsageSummary available in your application, call the AddLicenseSummary() extension method when registering IdentityServer:

Program.cs
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 scope
app.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 controller
public 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.