Skip to content

Commit cc16a19

Browse files
authored
Merge pull request #6 from mihirdilip/5.1.0
5.1.0
2 parents 9a0b17b + 7e0c305 commit cc16a19

26 files changed

+2557
-58
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Mihir Dilip
3+
Copyright (c) 2021 Mihir Dilip
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 130 additions & 37 deletions
Large diffs are not rendered by default.

samples/SampleWebApi_2_0/SampleWebApi_2_0.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.0.0" />
15+
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.1.0" />
1616
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.9" />
1717
</ItemGroup>
1818

samples/SampleWebApi_2_2/SampleWebApi_2_2.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.0.0" />
9+
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.1.0" />
1010
<PackageReference Include="Microsoft.AspNetCore.App" />
1111
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
1212
</ItemGroup>

samples/SampleWebApi_3_1/SampleWebApi_3_1.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Import Project="..\SampleWebApi.Shared\SampleWebApi.Shared.projitems" Label="Shared" />
88

99
<ItemGroup>
10-
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.0.0" />
10+
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.1.0" />
1111
</ItemGroup>
1212

1313
<!--<ItemGroup>

samples/SampleWebApi_5_0/SampleWebApi_5_0.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Import Project="..\SampleWebApi.Shared\SampleWebApi.Shared.projitems" Label="Shared" />
88

99
<ItemGroup>
10-
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.0.0" />
10+
<PackageReference Include="AspNetCore.Authentication.Basic" Version="5.1.0" />
1111
</ItemGroup>
1212

1313
<!--<ItemGroup>

src/AspNetCore.Authentication.Basic.sln

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleWebApi_2_0", "..\samp
2222
EndProject
2323
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleWebApi_3_1", "..\samples\SampleWebApi_3_1\SampleWebApi_3_1.csproj", "{2705DB4C-3BCE-4CFC-9A30-B4BFD1F28C56}"
2424
EndProject
25-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebApi_5_0", "..\samples\SampleWebApi_5_0\SampleWebApi_5_0.csproj", "{B82830A0-FDFC-469D-B2A8-D657CD216451}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleWebApi_5_0", "..\samples\SampleWebApi_5_0\SampleWebApi_5_0.csproj", "{B82830A0-FDFC-469D-B2A8-D657CD216451}"
26+
EndProject
27+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F7494366-ED1D-4342-AE5D-DD6BE67C63DF}"
28+
EndProject
29+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetCore.Authentication.Basic.Tests", "..\test\AspNetCore.Authentication.Basic.Tests\AspNetCore.Authentication.Basic.Tests.csproj", "{335B0D1F-A428-4D2E-AF87-269C75F5F138}"
2630
EndProject
2731
Global
2832
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -57,6 +61,10 @@ Global
5761
{B82830A0-FDFC-469D-B2A8-D657CD216451}.Debug|Any CPU.Build.0 = Debug|Any CPU
5862
{B82830A0-FDFC-469D-B2A8-D657CD216451}.Release|Any CPU.ActiveCfg = Release|Any CPU
5963
{B82830A0-FDFC-469D-B2A8-D657CD216451}.Release|Any CPU.Build.0 = Release|Any CPU
64+
{335B0D1F-A428-4D2E-AF87-269C75F5F138}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65+
{335B0D1F-A428-4D2E-AF87-269C75F5F138}.Debug|Any CPU.Build.0 = Debug|Any CPU
66+
{335B0D1F-A428-4D2E-AF87-269C75F5F138}.Release|Any CPU.ActiveCfg = Release|Any CPU
67+
{335B0D1F-A428-4D2E-AF87-269C75F5F138}.Release|Any CPU.Build.0 = Release|Any CPU
6068
EndGlobalSection
6169
GlobalSection(SolutionProperties) = preSolution
6270
HideSolutionNode = FALSE
@@ -67,6 +75,7 @@ Global
6775
{897E5C9C-8C0A-4FB6-960C-4D11AAFD4491} = {CF13271D-BF3F-4167-BEBA-DD02D33992F2}
6876
{2705DB4C-3BCE-4CFC-9A30-B4BFD1F28C56} = {CF13271D-BF3F-4167-BEBA-DD02D33992F2}
6977
{B82830A0-FDFC-469D-B2A8-D657CD216451} = {CF13271D-BF3F-4167-BEBA-DD02D33992F2}
78+
{335B0D1F-A428-4D2E-AF87-269C75F5F138} = {F7494366-ED1D-4342-AE5D-DD6BE67C63DF}
7079
EndGlobalSection
7180
GlobalSection(ExtensibilityGlobals) = postSolution
7281
SolutionGuid = {70815049-1680-480A-BF5A-00536D6C9C20}

src/AspNetCore.Authentication.Basic/AspNetCore.Authentication.Basic.csproj

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>net5.0;netcoreapp3.1;netcoreapp3.0;netstandard2.0;net461</TargetFrameworks>
5-
<Version>5.0.0</Version>
5+
<Version>5.1.0</Version>
66
<RepositoryUrl>https://github.com/mihirdilip/aspnetcore-authentication-basic/tree/$(Version)</RepositoryUrl>
77
<PackageProjectUrl>https://github.com/mihirdilip/aspnetcore-authentication-basic/tree/$(Version)</PackageProjectUrl>
88
<PackageTags>aspnetcore, security, authentication, microsoft, microsoft.aspnetcore.authentication, microsoft-aspnetcore-authentication, microsoft.aspnetcore.authentication.basic, microsoft-aspnetcore-authentication-basic, asp-net-core, netstandard, netstandard20, basic-authentication, basicauthentication, dotnetcore, dotnetcore3.1, net5, net5.0, asp-net-core-basic-authentication, aspnetcore-basic-authentication, net5-basic-authentication, asp-net-core-authentication, aspnetcore-authentication, net5-authentication, asp, aspnet, basic, authentication-scheme</PackageTags>
9-
<PackageReleaseNotes>- .Net 5.0 target framework added
10-
- IgnoreAuthenticationIfAllowAnonymous added to the BasicOptions from netcoreapp3.0 onwards
9+
<PackageReleaseNotes>- Visibility of all the handlers changed to public
1110
</PackageReleaseNotes>
1211
<Description>Easy to use and very light weight Microsoft style Basic Scheme Authentication implementation for ASP.NET Core.</Description>
1312
<Authors>Mihir Dilip</Authors>
1413
<Company>Mihir Dilip</Company>
15-
<Copyright>Copyright (c) 2020 Mihir Dilip</Copyright>
14+
<Copyright>Copyright (c) 2021 Mihir Dilip</Copyright>
1615
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1716
<Title>$(AssemblyName)</Title>
1817
<RepositoryType>git</RepositoryType>
@@ -44,6 +43,14 @@
4443
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
4544
</ItemGroup>
4645

46+
<ItemGroup>
47+
<!-- Unit Testing - To make internal visible to tests -->
48+
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
49+
<_Parameter1>
50+
$(MSBuildProjectName).Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100196de3cf1767e4651bd29928a1dfdc149897770adb2439fd0f42a480f0f0c955606d6e6cae87cbdcdfbd1686ec7775789b82fa869387c31dcc740991f3d3d2db407b0a28d772fe343cdf8f1b12ee53bb625aee854f56e0be93f11c307c0dbc54aad277111fc04db0eed2513a20d5663c50412afd34e8c8fb98459d8f4d90e5b6</_Parameter1>
51+
</AssemblyAttribute>
52+
</ItemGroup>
53+
4754
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
4855
<DocumentationFile>bin\Release\$(TargetFramework)\AspNetCore.Authentication.Basic.xml</DocumentationFile>
4956
</PropertyGroup>

src/AspNetCore.Authentication.Basic/BasicHandler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace AspNetCore.Authentication.Basic
1818
/// <summary>
1919
/// Inherited from <see cref="AuthenticationHandler{TOptions}"/> for basic authentication.
2020
/// </summary>
21-
internal class BasicHandler : AuthenticationHandler<BasicOptions>
21+
public class BasicHandler : AuthenticationHandler<BasicOptions>
2222
{
2323
/// <summary>
2424
/// Basic Handler Constructor.
@@ -253,9 +253,9 @@ private BasicCredentials DecodeBasicCredentials(string credentials)
253253
username = usernameAndPasswordSplit[0];
254254
password = usernameAndPasswordSplit[1];
255255
}
256-
catch (Exception)
256+
catch (Exception e)
257257
{
258-
throw new Exception($"Problem decoding '{BasicDefaults.AuthenticationScheme}' scheme credentials.");
258+
throw new Exception($"Problem decoding '{BasicDefaults.AuthenticationScheme}' scheme credentials.", e);
259259
}
260260

261261
if (string.IsNullOrWhiteSpace(username))

src/AspNetCore.Authentication.Basic/BasicPostConfigureOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void PostConfigure(string name, BasicOptions options)
1515
{
1616
if (!options.SuppressWWWAuthenticateHeader && string.IsNullOrWhiteSpace(options.Realm))
1717
{
18-
throw new InvalidOperationException("Realm must be set in basic options");
18+
throw new InvalidOperationException($"{nameof(BasicOptions.Realm)} must be set in {typeof(BasicOptions).Name} when setting up the authentication.");
1919
}
2020

2121
if (options.Events?.OnValidateCredentials == null && options.EventsType == null && options.BasicUserValidationServiceType == null)

0 commit comments

Comments
 (0)