Skip to content

Commit f019c83

Browse files
Jessy Kyalo MusyimiJessy Kyalo Musyimi
authored andcommitted
[major] upgrade to Net.5.0
1 parent 010b8e5 commit f019c83

File tree

8 files changed

+27
-39
lines changed

8 files changed

+27
-39
lines changed

Source/DemoWebApp/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/DemoWebApp/Data/Migrations/ApplicationDbContextModelSnapshot.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
3434
b.HasKey("Id");
3535

3636
b.HasIndex("NormalizedName")
37-
.HasName("RoleNameIndex");
37+
.HasDatabaseName("RoleNameIndex");
3838

3939
b.ToTable("AspNetRoles");
4040
});
@@ -165,11 +165,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
165165
b.HasKey("Id");
166166

167167
b.HasIndex("NormalizedEmail")
168-
.HasName("EmailIndex");
168+
.HasDatabaseName("EmailIndex");
169169

170170
b.HasIndex("NormalizedUserName")
171171
.IsUnique()
172-
.HasName("UserNameIndex");
172+
.HasDatabaseName("UserNameIndex");
173173

174174
b.ToTable("AspNetUsers");
175175
});

Source/DemoWebApp/DemoWebApp.csproj

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

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<UserSecretsId>aspnet-DemoWebApp-C260B8F3-E5A3-4A4D-B57A-771F079933AA</UserSecretsId>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.2" />
10-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
11-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" />
12-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2" PrivateAssets="All" />
13-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.1" PrivateAssets="All" />
9+
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.6" />
10+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6" PrivateAssets="All" />
13+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" PrivateAssets="All" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

Source/Saml2.Authentication.Core/Authentication/Saml2Handler.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public async Task SignOutAsync(AuthenticationProperties properties)
7070
_logger.LogDebug($"Entering {nameof(SignOutAsync)}", properties);
7171

7272
var logoutRequestId = CreateUniqueId();
73-
properties = properties ?? new AuthenticationProperties();
73+
properties ??= new AuthenticationProperties();
7474

7575
properties.Items.Add(LogoutRequestIdKey, logoutRequestId);
7676
properties.Items.Add(nameof(Options.SignOutScheme), Options.SignOutScheme);
@@ -88,7 +88,7 @@ protected override async Task HandleChallengeAsync(AuthenticationProperties prop
8888
{
8989
_logger.LogDebug($"Entering {nameof(HandleChallengeAsync)}", properties);
9090

91-
properties = properties ?? new AuthenticationProperties();
91+
properties ??= new AuthenticationProperties();
9292

9393
var authnRequestId = CreateUniqueId();
9494
properties.Items.Add(AuthnRequestIdKey, authnRequestId);
@@ -103,9 +103,9 @@ protected override async Task HandleChallengeAsync(AuthenticationProperties prop
103103

104104
private async Task<bool> HandleSignOut()
105105
{
106-
if (!Request.Path.Value.EndsWith(ServiceProviderConfiguration.SingleLogoutServiceUrl, StringComparison.OrdinalIgnoreCase)
107-
|| !Request.Path.Value.EndsWith(ServiceProviderConfiguration.SingleLogoutResponseServiceUrl, StringComparison.OrdinalIgnoreCase)
108-
|| !_httpRedirectBinding.IsValid())
106+
if (Request.Path.Value != null && (!Request.Path.Value.EndsWith(ServiceProviderConfiguration.SingleLogoutServiceUrl, StringComparison.OrdinalIgnoreCase)
107+
|| !Request.Path.Value.EndsWith(ServiceProviderConfiguration.SingleLogoutResponseServiceUrl, StringComparison.OrdinalIgnoreCase)
108+
|| !_httpRedirectBinding.IsValid()))
109109
{
110110
return false;
111111
}
@@ -146,8 +146,7 @@ private async Task<bool> HandleSignOut()
146146

147147
private async Task<bool> HandleSignIn()
148148
{
149-
if (!Request.Path.Value.EndsWith(ServiceProviderConfiguration.AssertionConsumerServiceUrl, StringComparison.OrdinalIgnoreCase)
150-
|| !_httpRedirectBinding.IsValid())
149+
if (Request.Path.Value != null && (!Request.Path.Value.EndsWith(ServiceProviderConfiguration.AssertionConsumerServiceUrl, StringComparison.OrdinalIgnoreCase) || !_httpRedirectBinding.IsValid()))
151150
{
152151
return false;
153152
}
@@ -172,8 +171,8 @@ private async Task<bool> HandleSignIn()
172171

173172
private async Task<bool> HandleHttpArtifact(string providerName)
174173
{
175-
if (!Request.Path.Value.EndsWith(ServiceProviderConfiguration.AssertionConsumerServiceUrl, StringComparison.OrdinalIgnoreCase)
176-
|| !_httpArtifactBinding.IsValid())
174+
if (Request.Path.Value != null && (!Request.Path.Value.EndsWith(ServiceProviderConfiguration.AssertionConsumerServiceUrl, StringComparison.OrdinalIgnoreCase)
175+
|| !_httpArtifactBinding.IsValid()))
177176
{
178177
return false;
179178
}

Source/Saml2.Authentication.Core/Bindings/HttpArtifactBinding.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System;
44
using System.IO;
55
using System.Xml;
6-
using Configuration;
76
using dk.nita.saml20.Utils;
87
using Extensions;
98
using Microsoft.AspNetCore.Http;
@@ -20,7 +19,6 @@ internal class HttpArtifactBinding : HttpSoapBinding, IHttpArtifactBinding
2019

2120
public HttpArtifactBinding(
2221
IHttpContextAccessor httpContextAccessor,
23-
Saml2Configuration configuration,
2422
IConfigurationProvider configurationProvider)
2523
{
2624
_httpContextAccessor = httpContextAccessor;

Source/Saml2.Authentication.Core/Bindings/HttpRedirectBinding.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public bool IsValid()
6969
return false;
7070
}
7171

72-
var form = Request.Form;
73-
return form != null && form.ContainsKey(SamlResponseQueryKey);
72+
return Request.Form.ContainsKey(SamlResponseQueryKey);
7473
}
7574

7675
public bool IsLogoutRequest()
@@ -85,8 +84,7 @@ public bool IsLogoutRequest()
8584
return false;
8685
}
8786

88-
var form = Request.Form;
89-
return form != null && form.ContainsKey(SamlRequestQueryKey);
87+
return Request.Form.ContainsKey(SamlRequestQueryKey);
9088
}
9189

9290
public Saml2Response GetResponse()
@@ -106,11 +104,6 @@ public Saml2Response GetResponse()
106104
}
107105

108106
var form = Request.Form;
109-
if (form == null)
110-
{
111-
return null;
112-
}
113-
114107
return new Saml2Response
115108
{
116109
Response = form[SamlResponseQueryKey],
@@ -130,9 +123,7 @@ public string GetCompressedRelayState()
130123
return null;
131124
}
132125

133-
var form = Request.Form;
134-
135-
return form?[SamlRelayStateQueryKey].ToString();
126+
return Request.Form?[SamlRelayStateQueryKey].ToString();
136127
}
137128

138129
public string BuildAuthnRequestUrl(string providerName, Saml2AuthnRequest saml2AuthnRequest, string relayState)

Source/Saml2.Authentication.Core/Configuration/Saml2PostConfigureOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public Saml2PostConfigureOptions(IDataProtectionProvider dataProtectionProvider)
1818

1919
public void PostConfigure(string name, Saml2Options options)
2020
{
21-
options.DataProtectionProvider = options.DataProtectionProvider ?? _dataProtectionProvider;
21+
options.DataProtectionProvider ??= _dataProtectionProvider;
2222

2323
if (string.IsNullOrEmpty(options.SignOutScheme))
2424
{

Source/Saml2.Authentication.Core/Saml2.Authentication.Core.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp3.1</TargetFramework>
3+
<TargetFramework>net5.0</TargetFramework>
44
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
55
<IsPackable>true</IsPackable>
66
<IncludeSymbols>true</IncludeSymbols>
77
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
88
<PackageId>Saml2.Authentication.Core</PackageId>
9-
<Description>A SAML 2.0 authentication middleware for ASP.NET Core</Description>
9+
<Description>SAML 2.0 authentication middleware for ASP.NET Core</Description>
1010
<Authors>Jessy Kyalo Musyimi</Authors>
1111
<Company />
1212
<AssemblyName>Saml2.Authentication.Core</AssemblyName>
@@ -18,7 +18,7 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
21+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2222
</ItemGroup>
2323

2424
<ItemGroup>

0 commit comments

Comments
 (0)