Skip to content

Commit 3708e0d

Browse files
committed
- Microsoft.AspNetCore.Authentication NuGet package upgraded to 2.2.0
- Microsoft.AspNetCore.All package upgraded to 2.0.9 on SampleWebApi project to fix the vulnerabilities found in the previous versions - New SampleWebApi.Shared and SampleWebApi_2_2 project added for WebApi for .NET Core 2.2 on the github repository - Fixed a bug in the Sample project to do with Object Null Exception
1 parent 0fae4d5 commit 3708e0d

File tree

16 files changed

+251
-11
lines changed

16 files changed

+251
-11
lines changed

Mihir.AspNetCore.Authentication.Basic.sln

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27428.2011
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29418.71
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mihir.AspNetCore.Authentication.Basic", "Mihir.AspNetCore.Authentication.Basic\Mihir.AspNetCore.Authentication.Basic.csproj", "{F8FEFB06-9F93-4F50-8530-80F5C0A677FC}"
77
EndProject
@@ -11,9 +11,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
README.md = README.md
1212
EndProjectSection
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebApi", "SampleWebApi\SampleWebApi.csproj", "{1DB7BD52-D1E0-4248-819F-8424AFF55689}"
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleWebApi", "SampleWebApi\SampleWebApi.csproj", "{1DB7BD52-D1E0-4248-819F-8424AFF55689}"
15+
EndProject
16+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebApi_2_2", "SampleWebApi_2_2\SampleWebApi_2_2.csproj", "{95EF44A2-B735-425E-97D8-19DB54730E1B}"
17+
EndProject
18+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SampleWebApi.Shared", "SampleWebApi.Shared\SampleWebApi.Shared.shproj", "{E544FB20-29F3-41F5-A78E-6164F9C43B3C}"
1519
EndProject
1620
Global
21+
GlobalSection(SharedMSBuildProjectFiles) = preSolution
22+
SampleWebApi.Shared\SampleWebApi.Shared.projitems*{e544fb20-29f3-41f5-a78e-6164f9c43b3c}*SharedItemsImports = 13
23+
EndGlobalSection
1724
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1825
Debug|Any CPU = Debug|Any CPU
1926
Release|Any CPU = Release|Any CPU
@@ -27,6 +34,10 @@ Global
2734
{1DB7BD52-D1E0-4248-819F-8424AFF55689}.Debug|Any CPU.Build.0 = Debug|Any CPU
2835
{1DB7BD52-D1E0-4248-819F-8424AFF55689}.Release|Any CPU.ActiveCfg = Release|Any CPU
2936
{1DB7BD52-D1E0-4248-819F-8424AFF55689}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{95EF44A2-B735-425E-97D8-19DB54730E1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{95EF44A2-B735-425E-97D8-19DB54730E1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{95EF44A2-B735-425E-97D8-19DB54730E1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{95EF44A2-B735-425E-97D8-19DB54730E1B}.Release|Any CPU.Build.0 = Release|Any CPU
3041
EndGlobalSection
3142
GlobalSection(SolutionProperties) = preSolution
3243
HideSolutionNode = FALSE

Mihir.AspNetCore.Authentication.Basic/Mihir.AspNetCore.Authentication.Basic.csproj

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,30 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<Authors>Mihir Dilip</Authors>
66
<Company>Mihir Dilip</Company>
7-
<Description>Basic Scheme Authentication Implementation for ASP.NET Core 2.0</Description>
7+
<Description>Basic Scheme Authentication Implementation for ASP.NET Core 2.0 and above.</Description>
88
<RepositoryUrl>https://github.com/mihirdilip/Mihir.AspNetCore.Authentication.Basic</RepositoryUrl>
99
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1010
<PackageProjectUrl>https://github.com/mihirdilip/Mihir.AspNetCore.Authentication.Basic</PackageProjectUrl>
11-
<Version>1.0.2</Version>
12-
<Copyright>Copyright (c) 2018 Mihir Dilip</Copyright>
11+
<Version>2.0.0</Version>
12+
<Copyright>Copyright (c) 2019 Mihir Dilip</Copyright>
1313
<PackageLicenseUrl>https://github.com/mihirdilip/Mihir.AspNetCore.Authentication.Basic/blob/master/LICENSE.txt</PackageLicenseUrl>
1414
<RepositoryType>GitHub</RepositoryType>
1515
<PackageIconUrl />
16-
<PackageTags>asp-net-core, aspnetcore, netstandard, netstandard20, basic-authentication, basicauthentication</PackageTags>
16+
<PackageTags>asp-net-core, aspnetcore, netstandard, netstandard20, basic-authentication, basicauthentication, dotnetcore, asp-net-core-basic-authentication, aspnetcore-basic-authentication, security, authentication, asp-net-core-authentication, aspnetcore-authentication</PackageTags>
1717
<NeutralLanguage />
1818
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
19-
<PackageReleaseNotes>- Challenge property moved from BasicOptions to BasicHandler</PackageReleaseNotes>
19+
<PackageReleaseNotes>- Microsoft.AspNetCore.Authentication NuGet package upgraded to 2.2.0
20+
- Microsoft.AspNetCore.All package upgraded to 2.0.9 on SampleWebApi project to fix the vulnerabilities found in the previous versions
21+
- New SampleWebApi.Shared and SampleWebApi_2_2 project added for WebApi for .NET Core 2.2 on the github repository
22+
- Fixed a bug in the Sample project to do with Object Null Exception</PackageReleaseNotes>
2023
</PropertyGroup>
2124

2225
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
2326
<DocumentationFile>bin\Release\netstandard2.0\Mihir.AspNetCore.Authentication.Basic.xml</DocumentationFile>
2427
</PropertyGroup>
2528

2629
<ItemGroup>
27-
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.0.3" />
30+
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.2.0" />
2831
</ItemGroup>
2932

3033
</Project>
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
<HasSharedItems>true</HasSharedItems>
6+
<SharedGUID>e544fb20-29f3-41f5-a78e-6164f9c43b3c</SharedGUID>
7+
</PropertyGroup>
8+
<PropertyGroup Label="Configuration">
9+
<Import_RootNamespace>SampleWebApi.Shared</Import_RootNamespace>
10+
</PropertyGroup>
11+
<ItemGroup>
12+
<Compile Include="$(MSBuildThisFileDirectory)Models\User.cs" />
13+
<Compile Include="$(MSBuildThisFileDirectory)Repositories\InMemoryUserRepository.cs" />
14+
<Compile Include="$(MSBuildThisFileDirectory)Repositories\IUserRepository.cs" />
15+
<Compile Include="$(MSBuildThisFileDirectory)Services\BasicUserValidationService.cs" />
16+
</ItemGroup>
17+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<ProjectGuid>e544fb20-29f3-41f5-a78e-6164f9c43b3c</ProjectGuid>
5+
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
6+
</PropertyGroup>
7+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
8+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
9+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
10+
<PropertyGroup />
11+
<Import Project="SampleWebApi.Shared.projitems" Label="Shared" />
12+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
13+
</Project>

SampleWebApi/Services/BasicUserValidationService.cs renamed to SampleWebApi.Shared/Services/BasicUserValidationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public async Task<bool> IsValidAsync(string username, string password)
2424
// NOTE: DO NOT USE THIS IMPLEMENTATION. THIS IS FOR DEMO PURPOSE ONLY
2525
// Write your implementation here and return true or false depending on the validation..
2626
var user = await _userRepository.GetUserByUsername(username);
27-
var isValid = user.Password == password;
27+
var isValid = user != null && user.Password == password;
2828
return isValid;
2929
}
3030
catch (Exception e)

SampleWebApi/SampleWebApi.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
12+
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
1313
<PackageReference Include="Mihir.AspNetCore.Authentication.Basic" Version="1.0.2" />
1414
</ItemGroup>
1515

1616
<ItemGroup>
1717
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
1818
</ItemGroup>
1919

20+
<Import Project="..\SampleWebApi.Shared\SampleWebApi.Shared.projitems" Label="Shared" />
21+
2022
</Project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
7+
namespace SampleWebApi_2_2.Controllers
8+
{
9+
[Route("api/[controller]")]
10+
[ApiController]
11+
public class ValuesController : ControllerBase
12+
{
13+
// GET api/values
14+
[HttpGet]
15+
public ActionResult<IEnumerable<string>> Get()
16+
{
17+
return new string[] { "value1", "value2" };
18+
}
19+
20+
// GET api/values/5
21+
[HttpGet("{id}")]
22+
public ActionResult<string> Get(int id)
23+
{
24+
return "value";
25+
}
26+
27+
// POST api/values
28+
[HttpPost]
29+
public void Post([FromBody] string value)
30+
{
31+
}
32+
33+
// PUT api/values/5
34+
[HttpPut("{id}")]
35+
public void Put(int id, [FromBody] string value)
36+
{
37+
}
38+
39+
// DELETE api/values/5
40+
[HttpDelete("{id}")]
41+
public void Delete(int id)
42+
{
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)