diff --git a/identity-server/src/IdentityServer/Licensing/IdentityServerLicenseValidator.cs b/identity-server/src/IdentityServer/Licensing/IdentityServerLicenseValidator.cs index 418fbba1f..c6cbfee61 100644 --- a/identity-server/src/IdentityServer/Licensing/IdentityServerLicenseValidator.cs +++ b/identity-server/src/IdentityServer/Licensing/IdentityServerLicenseValidator.cs @@ -105,13 +105,14 @@ internal void ValidateClient(string clientId, IdentityServerLicense license) EnsureAdded(ref _clientIds, _clientIdLock, clientId); + // Only log for redistribution case because license v2 logs all other cases if (license != null && license.RedistributionFeature) { if (_clientIds.Count > license.ClientLimit) { ErrorLog.Invoke( - "Your license for Duende IdentityServer only permits {clientLimit} number of clients. You have processed requests for {clientCount}. The clients used were: {clients}.", - [license.ClientLimit, _clientIds.Count, _clientIds.ToArray()]); + "Your license for IdentityServer includes {clientLimit} clients but you have processed requests for {clientCount} clients. Please contact {contactInfo} at {companyName} or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The clients used were: {clients}.", + [license.ClientLimit, _clientIds.Count, license.ContactInfo, license.CompanyName, _clientIds.ToArray()]); } } } @@ -131,12 +132,13 @@ internal void ValidateIssuer(string iss, IdentityServerLicense license) EnsureAdded(ref _issuers, _issuerLock, iss); + // Only log for redistribution case because license v2 logs all other cases if (license != null && license.RedistributionFeature) { if (_issuers.Count > license.IssuerLimit) { ErrorLog.Invoke( - "Your license for Duende IdentityServer only permits {issuerLimit} number of issuers. You have processed requests for {issuerCount}. The issuers used were: {issuers}. This might be due to your server being accessed via different URLs or a direct IP and/or you have reverse proxy or a gateway involved. This suggests a network infrastructure configuration problem, or you are deliberately hosting multiple URLs and require an upgraded license.", + "Your license for IdentityServer includes {issuerLimit} issuers but you have processed requests for {issuerCount} issuers. This indicates that requests for each issuer are being sent to this instance of IdentityServer, which may be due to a network infrastructure configuration issue. If you intend to use multiple issuers, please contact {contactInfo} at {companyName} or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The issuers used were {issuers}.", [license.IssuerLimit, _issuers.Count, _issuers.ToArray()]); } } diff --git a/identity-server/src/IdentityServer/Licensing/V2/LicenseExpirationChecker.cs b/identity-server/src/IdentityServer/Licensing/V2/LicenseExpirationChecker.cs index a0384b2c3..e248537fb 100644 --- a/identity-server/src/IdentityServer/Licensing/V2/LicenseExpirationChecker.cs +++ b/identity-server/src/IdentityServer/Licensing/V2/LicenseExpirationChecker.cs @@ -21,7 +21,7 @@ public void CheckExpiration() if (!_expiredLicenseWarned && !license.Current.Redistribution && IsExpired) { _expiredLicenseWarned = true; - _logger.LicenseHasExpired(); + _logger.LicenseHasExpired(license.Current.ContactInfo ?? "", license.Current.CompanyName ?? ""); } } diff --git a/identity-server/src/IdentityServer/Licensing/V2/LicenseUsageTracker.cs b/identity-server/src/IdentityServer/Licensing/V2/LicenseUsageTracker.cs index 006bc5566..67c16b3ce 100644 --- a/identity-server/src/IdentityServer/Licensing/V2/LicenseUsageTracker.cs +++ b/identity-server/src/IdentityServer/Licensing/V2/LicenseUsageTracker.cs @@ -55,21 +55,23 @@ public void ClientUsed(string clientId) return; } - if (licenseAccessor.Current.IsConfigured) + var license = licenseAccessor.Current; + + if (license.IsConfigured) { - if (licenseAccessor.Current.Redistribution || !licenseAccessor.Current.ClientLimit.HasValue) + if (license.Redistribution || !license.ClientLimit.HasValue) { return; } - var clientLimitOverage = _clientsUsed.Values.Count - licenseAccessor.Current.ClientLimit; + var clientLimitOverage = _clientsUsed.Values.Count - license.ClientLimit; switch (clientLimitOverage) { case > ClientLimitExceededThreshold: - _logger.ClientLimitExceededOverThreshold(licenseAccessor.Current.ClientLimit.Value, _clientsUsed.Values.Count, ClientLimitExceededThreshold, _clientsUsed.Values); + _logger.ClientLimitExceededOverThreshold(license.ClientLimit.Value, _clientsUsed.Values.Count, license.ContactInfo, license.CompanyName, _clientsUsed.Values); break; case > 0: - _logger.ClientLimitExceededWithinOverageThreshold(licenseAccessor.Current.ClientLimit.Value, _clientsUsed.Values.Count, ClientLimitExceededThreshold, _clientsUsed.Values); + _logger.ClientLimitExceededWithinOverageThreshold(license.ClientLimit.Value, _clientsUsed.Values.Count, license.ContactInfo, license.CompanyName, _clientsUsed.Values); break; } } @@ -93,21 +95,23 @@ public void IssuerUsed(string issuer) return; } - if (licenseAccessor.Current.IsConfigured) + var license = licenseAccessor.Current; + + if (license.IsConfigured) { - if (licenseAccessor.Current.Redistribution || !licenseAccessor.Current.IssuerLimit.HasValue) + if (license.Redistribution || !license.IssuerLimit.HasValue) { return; } - var issuerLimitOverage = _issuersUsed.Values.Count - licenseAccessor.Current.IssuerLimit; + var issuerLimitOverage = _issuersUsed.Values.Count - license.IssuerLimit; switch (issuerLimitOverage) { case > IssuerLimitExceededThreshold: - _logger.IssuerLimitExceededOverThreshold(licenseAccessor.Current.IssuerLimit.Value, _issuersUsed.Values.Count, IssuerLimitExceededThreshold, _issuersUsed.Values); + _logger.IssuerLimitExceededOverThreshold(license.IssuerLimit.Value, _issuersUsed.Values.Count, license.ContactInfo, license.CompanyName, _issuersUsed.Values); break; case > 0: - _logger.IssuerLimitExceededWithinOverageThreshold(licenseAccessor.Current.IssuerLimit.Value, _issuersUsed.Values.Count, IssuerLimitExceededThreshold, _issuersUsed.Values); + _logger.IssuerLimitExceededWithinOverageThreshold(license.IssuerLimit.Value, _issuersUsed.Values.Count, license.ContactInfo, license.CompanyName, _issuersUsed.Values); break; } } diff --git a/identity-server/src/IdentityServer/Licensing/V2/Log.cs b/identity-server/src/IdentityServer/Licensing/V2/Log.cs index 5aa8e1a11..95a0d9deb 100644 --- a/identity-server/src/IdentityServer/Licensing/V2/Log.cs +++ b/identity-server/src/IdentityServer/Licensing/V2/Log.cs @@ -10,12 +10,12 @@ internal static class LicenseLogParameters public const string Threshold = "Threshold"; public const string ClientLimit = "ClientLimit"; public const string ClientCount = "ClientCount"; - public const string ClientLimitExceededThreshold = "ClientLimitExceededThreshold"; public const string ClientsUsed = "ClientsUsed"; public const string IssuerLimit = "IssuerLimit"; public const string IssuerCount = "IssuerCount"; - public const string IssuerLimitExceededThreshold = "IssuerLimitExceededThreshold"; public const string IssuersUsed = "IssuersUsed"; + public const string LicenseContact = "LicenseContact"; + public const string LicenseCompany = "LicenseCompany"; } internal static partial class Log @@ -27,47 +27,54 @@ internal static partial class Log [LoggerMessage( LogLevel.Error, - message: "The IdentityServer license is expired. In a future version of IdentityServer, license expiration will be enforced after a grace period.")] - public static partial void LicenseHasExpired(this ILogger logger); + message: $"Your IdentityServer license is expired. Please contact {{{LicenseLogParameters.LicenseContact}}} from {{{LicenseLogParameters.LicenseCompany}}} or start a conversation with us at https://duende.link/l/contact to renew your license as soon as possible. In a future version, license expiration will be enforced after a grace period. See https://duende.link/l/expired for more information.")] + public static partial void LicenseHasExpired(this ILogger logger, + string licenseContact, string licenseCompany); [LoggerMessage( LogLevel.Error, Message = - $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {{{LicenseLogParameters.Threshold}}} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. For more information, please see http://duende.link/trialmode.")] + $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {{{LicenseLogParameters.Threshold}}} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. See https://duende.link/l/trial for more information.")] public static partial void TrialModeRequestCountExceeded(this ILogger logger, ulong threshold); [LoggerMessage( LogLevel.Error, - message: $"Your license for Duende IdentityServer only permits {{{LicenseLogParameters.ClientLimit}}} number of clients. You have processed requests for {{{LicenseLogParameters.ClientCount}}} clients and are still within the threshold of {{{LicenseLogParameters.ClientLimitExceededThreshold}}} for exceeding permitted clients. In a future version of client limit will be enforced. The clients used were: {{{LicenseLogParameters.ClientsUsed}}}.")] - public static partial void ClientLimitExceededWithinOverageThreshold(this ILogger logger, int clientLimit, - int clientCount, int clientLimitExceededThreshold, IReadOnlyCollection clientsUsed); + message: + $"Your IdentityServer license includes {{{LicenseLogParameters.ClientLimit}}} clients but you have processed requests for {{{LicenseLogParameters.ClientCount}}} clients. Please contact {{{LicenseLogParameters.LicenseContact}}} from {{{LicenseLogParameters.LicenseCompany}}} or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The clients used were: {{{LicenseLogParameters.ClientsUsed}}}. See https://duende.link/l/threshold for more information.")] + public static partial void ClientLimitExceededWithinOverageThreshold(this ILogger logger, + int clientLimit, int clientCount, string licenseContact, string licenseCompany, IReadOnlyCollection clientsUsed); + // Language is deliberately the same when over or under threshold (will change in future version). [LoggerMessage( LogLevel.Error, message: - $"Your license for Duende IdentityServer only permits {{{LicenseLogParameters.ClientLimit}}} number of clients. You have processed requests for {{{LicenseLogParameters.ClientCount}}} clients and are beyond the threshold of {{{LicenseLogParameters.ClientLimitExceededThreshold}}} for exceeding permitted clients. In a future version of client limit will be enforced. The clients used were: {{{LicenseLogParameters.ClientsUsed}}}.")] - public static partial void ClientLimitExceededOverThreshold(this ILogger logger, int clientLimit, int clientCount, - int clientLimitExceededThreshold, IReadOnlyCollection clientsUsed); + $"Your IdentityServer license includes {{{LicenseLogParameters.ClientLimit}}} clients but you have processed requests for {{{LicenseLogParameters.ClientCount}}} clients. Please contact {{{LicenseLogParameters.LicenseContact}}} from {{{LicenseLogParameters.LicenseCompany}}} or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The clients used were: {{{LicenseLogParameters.ClientsUsed}}}. See https://duende.link/l/threshold for more information.")] + public static partial void ClientLimitExceededOverThreshold(this ILogger logger, + int clientLimit, int clientCount, string licenseContact, string licenseCompany, IReadOnlyCollection clientsUsed); [LoggerMessage( LogLevel.Error, message: - $"You do not have a license, and you have processed requests for {{{LicenseLogParameters.ClientCount}}} clients. This number requires a tier of license higher than Starter Edition. The clients used were: {{{LicenseLogParameters.ClientsUsed}}}.")] + $"You are using IdentityServer in trial mode and have processed requests for {{{LicenseLogParameters.ClientCount}}} clients. In production, this will require a license with sufficient client capacity. You can either purchase a license tier that includes this many clients or add additional client capacity to a Starter Edition license. The clients used were: {{{LicenseLogParameters.ClientsUsed}}}. See https://duende.link/l/trial for more information.")] public static partial void ClientLimitWithNoLicenseExceeded(this ILogger logger, int clientCount, IReadOnlyCollection clientsUsed); [LoggerMessage( LogLevel.Error, - message: $"Your license for Duende IdentityServer only permits {{{LicenseLogParameters.IssuerLimit}}} number of issuers. You have processed requests for {{{LicenseLogParameters.IssuerCount}}} issuers and are still within the threshold of {{{LicenseLogParameters.IssuerLimitExceededThreshold}}}. The issuers used were: {{{LicenseLogParameters.IssuersUsed}}}. This might be due to your server being accessed via different URLs or a direct IP and/or you have reverse proxy or a gateway involved. This suggests a network infrastructure configuration problem, or you are deliberately hosting multiple URLs and require an upgraded license. In a future version of issuer limit will be enforced.")] - public static partial void IssuerLimitExceededWithinOverageThreshold(this ILogger logger, int issuerLimit, int issuerCount, int issuerLimitExceededThreshold, IReadOnlyCollection issuersUsed); + message: $"Your license for IdentityServer includes {{{LicenseLogParameters.IssuerLimit}}} issuer(s) but you have processed requests for {{{LicenseLogParameters.IssuerCount}}} issuers. This indicates that requests for each issuer are being sent to this instance of IdentityServer, which may be due to a network infrastructure configuration issue. If you intend to use multiple issuers, please contact {{{LicenseLogParameters.LicenseContact}}} from {{{LicenseLogParameters.LicenseCompany}}} or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The issuers used were {{{LicenseLogParameters.IssuersUsed}}}. See https://duende.link/l/threshold for more information.")] + public static partial void IssuerLimitExceededWithinOverageThreshold(this ILogger logger, + int issuerLimit, int issuerCount, string licenseContact, string licenseCompany, IReadOnlyCollection issuersUsed); + // Language is deliberately the same when over or under threshold (will change in future version). [LoggerMessage( LogLevel.Error, - message: $"Your license for Duende IdentityServer only permits {{{LicenseLogParameters.IssuerLimit}}} number of issuers. You have processed requests for {{{LicenseLogParameters.IssuerCount}}} issuers and are over the threshold of {{{LicenseLogParameters.IssuerLimitExceededThreshold}}}. The issuers used were: {{{LicenseLogParameters.IssuersUsed}}}. This might be due to your server being accessed via different URLs or a direct IP and/or you have reverse proxy or a gateway involved. This suggests a network infrastructure configuration problem, or you are deliberately hosting multiple URLs and require an upgraded license. In a future version of issuer limit will be enforced.")] - public static partial void IssuerLimitExceededOverThreshold(this ILogger logger, int issuerLimit, int issuerCount, int issuerLimitExceededThreshold, IReadOnlyCollection issuersUsed); + message: $"Your license for IdentityServer includes {{{LicenseLogParameters.IssuerLimit}}} issuer(s) but you have processed requests for {{{LicenseLogParameters.IssuerCount}}} issuers. This indicates that requests for each issuer are being sent to this instance of IdentityServer, which may be due to a network infrastructure configuration issue. If you intend to use multiple issuers, please contact {{{LicenseLogParameters.LicenseContact}}} from {{{LicenseLogParameters.LicenseCompany}}} or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The issuers used were {{{LicenseLogParameters.IssuersUsed}}}. See https://duende.link/l/threshold for more information.")] + public static partial void IssuerLimitExceededOverThreshold(this ILogger logger, + int issuerLimit, int issuerCount, string licenseContact, string licenseCompany, IReadOnlyCollection issuersUsed); + [LoggerMessage( LogLevel.Error, - message: $"You do not have a license, and you have processed requests for {{{LicenseLogParameters.IssuerCount}}} issuers. If you are deliberately hosting multiple URLs then this number requires a license per issuer, or the Enterprise Edition tier of license. If not then this might be due to your server being accessed via different URLs or a direct IP and/or you have reverse proxy or a gateway involved, and this suggests a network infrastructure configuration problem. The issuers used were: {{{LicenseLogParameters.IssuersUsed}}}.")] + message: $"You are using IdentityServer in trial mode and have processed requests for {{{LicenseLogParameters.IssuerCount}}} issuers. This indicates that requests for each issuer are being sent to this instance of IdentityServer, which may be due to a network infrastructure configuration issue. If you intend to use multiple issuers, either a license per issuer or an Enterprise Edition license is required. In a future version, this limit will be enforced after a threshold is exceeded. The issuers used were: {{{LicenseLogParameters.IssuersUsed}}}. See https://duende.link/l/trial for more information.")] public static partial void IssuerLimitWithNoLicenseExceeded(this ILogger logger, int issuerCount, IReadOnlyCollection issuersUsed); } diff --git a/identity-server/test/IdentityServer.IntegrationTests/Hosting/LicenseTests.cs b/identity-server/test/IdentityServer.IntegrationTests/Hosting/LicenseTests.cs index c6f9fb149..776685531 100644 --- a/identity-server/test/IdentityServer.IntegrationTests/Hosting/LicenseTests.cs +++ b/identity-server/test/IdentityServer.IntegrationTests/Hosting/LicenseTests.cs @@ -72,6 +72,6 @@ public async Task unlicensed_protocol_requests_log_a_warning() } _mockPipeline.MockLogger.LogMessages.ShouldContain( - $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {threshold} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. For more information, please see http://duende.link/trialmode."); + $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {threshold} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. See https://duende.link/l/trial for more information."); } } diff --git a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseExpirationCheckerTests.cs b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseExpirationCheckerTests.cs index 582cb037b..c611ee64a 100644 --- a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseExpirationCheckerTests.cs +++ b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseExpirationCheckerTests.cs @@ -44,7 +44,7 @@ public void warning_is_logged_for_expired_license(string licenseKey) // REMINDER - If this test needs to change because the log message was updated, so should no_warning_is_logged_for_unexpired_license _logger.Collector.GetSnapshot().ShouldContain(r => r.Message == - "The IdentityServer license is expired. In a future version of IdentityServer, license expiration will be enforced after a grace period.", + "Your IdentityServer license is expired. Please contact joe@duendesoftware.com from _test or start a conversation with us at https://duende.link/l/contact to renew your license as soon as possible. In a future version, license expiration will be enforced after a grace period. See https://duende.link/l/expired for more information.", 1); } @@ -58,7 +58,7 @@ public void no_warning_is_logged_for_unexpired_license(string licenseKey) _expirationCheck.CheckExpiration(); _logger.Collector.GetSnapshot().ShouldNotContain(r => - r.Message == "The IdentityServer license is expired. In a future version of IdentityServer, license expiration will be enforced after a grace period."); + r.Message == "Your IdentityServer license is expired. Please contact joe@duendesoftware.com from _test or start a conversation with us at https://duende.link/l/contact to renew your license as soon as possible. In a future version, license expiration will be enforced after a grace period. See https://duende.link/l/expired for more information."); } [Theory] diff --git a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseUsageTests.cs b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseUsageTests.cs index 9bd231542..22dedd3af 100644 --- a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseUsageTests.cs +++ b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/LicenseUsageTests.cs @@ -99,8 +99,8 @@ public void client_count_over_limit_without_license_should_log_warning() var initialLogSnapshot = _logger.Collector.GetSnapshot(); initialLogSnapshot.ShouldContain(r => r.Level == LogLevel.Error && - r.Message.StartsWith( - "You do not have a license, and you have processed requests for 6 clients. This number requires a tier of license higher than Starter Edition. The clients used were:")); + r.Message == + "You are using IdentityServer in trial mode and have processed requests for 6 clients. In production, this will require a license with sufficient client capacity. You can either purchase a license tier that includes this many clients or add additional client capacity to a Starter Edition license. The clients used were: client3, client2, client1, client0, client5, client4. See https://duende.link/l/trial for more information."); } [Fact] @@ -116,8 +116,7 @@ public void client_count_over_limit_and_within_overage_threshold_and_new_client_ var logSnapshot = _logger.Collector.GetSnapshot(); logSnapshot.ShouldContain(r => r.Level == LogLevel.Error && - r.Message.StartsWith( - "Your license for Duende IdentityServer only permits 5 number of clients. You have processed requests for 6 clients and are still within the threshold of 5 for exceeding permitted clients. In a future version of client limit will be enforced. The clients used were:")); + r.Message == "Your IdentityServer license includes 5 clients but you have processed requests for 6 clients. Please contact joe@duendesoftware.com from _test or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The clients used were: client3, client2, client1, client0, client5, client4. See https://duende.link/l/threshold for more information."); } [Fact] @@ -148,7 +147,7 @@ public void client_count_over_limit_and_over_threshold_overage_and_new_client_us var logSnapshot = _logger.Collector.GetSnapshot(); logSnapshot.ShouldContain(r => r.Level == LogLevel.Error && - r.Message.StartsWith("Your license for Duende IdentityServer only permits 5 number of clients. You have processed requests for 11 clients and are beyond the threshold of 5 for exceeding permitted clients. In a future version of client limit will be enforced. The clients used were:")); + r.Message.StartsWith("Your IdentityServer license includes 5 clients but you have processed requests for 11 clients")); } [Fact] @@ -213,10 +212,8 @@ public void issuer_count_over_limit_without_license_should_log_warning() _licenseUsageTracker.IssuerUsed("issuer2"); var initialLogSnapshot = _logger.Collector.GetSnapshot(); - initialLogSnapshot.ShouldContain(r => - r.Level == LogLevel.Error && - r.Message.StartsWith( - $"You do not have a license, and you have processed requests for 2 issuers. If you are deliberately hosting multiple URLs then this number requires a license per issuer, or the Enterprise Edition tier of license. If not then this might be due to your server being accessed via different URLs or a direct IP and/or you have reverse proxy or a gateway involved, and this suggests a network infrastructure configuration problem. The issuers used were: ")); + initialLogSnapshot.ShouldContain(r => r.Level == LogLevel.Error && r.Message == + "You are using IdentityServer in trial mode and have processed requests for 2 issuers. This indicates that requests for each issuer are being sent to this instance of IdentityServer, which may be due to a network infrastructure configuration issue. If you intend to use multiple issuers, either a license per issuer or an Enterprise Edition license is required. In a future version, this limit will be enforced after a threshold is exceeded. The issuers used were: issuer1, issuer2. See https://duende.link/l/trial for more information."); } [Fact] @@ -228,12 +225,8 @@ public void issuer_count_over_limit_and_within_overage_threshold_and_new_client_ _licenseUsageTracker.IssuerUsed("issuer2"); var logSnapshot = _logger.Collector.GetSnapshot(); - logSnapshot.ShouldContain(r => - r.Level == LogLevel.Error && - r.Message.StartsWith( - "Your license for Duende IdentityServer only permits 1 number of issuers. You have processed requests for 2 issuers and are still within the threshold of 1. The issuers used were: ") && - r.Message.EndsWith( - "This might be due to your server being accessed via different URLs or a direct IP and/or you have reverse proxy or a gateway involved. This suggests a network infrastructure configuration problem, or you are deliberately hosting multiple URLs and require an upgraded license. In a future version of issuer limit will be enforced.")); + logSnapshot.ShouldContain(r => r.Level == LogLevel.Error && r.Message == + "Your license for IdentityServer includes 1 issuer(s) but you have processed requests for 2 issuers. This indicates that requests for each issuer are being sent to this instance of IdentityServer, which may be due to a network infrastructure configuration issue. If you intend to use multiple issuers, please contact joe@duendesoftware.com from _test or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The issuers used were issuer1, issuer2. See https://duende.link/l/threshold for more information."); } [Fact] @@ -258,12 +251,8 @@ public void issuer_count_over_limit_and_over_threshold_overage_and_new_client_us _licenseUsageTracker.IssuerUsed("issuer3"); var logSnapshot = _logger.Collector.GetSnapshot(); - logSnapshot.ShouldContain(r => - r.Level == LogLevel.Error && - r.Message.StartsWith( - "Your license for Duende IdentityServer only permits 1 number of issuers. You have processed requests for 3 issuers and are over the threshold of 1. The issuers used were: ") && - r.Message.EndsWith( - "This might be due to your server being accessed via different URLs or a direct IP and/or you have reverse proxy or a gateway involved. This suggests a network infrastructure configuration problem, or you are deliberately hosting multiple URLs and require an upgraded license. In a future version of issuer limit will be enforced.")); + logSnapshot.ShouldContain(r => r.Level == LogLevel.Error && r.Message == + "Your license for IdentityServer includes 1 issuer(s) but you have processed requests for 3 issuers. This indicates that requests for each issuer are being sent to this instance of IdentityServer, which may be due to a network infrastructure configuration issue. If you intend to use multiple issuers, please contact joe@duendesoftware.com from _test or start a conversation with us at https://duende.link/l/contact to upgrade your license as soon as possible. In a future version, this limit will be enforced after a threshold is exceeded. The issuers used were issuer3, issuer1, issuer2. See https://duende.link/l/threshold for more information."); } [Fact] diff --git a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/ProtocolRequestCounterTests.cs b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/ProtocolRequestCounterTests.cs index 0aef6c00d..0ea9e3dd4 100644 --- a/identity-server/test/IdentityServer.UnitTests/Licensing/v2/ProtocolRequestCounterTests.cs +++ b/identity-server/test/IdentityServer.UnitTests/Licensing/v2/ProtocolRequestCounterTests.cs @@ -42,7 +42,7 @@ public void warning_is_logged_once_after_too_many_protocol_requests_are_handled( // REMINDER - If this test needs to change because the log message was updated, so should warning_is_not_logged_before_too_many_protocol_requests_are_handled var logRecord = _logger.Collector.GetSnapshot().Single(); logRecord.Message.ShouldBe( - $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {_counter.Threshold} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. For more information, please see http://duende.link/trialmode."); + $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {_counter.Threshold} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. See https://duende.link/l/trial for more information."); } [Fact] @@ -56,6 +56,6 @@ public void warning_is_not_logged_before_too_many_protocol_requests_are_handled( var logRecords = _logger.Collector.GetSnapshot().Select(l => l.Message); logRecords.ShouldNotContain( - $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {_counter.Threshold} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. For more information, please see http://duende.link/trialmode."); + $"You are using IdentityServer in trial mode and have exceeded the trial threshold of {_counter.Threshold} requests handled by IdentityServer. In a future version, you will need to restart the server or configure a license key to continue testing. See https://duende.link/l/trial for more information."); } }