Skip to content

Commit

Permalink
Merge pull request #140 from Aguafrommars/master
Browse files Browse the repository at this point in the history
4.1.0
  • Loading branch information
aguacongas authored Mar 11, 2022
2 parents 758fdcc + 83cde05 commit 9a92cc4
Show file tree
Hide file tree
Showing 20 changed files with 192 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: '5.0.100'
dotnet-version: 6.0.x
# Run update depencies script
- name: Update dependencies
run: ./update-dependencies.ps1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,4 @@ ASALocalRun/
coverage.*
/redis-64
/.sonarlint
/.dccache
7 changes: 3 additions & 4 deletions DymamicAuthProviders.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28315.86
# Visual Studio Version 17
VisualStudioVersion = 17.2.32210.308
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{245AA4AB-ECF4-4C69-B63D-C59D4B3F918C}"
EndProject
Expand All @@ -20,7 +20,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
build.ps1 = build.ps1
dotnet-install.ps1 = dotnet-install.ps1
dotnet-install.sh = dotnet-install.sh
global.json = global.json
LICENSE = LICENSE
NuGet.Config = NuGet.Config
publish.cmd = publish.cmd
Expand All @@ -46,7 +45,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aguacongas.AspNetCore.Authe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aguacongas.AspNetCore.Authentication.RavenDb", "src\Aguacongas.AspNetCore.Authentication.RavenDb\Aguacongas.AspNetCore.Authentication.RavenDb.csproj", "{227C6C5A-5297-4C02-938A-61BA88C42DEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aguacongas.AspNetCore.Authentication.RavenDb.Test", "test\Aguacongas.AspNetCore.Authentication.RavenDb.Test\Aguacongas.AspNetCore.Authentication.RavenDb.Test.csproj", "{50BA6357-C8CF-4E23-A27C-26406300D165}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aguacongas.AspNetCore.Authentication.RavenDb.Test", "test\Aguacongas.AspNetCore.Authentication.RavenDb.Test\Aguacongas.AspNetCore.Authentication.RavenDb.Test.csproj", "{50BA6357-C8CF-4E23-A27C-26406300D165}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
8 changes: 5 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ image:
environment:
GH_TOKEN:
secure: 0NJdORJRFjpB0dwUYv7bVNsbkldkoBhnvWik/CTOwAF/k9kP+/uTWMFnDcpEpt8E
donetsdk: 5.0.103
donetsdk: 6.0.200
JAVA_HOME: C:\Program Files\Java\jdk14
init:
- cmd: git config --global core.autocrlf true
Expand All @@ -27,10 +27,12 @@ install:
- sh: sudo chmod +x ./dotnet-install.sh
- sh: sudo ./dotnet-install.sh -Channel Current -Version $donetsdk -InstallDir ./dotnetsdk -NoPath
- sh: export PATH=/home/appveyor/projects/dymamicauthproviders/dotnetsdk:$PATH
- sh: sudo ./dotnet-install.sh -Channel Current -Version 5.0.404 -InstallDir ./dotnetsdk -NoPath
- sh: sudo apt -y install nuget
- ps: if ($isWindows) { .\dotnet-install.ps1 -Version $env:donetsdk }
- ps: if ($isWindows) { .\dotnet-install.ps1 -Version 5.0.404 }
- ps: dotnet tool install --global GitVersion.Tool
- ps: dotnet gitversion /l console /output buildserver
- ps: if ($isWindows) { .\dotnet-install.ps1 -Version $env:donetsdk }
- ps: dotnet tool install --global dotnet-sonarscanner
- cmd: set PATH=%JAVA_HOME%\bin;%PATH%
- cmd: nuget install redis-64 -excludeversion
Expand All @@ -48,7 +50,7 @@ artifacts:
deploy:
- provider: NuGet
api_key:
secure: HBPD3UCWOLjcV92x7rGXzAoc4v6pXTY9EOrniVg3ENacY0VVx2m8nEtG4cBi+qm7
secure: bvkKhXIKsDM1ThfcWTbuusND0sOBiDoJGOoD2fYijGoj4C9xx22QKfR7Y9q+j7eX
on:
branch:
- /preview\/*/
Expand Down
15 changes: 12 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ if ($isLinux) {
} elseif ($env:APPVEYOR_REPO_BRANCH) {
$prArgs = "-d:sonar.branch.name=$env:APPVEYOR_REPO_BRANCH"
}
dotnet sonarscanner begin /k:aguacongas_DymamicAuthProviders -o:aguacongas -d:sonar.host.url=https://sonarcloud.io -d:sonar.login=$env:sonarqube -d:sonar.coverageReportPaths=coverage\SonarQube.xml $prArgs -v:$env:Version

if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
dotnet sonarscanner begin /k:aguacongas_DymamicAuthProviders -o:aguacongas -d:sonar.host.url=https://sonarcloud.io -d:sonar.login=$env:sonarqube -d:sonar.coverageReportPaths=coverage\SonarQube.xml $prArgs -v:$env:Version
} elseif ($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -eq $env:APPVEYOR_REPO_NAME) {
dotnet sonarscanner begin /k:aguacongas_DymamicAuthProviders -o:aguacongas -d:sonar.host.url=https://sonarcloud.io -d:sonar.login=$env:sonarqube -d:sonar.coverageReportPaths=coverage\SonarQube.xml $prArgs -v:$env:Version
}

dotnet build -c Release

Expand All @@ -46,9 +51,13 @@ if ($isLinux) {
$merge = "$merge;$path"
}
Write-Host $merge
ReportGenerator\tools\netcoreapp3.0\ReportGenerator.exe "-reports:$merge" "-targetdir:coverage" "-reporttypes:SonarQube"
ReportGenerator\tools\net5.0\ReportGenerator.exe "-reports:$merge" "-targetdir:coverage" "-reporttypes:SonarQube"

dotnet sonarscanner end -d:sonar.login=$env:sonarqube
if (-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) {
dotnet sonarscanner end -d:sonar.login=$env:sonarqube
} elseif ($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -eq $env:APPVEYOR_REPO_NAME) {
dotnet sonarscanner end -d:sonar.login=$env:sonarqube
}
}
exit $result

Expand Down
5 changes: 0 additions & 5 deletions global.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<Authors>Olivier Lefebvre</Authors>
<Copyright>Copyright (c) 2018 @Olivier Lefebvre</Copyright>
Expand All @@ -14,12 +14,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.4" />
<PackageReference Include="Aguacongas.AspNetCore.Authentication.EntityFramework" Version="4.0.2" />
<PackageReference Include="Aguacongas.AspNetCore.Authentication.Redis" Version="4.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.3" />
<PackageReference Include="Aguacongas.AspNetCore.Authentication.EntityFramework" Version="4.0.3" />
<PackageReference Include="Aguacongas.AspNetCore.Authentication.Redis" Version="4.0.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Authors>Olivier Lefebvre</Authors>
<Copyright>Copyright (c) 2018 @Olivier Lefebvre</Copyright>
<PackageLicense>https://raw.githubusercontent.com/aguacongas/DymamicAuthProviders/master/LICENSE</PackageLicense>
Expand All @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="RavenDB.Client" Version="5.1.5" />
<PackageReference Include="RavenDB.Client" Version="5.3.100" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Authors>Olivier Lefebvre</Authors>
<Copyright>Copyright (c) 2018 @Olivier Lefebvre</Copyright>
<PackageLicenseUrl>https://raw.githubusercontent.com/aguacongas/DymamicAuthProviders/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/aguacongas/DymamicAuthProviders/tree/master/sample/Aguacongas.AspNetCore.Redis</PackageProjectUrl>
<RepositoryUrl>https://github.com/aguacongas/DymamicAuthProviders</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>aspnetcore;authentication;security;redis</PackageTags>
<Description>Provider for DinamicAuthProviders that uses Redis.</Description>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Authors>Olivier Lefebvre</Authors>
<Copyright>Copyright (c) 2018 @Olivier Lefebvre</Copyright>
<PackageLicenseUrl>https://raw.githubusercontent.com/aguacongas/DymamicAuthProviders/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/aguacongas/DymamicAuthProviders/tree/master/sample/Aguacongas.AspNetCore.Redis</PackageProjectUrl>
<RepositoryUrl>https://github.com/aguacongas/DymamicAuthProviders</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>aspnetcore;authentication;security;redis</PackageTags>
<Description>Provider for DinamicAuthProviders that uses Redis.</Description>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>C:\Projects\Perso\DymamicAuthProviders\src\Aguacongas.AspNetCore.Authentication.Redis\Aguacongas.AspNetCore.Authentication.Redis.xml</DocumentationFile>
<CodeAnalysisRuleSet>Aguacongas.AspNetCore.Authentication.Redis.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>C:\Projects\Perso\DymamicAuthProviders\src\Aguacongas.AspNetCore.Authentication.Redis\Aguacongas.AspNetCore.Authentication.Redis.xml</DocumentationFile>
<CodeAnalysisRuleSet>Aguacongas.AspNetCore.Authentication.Redis.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>C:\Projects\Perso\DymamicAuthProviders\src\Aguacongas.AspNetCore.Authentication.Redis\Aguacongas.AspNetCore.Authentication.Redis.xml</DocumentationFile>
<CodeAnalysisRuleSet>Aguacongas.AspNetCore.Authentication.Redis.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>C:\Projects\Perso\DymamicAuthProviders\src\Aguacongas.AspNetCore.Authentication.Redis\Aguacongas.AspNetCore.Authentication.Redis.xml</DocumentationFile>
<CodeAnalysisRuleSet>Aguacongas.AspNetCore.Authentication.Redis.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StackExchange.Redis.StrongName" Version="1.2.7-alpha-00002" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Aguacongas.AspNetCore.Authentication\Aguacongas.AspNetCore.Authentication.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aguacongas.AspNetCore.Authentication\Aguacongas.AspNetCore.Authentication.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Authors>Olivier Lefebvre</Authors>
<Copyright>Copyright (c) 2018 @Olivier Lefebvre</Copyright>
<PackageLicense>https://raw.githubusercontent.com/aguacongas/DymamicAuthProviders/master/LICENSE</PackageLicense>
Expand All @@ -10,6 +10,7 @@
<RepositoryType>git</RepositoryType>
<PackageTags>aspnetcore;authentication;security;test</PackageTags>
<IsPackable>true</IsPackable>
<IsTestProject>false</IsTestProject>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand All @@ -26,19 +27,19 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OAuth" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.WsFederation" Version="5.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="6.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.WsFederation" Version="6.0.3" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="xunit.analyzers" Version="0.10.0" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="xunit.core" Version="2.4.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OAuth" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,55 @@
using System;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;

namespace Aguacongas.AspNetCore.Authentication
{
/// <summary>
/// Converter For x509 Data
/// </summary>
public class X509Certificate2JsonConverter : JsonConverter
{
/// <summary>
/// Is the object fed to this a match for our converter type.
/// </summary>
/// <param name="objectType"></param>
/// <returns></returns>
public override bool CanConvert(Type objectType)
{
return objectType == typeof(X509Certificate2);
}

/// <summary>
/// Read method.
/// </summary>
/// <param name="reader"></param>
/// <param name="objectType"></param>
/// <param name="existingValue"></param>
/// <param name="serializer"></param>
/// <returns></returns>
public override object ReadJson(JsonReader reader,
Type objectType, object existingValue, JsonSerializer serializer)
{
var deserializedRaw = serializer.Deserialize<byte[]>(reader);
var deserialized = new X509Certificate2(deserializedRaw);
return deserialized;
}

/// <summary>
/// Write method.
/// </summary>
/// <param name="writer"></param>
/// <param name="value"></param>
/// <param name="serializer"></param>
public override void WriteJson(JsonWriter writer,
object value, JsonSerializer serializer)
{
byte[] certData = ((X509Certificate2)value).Export(X509ContentType.Pfx);
serializer.Serialize(writer, certData);
}
}

/// <summary>
/// Manage <see cref="AuthenticationSchemeOptions"/> serialization.
/// </summary>
Expand All @@ -27,7 +73,11 @@ public class AuthenticationSchemeOptionsSerializer : IAuthenticationSchemeOption
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
Formatting = Formatting.None,
DefaultValueHandling = DefaultValueHandling.Include,
ContractResolver = new ContractResolver()
ContractResolver = new ContractResolver(),
Converters =
{
new X509Certificate2JsonConverter()
}
};

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<DebugType>Full</DebugType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.0.3">
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public async Task Assertions()

class FakeDbContextOptions : DbContextOptions
{
public FakeDbContextOptions() : base(new Mock<IReadOnlyDictionary<Type, IDbContextOptionsExtension>>().Object)
public FakeDbContextOptions() : base(new Dictionary<Type, IDbContextOptionsExtension>())
{
}

Expand Down
Loading

0 comments on commit 9a92cc4

Please sign in to comment.