From d4b6174ae68e4f133cd871a86140056773139c4c Mon Sep 17 00:00:00 2001 From: Brett Hazen <2651260+bhazen@users.noreply.github.com> Date: Fri, 25 Jul 2025 08:07:46 -0500 Subject: [PATCH] Address CA1845 Violations --- identity-server/src/Directory.Build.props | 2 +- .../ResponseHandling/Default/DiscoveryResponseGenerator.cs | 2 +- .../IdentityServer/Services/Default/DefaultIssuerNameService.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/identity-server/src/Directory.Build.props b/identity-server/src/Directory.Build.props index ff8d2b258..30f7593a8 100644 --- a/identity-server/src/Directory.Build.props +++ b/identity-server/src/Directory.Build.props @@ -20,6 +20,6 @@ Currently all existing warnings are suppressed. We will remove them as we address them. But this configuration allows us to prevent new warnings from being introduced while we work on the existing ones. --> - $(NoWarn);CA1002;CA1008;CA1031;CA1034;CA1040;CA1051;CA1054;CA1055;CA1056;CA1062;CA1716;CA1724;CA1725;CA1727;CA1819;CA1845;CA1848;CA1849;CA1851;CA1852;CA1854;CA1859;CA1861;CA1860;CA1863;CA1864;CA1870;CA1872;CA2000;CA2008;CA2201;CA2007;CA2208;CA2016;CA2211;CA2227;CA2234;CA2249;CA2253;CA2254;CA2263;CA5404;CA5394; + $(NoWarn);CA1002;CA1008;CA1031;CA1034;CA1040;CA1051;CA1054;CA1055;CA1056;CA1062;CA1716;CA1724;CA1725;CA1727;CA1819;CA1848;CA1849;CA1851;CA1852;CA1854;CA1859;CA1861;CA1860;CA1863;CA1864;CA1870;CA1872;CA2000;CA2008;CA2201;CA2007;CA2208;CA2016;CA2211;CA2227;CA2234;CA2249;CA2253;CA2254;CA2263;CA5404;CA5394; diff --git a/identity-server/src/IdentityServer/ResponseHandling/Default/DiscoveryResponseGenerator.cs b/identity-server/src/IdentityServer/ResponseHandling/Default/DiscoveryResponseGenerator.cs index 45c905198..b70e3f4ac 100644 --- a/identity-server/src/IdentityServer/ResponseHandling/Default/DiscoveryResponseGenerator.cs +++ b/identity-server/src/IdentityServer/ResponseHandling/Default/DiscoveryResponseGenerator.cs @@ -404,7 +404,7 @@ public class DiscoveryResponseGenerator : IDiscoveryResponseGenerator { if (customValueString.StartsWith("~/", StringComparison.Ordinal) && Options.Discovery.ExpandRelativePathsInCustomEntries) { - entries.Add(key, baseUrl + customValueString.Substring(2)); + entries.Add(key, string.Concat(baseUrl, customValueString.AsSpan(2))); continue; } } diff --git a/identity-server/src/IdentityServer/Services/Default/DefaultIssuerNameService.cs b/identity-server/src/IdentityServer/Services/Default/DefaultIssuerNameService.cs index 22f5cdfb0..77376910e 100644 --- a/identity-server/src/IdentityServer/Services/Default/DefaultIssuerNameService.cs +++ b/identity-server/src/IdentityServer/Services/Default/DefaultIssuerNameService.cs @@ -51,7 +51,7 @@ public class DefaultIssuerNameService : IIssuerNameService // so the issuer we use is from the parent domain (e.g. "acme.com") // // Host.Value is used to get unicode hostname, instead of ToUriComponent (aka punycode) - origin = request.Scheme + "://" + request.Host.Value.Substring(_options.MutualTls.DomainName.Length + 1); + origin = string.Concat(request.Scheme, "://", request.Host.Value.AsSpan(_options.MutualTls.DomainName.Length + 1)); } } }