Skip to content

Commit 3ac699f

Browse files
authored
fix: update packages to remove deprecated ones (#78)
fix: removed support to .net 5.0 fix: updated HandlePostRequest method accordling to OpenIdConnectHandler
1 parent 822356c commit 3ac699f

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/SPID.AspNetCore.Authentication/SPID.AspNetCore.Authentication.csproj

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net7.0;net6.0;net5.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<Description>AspNetCore Remote Authenticator for SPID</Description>
77
<Authors>Daniele Giallonardo, Stefano Mostarda</Authors>
@@ -23,11 +23,8 @@
2323
</PropertyGroup>
2424

2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
27-
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
28-
<PackageReference Include="Microsoft.AspNetCore.Razor" Version="2.2.0" />
29-
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.29" />
30-
</ItemGroup>
26+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
27+
</ItemGroup>
3128

3229
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net6.0'">
3330
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
@@ -37,21 +34,17 @@
3734

3835
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
3936
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="8.0.4" />
37+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.4" />
4038
</ItemGroup>
4139

4240
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
4341
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.12" />
42+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.12" />
4443
</ItemGroup>
4544

4645
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
4746
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.21" />
48-
</ItemGroup>
49-
50-
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
51-
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="5.0.17" />
52-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
53-
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
54-
<PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.1" />
47+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.21" />
5548
</ItemGroup>
5649

5750
<ItemGroup>

src/SPID.AspNetCore.Authentication/SpidHandler.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,12 +632,20 @@ await _logHandler.LogPostRequest(new PostRequest()
632632
RelayState = messageGuid,
633633
Url = url
634634
});
635-
await _response.WriteAsync($"<html><head><title>Login</title></head><body><form id=\"spidform\" action=\"{url}\" method=\"post\">" +
635+
string s = $"<html><head><title>Login</title></head><body><form id=\"spidform\" action=\"{url}\" method=\"post\">" +
636636
$"<input type=\"hidden\" name=\"SAMLRequest\" value=\"{base64SignedSerializedMessage}\" />" +
637637
$"<input type=\"hidden\" name=\"RelayState\" value=\"{messageGuid}\" />" +
638638
$"<button id=\"btnLogin\" style=\"display: none;\">Login</button>" +
639639
"<script>document.getElementById('btnLogin').click()</script>" +
640-
"</form></body></html>");
640+
"</form></body></html>";
641+
642+
byte[] bytes = Encoding.UTF8.GetBytes(s);
643+
_response.ContentLength = bytes.Length;
644+
_response.ContentType = "text/html;charset=UTF-8";
645+
_response.Headers.CacheControl = "no-cache, no-store";
646+
_response.Headers.Pragma = "no-cache";
647+
_response.Headers.Expires = "Thu, 01 Jan 1970 00:00:00 GMT";
648+
await _response.Body.WriteAsync(bytes);
641649
}
642650

643651
private async Task HandleRedirectRequest(string unsignedSerializedMessage, X509Certificate2 certificate, string url, string messageGuid)

0 commit comments

Comments
 (0)