diff --git a/Directory.Packages.props b/Directory.Packages.props
index 92d60048b..f27ace590 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -34,8 +34,8 @@
-
-
+
+
@@ -43,16 +43,16 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -134,9 +134,9 @@
that future versions of the intermediate dependencies that don't have this
problem exist someday). -->
-
-
+
+
-
\ No newline at end of file
+
diff --git a/identity-server/src/IdentityServer/Duende.IdentityServer.csproj b/identity-server/src/IdentityServer/Duende.IdentityServer.csproj
index 1ad18b0b6..ff63ff432 100644
--- a/identity-server/src/IdentityServer/Duende.IdentityServer.csproj
+++ b/identity-server/src/IdentityServer/Duende.IdentityServer.csproj
@@ -28,4 +28,9 @@
+
+
+
+
+
diff --git a/identity-server/src/IdentityServer/Endpoints/Results/CheckSessionResult.cs b/identity-server/src/IdentityServer/Endpoints/Results/CheckSessionResult.cs
index 4cb93c271..4387775de 100644
--- a/identity-server/src/IdentityServer/Endpoints/Results/CheckSessionResult.cs
+++ b/identity-server/src/IdentityServer/Endpoints/Results/CheckSessionResult.cs
@@ -21,6 +21,7 @@ internal class CheckSessionHttpWriter : IHttpResponseWriter
{
public CheckSessionHttpWriter(IdentityServerOptions options) => _options = options;
+ private static readonly string CheckSessionScript = GetEmbeddedResource($"{typeof(CheckSessionHttpWriter).Namespace}.check-session-result.js");
private IdentityServerOptions _options;
private static volatile string FormattedHtml;
private static readonly object Lock = new object();
@@ -43,7 +44,10 @@ internal class CheckSessionHttpWriter : IHttpResponseWriter
{
if (cookieName != LastCheckSessionCookieName)
{
- FormattedHtml = Html.Replace("{cookieName}", cookieName);
+ FormattedHtml = Html.Replace("{cookieName}", cookieName)
+ .Replace("{script}", CheckSessionScript, StringComparison.InvariantCulture)
+ .ReplaceLineEndings("\n");
+
LastCheckSessionCookieName = cookieName;
}
}
@@ -51,6 +55,19 @@ internal class CheckSessionHttpWriter : IHttpResponseWriter
return FormattedHtml;
}
+ private static string GetEmbeddedResource(string resourceName)
+ {
+ var assembly = typeof(CheckSessionHttpWriter).Assembly;
+ using var stream = assembly.GetManifestResourceStream(resourceName);
+ if (stream == null)
+ {
+ throw new InvalidOperationException($"Embedded resource '{resourceName}' not found.");
+ }
+
+ using var reader = new StreamReader(stream);
+ return reader.ReadToEnd();
+ }
+
private const string Html = @"
@@ -62,304 +79,7 @@ internal class CheckSessionHttpWriter : IHttpResponseWriter
-
+