diff --git a/README.md b/README.md
index 9e79e40..cb09aba 100644
--- a/README.md
+++ b/README.md
@@ -7,10 +7,10 @@ Store and manage Microsoft.AspNetCore.Authentication providers.
Nuget packages
--------------
-|Aguacongas.AspNetCore.Authentication|Aguacongas.AspNetCore.Authentication.EntityFramework|Aguacongas.AspNetCore.Authentication.TestBase|
-|:------:|:------:|:------:|
-|[![][Aguacongas.AspNetCore.Authentication-badge]][Aguacongas.AspNetCore.Authentication-nuget]|[![][Aguacongas.AspNetCore.Authentication.EntityFramework-badge]][Aguacongas.AspNetCore.Authentication.EntityFramework-nuget]|[![][Aguacongas.AspNetCore.Authentication.TestBase-badge]][Aguacongas.AspNetCore.Authentication.TestBase-nuget]|
-|[![][Aguacongas.AspNetCore.Authentication-downloadbadge]][Aguacongas.AspNetCore.Authentication-nuget]|[![][Aguacongas.AspNetCore.Authentication.EntityFramework-downloadbadge]][Aguacongas.AspNetCore.Authentication.EntityFramework-nuget]|[![][Aguacongas.AspNetCore.Authentication.TestBase-downloadbadge]][Aguacongas.AspNetCore.Authentication.TestBase-nuget]|
+|Dynamic Provider|EntityFramework Store|Redis Store|Tests Suite|
+|:------:|:------:|:------:|:------:|
+|[![][Aguacongas.AspNetCore.Authentication-badge]][Aguacongas.AspNetCore.Authentication-nuget]|[![][Aguacongas.AspNetCore.Authentication.EntityFramework-badge]][Aguacongas.AspNetCore.Authentication.EntityFramework-nuget]|[![][Aguacongas.AspNetCore.Authentication.Redis-badge]][Aguacongas.AspNetCore.Authentication.Redis-nuget]|[![][Aguacongas.AspNetCore.Authentication.TestBase-badge]][Aguacongas.AspNetCore.Authentication.TestBase-nuget]|
+|[![][Aguacongas.AspNetCore.Authentication-downloadbadge]][Aguacongas.AspNetCore.Authentication-nuget]|[![][Aguacongas.AspNetCore.Authentication.EntityFramework-downloadbadge]][Aguacongas.AspNetCore.Authentication.EntityFramework-nuget]|[![][Aguacongas.AspNetCore.Authentication.Redis-downloadbadge]][Aguacongas.AspNetCore.Authentication.Redis-nuget]|[![][Aguacongas.AspNetCore.Authentication.TestBase-downloadbadge]][Aguacongas.AspNetCore.Authentication.TestBase-nuget]|
[Aguacongas.AspNetCore.Authentication-badge]: https://img.shields.io/nuget/v/Aguacongas.AspNetCore.Authentication.svg
[Aguacongas.AspNetCore.Authentication-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.AspNetCore.Authentication.svg
@@ -20,6 +20,10 @@ Nuget packages
[Aguacongas.AspNetCore.Authentication.EntityFramework-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.AspNetCore.Authentication.EntityFramework.svg
[Aguacongas.AspNetCore.Authentication.EntityFramework-nuget]: https://www.nuget.org/packages/Aguacongas.AspNetCore.Authentication.EntityFramework/
+[Aguacongas.AspNetCore.Authentication.Redis-badge]: https://img.shields.io/nuget/v/Aguacongas.AspNetCore.Authentication.Redis.svg
+[Aguacongas.AspNetCore.Authentication.Redis-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.AspNetCore.Authentication.Redis.svg
+[Aguacongas.AspNetCore.Authentication.Redis-nuget]: https://www.nuget.org/packages/Aguacongas.AspNetCore.Authentication.Redis/
+
[Aguacongas.AspNetCore.Authentication.TestBase-badge]: https://img.shields.io/nuget/v/Aguacongas.AspNetCore.Authentication.TestBase.svg
[Aguacongas.AspNetCore.Authentication.TestBase-downloadbadge]: https://img.shields.io/nuget/dt/Aguacongas.AspNetCore.Authentication.TestBase.svg
[Aguacongas.AspNetCore.Authentication.TestBase-nuget]: https://www.nuget.org/packages/Aguacongas.AspNetCore.Authentication.TestBase/
diff --git a/appveyor.yml b/appveyor.yml
index 306293e..01737a4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -15,53 +15,53 @@ environment:
GH_TOKEN:
secure: 0NJdORJRFjpB0dwUYv7bVNsbkldkoBhnvWik/CTOwAF/k9kP+/uTWMFnDcpEpt8E
init:
- - cmd: git config --global core.autocrlf true
+ - cmd: git config --global core.autocrlf true
install:
- - sh: wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
- - sh: sudo dpkg -i packages-microsoft-prod.deb
- - sh: sudo apt-get -y install apt-transport-https
- - sh: sudo apt-get update
- - sh: sudo apt-get -y install dotnet-sdk-2.2
- - sh: sudo apt -y install nuget
- - sh: nuget install GitVersion.CommandLine -ExcludeVersion
- - sh: mono GitVersion.CommandLine/tools/GitVersion.exe /l console /output buildserver
- - ps: if ($isWindows) { .\dotnet-install.ps1 -Version 2.2.100 }
- - cmd: nuget install redis-64 -excludeversion
- - cmd: redis-64\tools\redis-server.exe --service-install
- - cmd: redis-64\tools\redis-server.exe --service-start
- - cmd: gitversion /l console /output buildserver
- - cmd: nuget install ReportGenerator -ExcludeVersion
- - ps: ./appveyorinit.ps1
+ - sh: wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
+ - sh: sudo dpkg -i packages-microsoft-prod.deb
+ - sh: sudo apt-get -y install apt-transport-https
+ - sh: sudo apt-get update
+ - sh: sudo apt-get -y install dotnet-sdk-2.2
+ - sh: sudo apt -y install nuget
+ - sh: nuget install GitVersion.CommandLine -ExcludeVersion
+ - sh: mono GitVersion.CommandLine/tools/GitVersion.exe /l console /output buildserver
+ - ps: if ($isWindows) { .\dotnet-install.ps1 -Version 2.2.100 }
+ - cmd: nuget install redis-64 -excludeversion
+ - cmd: redis-64\tools\redis-server.exe --service-install
+ - cmd: redis-64\tools\redis-server.exe --service-start
+ - cmd: gitversion /l console /output buildserver
+ - cmd: nuget install ReportGenerator -ExcludeVersion
+ - ps: ./appveyorinit.ps1
build_script:
- - ps: ./build.ps1
+ - ps: ./build.ps1
test_script:
- - cmd: publish.cmd
+ - cmd: publish.cmd
artifacts:
- - path: artifacts/**/*.nupkg
- name: nuget
+ - path: artifacts/**/*.nupkg
+ name: nuget
deploy:
- - provider: NuGet
- api_key:
- secure: 23wPDdRicGt2vZuJ8vd9TRBKmqjHkx5WjzZmKvyxd5j0fNPedjUScRTj/rT0ObJa
- on:
- branch:
- - /preview\/*/
- - /release\/*/
- CI_WINDOWS: true
- - provider: GitHub
- auth_token: $(GH_TOKEN)
- draft: true
- prerelease: true
- release: $(Version)
- on:
- branch:
- - /preview*/
- CI_WINDOWS: true
+ - provider: NuGet
+ api_key:
+ secure: 23wPDdRicGt2vZuJ8vd9TRBKmqjHkx5WjzZmKvyxd5j0fNPedjUScRTj/rT0ObJa
+ on:
+ branch:
+ - /preview\/*/
+ - /release\/*/
+ CI_WINDOWS: true
+ - provider: GitHub
+ auth_token: $(GH_TOKEN)
+ draft: true
+ prerelease: true
+ release: $(Version)
+ on:
+ branch:
+ - /preview*/
+ CI_WINDOWS: true
for:
-
branches:
only:
- - master
+ - master
on_success:
- cmd: git config --global credential.helper store
- ps: if ($isWindows) { Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GH_TOKEN):x-oauth-basic@github.com`n" }
@@ -77,21 +77,17 @@ for:
-
branches:
only:
- - /release>\/*/
+ - /release>\/*/
on_success:
- - cmd: semantic-release -b %APPVEYOR_REPO_BRANCH%
- - cmd: git config --global credential.helper store
- - ps: if ($isWindows) { Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GH_TOKEN):x-oauth-basic@github.com`n" }
- - cmd: git config --global user.email "aguacongas@gmail.com"
- - cmd: git config --global user.name "Aguacongas"
- - cmd: git checkout gh-pages
- - cmd: git stash
- - cmd: mkdir %Version%
- - cmd: move coverage\docs %Version%
- - cmd: git add %Version%
- - cmd: git commit %Version% -m "Appveyor build succed %APPVEYOR_BUILD_NUMBER%"
- - cmd: git push
--
- branches:
- except:
- - master
+ - cmd: semantic-release -b %APPVEYOR_REPO_BRANCH%
+ - cmd: git config --global credential.helper store
+ - ps: if ($isWindows) { Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:GH_TOKEN):x-oauth-basic@github.com`n" }
+ - cmd: git config --global user.email "aguacongas@gmail.com"
+ - cmd: git config --global user.name "Aguacongas"
+ - cmd: git checkout gh-pages
+ - cmd: git stash
+ - cmd: mkdir %Version%
+ - cmd: move coverage\docs %Version%
+ - cmd: git add %Version%
+ - cmd: git commit %Version% -m "Appveyor build succed %APPVEYOR_BUILD_NUMBER%"
+ - cmd: git push
diff --git a/sample/Aguacongas.AspNetCore.Authentication.Sample/Aguacongas.AspNetCore.Authentication.Sample.csproj b/sample/Aguacongas.AspNetCore.Authentication.Sample/Aguacongas.AspNetCore.Authentication.Sample.csproj
index f6a2d75..5980ae5 100644
--- a/sample/Aguacongas.AspNetCore.Authentication.Sample/Aguacongas.AspNetCore.Authentication.Sample.csproj
+++ b/sample/Aguacongas.AspNetCore.Authentication.Sample/Aguacongas.AspNetCore.Authentication.Sample.csproj
@@ -12,13 +12,12 @@
aspnetcore authentication security sample
-
+
-
diff --git a/sample/Aguacongas.AspNetCore.Authentication.Sample/Controllers/HomeController.cs b/sample/Aguacongas.AspNetCore.Authentication.Sample/Controllers/HomeController.cs
index e02a67b..1507de8 100644
--- a/sample/Aguacongas.AspNetCore.Authentication.Sample/Controllers/HomeController.cs
+++ b/sample/Aguacongas.AspNetCore.Authentication.Sample/Controllers/HomeController.cs
@@ -1,5 +1,6 @@
// Project: aguacongas/DymamicAuthProviders
// Copyright (c) 2018 @Olivier Lefebvre
+using Aguacongas.AspNetCore.Authentication.EntityFramework;
using Aguacongas.AspNetCore.Authentication.Sample.Helpers;
using Aguacongas.AspNetCore.Authentication.Sample.Models;
using Microsoft.AspNetCore.Authentication;
diff --git a/sample/Aguacongas.AspNetCore.Authentication.Sample/SchemeChangeSubscriberSample.cs b/sample/Aguacongas.AspNetCore.Authentication.Sample/SchemeChangeSubscriberSample.cs
index d87285b..13fa660 100644
--- a/sample/Aguacongas.AspNetCore.Authentication.Sample/SchemeChangeSubscriberSample.cs
+++ b/sample/Aguacongas.AspNetCore.Authentication.Sample/SchemeChangeSubscriberSample.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using Aguacongas.AspNetCore.Authentication.EntityFramework;
+using System.Threading.Tasks;
namespace Aguacongas.AspNetCore.Authentication.Sample
{
diff --git a/src/Aguacongas.AspNetCore.Authentication.EntityFramework/Aguacongas.AspNetCore.Authentication.EntityFramework.csproj b/src/Aguacongas.AspNetCore.Authentication.EntityFramework/Aguacongas.AspNetCore.Authentication.EntityFramework.csproj
index 954bee9..05c93f5 100644
--- a/src/Aguacongas.AspNetCore.Authentication.EntityFramework/Aguacongas.AspNetCore.Authentication.EntityFramework.csproj
+++ b/src/Aguacongas.AspNetCore.Authentication.EntityFramework/Aguacongas.AspNetCore.Authentication.EntityFramework.csproj
@@ -9,9 +9,8 @@
https://github.com/aguacongas/DymamicAuthProviders
git
aspnetcore;authentication;security;entityframeworkcore
- Provider for DinamicAuthProviders that uses Entity Framework Core.
+ Provider for DinamicAuthProviders that uses Entity Framework Core.
Full
-
diff --git a/src/Aguacongas.AspNetCore.Authentication.EntityFramework/ApplicationBuilderExtensions.cs b/src/Aguacongas.AspNetCore.Authentication.EntityFramework/ApplicationBuilderExtensions.cs
new file mode 100644
index 0000000..7e9fff8
--- /dev/null
+++ b/src/Aguacongas.AspNetCore.Authentication.EntityFramework/ApplicationBuilderExtensions.cs
@@ -0,0 +1,23 @@
+// Project: aguacongas/DymamicAuthProviders
+// Copyright (c) 2018 @Olivier Lefebvre
+using Aguacongas.AspNetCore.Authentication.EntityFramework;
+
+namespace Microsoft.AspNetCore.Builder
+{
+ ///
+ /// IApplicationBuilder extensions
+ ///
+ public static class ApplicationBuilderExtensions
+ {
+ ///
+ /// Loads the dynamic authentication configuration.
+ ///
+ /// The builder.
+ ///
+ public static IApplicationBuilder LoadDynamicAuthenticationConfiguration(this IApplicationBuilder builder)
+ {
+ builder.ApplicationServices.LoadDynamicAuthenticationConfiguration();
+ return builder;
+ }
+ }
+}
diff --git a/src/Aguacongas.AspNetCore.Authentication.EntityFramework/SchemeDefinition.cs b/src/Aguacongas.AspNetCore.Authentication.EntityFramework/SchemeDefinition.cs
index bf32a5f..0020ec7 100644
--- a/src/Aguacongas.AspNetCore.Authentication.EntityFramework/SchemeDefinition.cs
+++ b/src/Aguacongas.AspNetCore.Authentication.EntityFramework/SchemeDefinition.cs
@@ -1,6 +1,6 @@
// Project: aguacongas/DymamicAuthProviders
// Copyright (c) 2018 @Olivier Lefebvre
-namespace Aguacongas.AspNetCore.Authentication
+namespace Aguacongas.AspNetCore.Authentication.EntityFramework
{
///
/// Scheme definition for entity framework store
diff --git a/src/Aguacongas.AspNetCore.Authentication.Redis/Aguacongas.AspNetCore.Authentication.Redis.csproj b/src/Aguacongas.AspNetCore.Authentication.Redis/Aguacongas.AspNetCore.Authentication.Redis.csproj
index 7996fd2..9080508 100644
--- a/src/Aguacongas.AspNetCore.Authentication.Redis/Aguacongas.AspNetCore.Authentication.Redis.csproj
+++ b/src/Aguacongas.AspNetCore.Authentication.Redis/Aguacongas.AspNetCore.Authentication.Redis.csproj
@@ -1,7 +1,15 @@
-
+
netstandard2.0
+ Olivier Lefebvre
+ Copyright (c) 2018 @Olivier Lefebvre
+ https://raw.githubusercontent.com/aguacongas/DymamicAuthProviders/master/LICENSE
+ https://github.com/aguacongas/DymamicAuthProviders/tree/master/sample/Aguacongas.AspNetCore.Redis
+ https://github.com/aguacongas/DymamicAuthProviders
+ git
+ aspnetcore;authentication;security;redis
+ Provider for DinamicAuthProviders that uses Redis.
diff --git a/src/Aguacongas.AspNetCore.Authentication.Redis/ApplicationBuilderExtensions.cs b/src/Aguacongas.AspNetCore.Authentication.Redis/ApplicationBuilderExtensions.cs
new file mode 100644
index 0000000..58280ff
--- /dev/null
+++ b/src/Aguacongas.AspNetCore.Authentication.Redis/ApplicationBuilderExtensions.cs
@@ -0,0 +1,23 @@
+// Project: aguacongas/DymamicAuthProviders
+// Copyright (c) 2018 @Olivier Lefebvre
+using Aguacongas.AspNetCore.Authentication.Redis;
+
+namespace Microsoft.AspNetCore.Builder
+{
+ ///
+ /// IApplicationBuilder extensions
+ ///
+ public static class ApplicationBuilderExtensions
+ {
+ ///
+ /// Loads the dynamic authentication configuration.
+ ///
+ /// The builder.
+ ///
+ public static IApplicationBuilder LoadDynamicAuthenticationConfiguration(this IApplicationBuilder builder)
+ {
+ builder.ApplicationServices.LoadDynamicAuthenticationConfiguration();
+ return builder;
+ }
+ }
+}
diff --git a/src/Aguacongas.AspNetCore.Authentication.TestBase/DynamicManagerTestBase.cs b/src/Aguacongas.AspNetCore.Authentication.TestBase/DynamicManagerTestBase.cs
index e5d014c..6ed5d4d 100644
--- a/src/Aguacongas.AspNetCore.Authentication.TestBase/DynamicManagerTestBase.cs
+++ b/src/Aguacongas.AspNetCore.Authentication.TestBase/DynamicManagerTestBase.cs
@@ -465,44 +465,6 @@ Task onTicketReceived(TicketReceivedContext context)
Assert.True(eventCalled);
}
- ///
- /// AddAsync method should ensure uniq callback path.
- ///
- ///
- [Fact]
- public async Task AddAsync_should_ensure_uniq_callback_path()
- {
- var provider = CreateServiceProvider(options =>
- {
- options.AddTwitter();
- });
-
- var twittertOptions = new TwitterOptions
- {
- ConsumerKey = "test",
- ConsumerSecret = "test"
- };
-
- var scheme = Guid.NewGuid().ToString();
- var definition = new TSchemeDefinition
- {
- Scheme = scheme,
- DisplayName = "test",
- HandlerType = typeof(TwitterHandler),
- Options = twittertOptions
- };
-
- var sut = provider.GetRequiredService>();
- Assert.Contains(typeof(TwitterHandler), sut.ManagedHandlerType);
-
- await sut.AddAsync(definition);
- var state = await VerifyAddedAsync(scheme, provider);
-
- definition.Scheme = Guid.NewGuid().ToString();
-
- await Assert.ThrowsAsync(() => sut.AddAsync(definition));
- }
-
///
/// AddAsync method should add ws federation handler.
///
diff --git a/src/Aguacongas.AspNetCore.Authentication/DynamicAuthenticationBuilder.cs b/src/Aguacongas.AspNetCore.Authentication/DynamicAuthenticationBuilder.cs
index bfb79a1..d27c18f 100644
--- a/src/Aguacongas.AspNetCore.Authentication/DynamicAuthenticationBuilder.cs
+++ b/src/Aguacongas.AspNetCore.Authentication/DynamicAuthenticationBuilder.cs
@@ -43,24 +43,6 @@ public DynamicAuthenticationBuilder(IServiceCollection services, Type definition
DefinitionType = definitionType;
}
- ///
- /// Adds a based that supports remote authentication
- /// which can be used by .
- ///
- /// The type to configure the handler."/>.
- /// The used to handle this scheme.
- /// The name of this scheme.
- /// The display name of this scheme.
- /// Used to configure the scheme options.
- ///
- /// The builder.
- ///
- public override AuthenticationBuilder AddRemoteScheme(string authenticationScheme, string displayName, Action configureOptions)
- {
- Services.TryAddEnumerable(ServiceDescriptor.Singleton, EnsureUniqCallbackPath>());
- return base.AddRemoteScheme(authenticationScheme, displayName, configureOptions);
- }
-
///
/// Adds a which can be used by .
///
@@ -88,34 +70,5 @@ public override AuthenticationBuilder AddScheme(string authe
);
return this;
}
-
- private class EnsureUniqCallbackPath : IPostConfigureOptions where TOptions : RemoteAuthenticationOptions
- {
- private readonly IAuthenticationSchemeProvider _schemeProvider;
- private readonly IOptionsMonitorCache _monitorCache;
-
- public EnsureUniqCallbackPath(IAuthenticationSchemeProvider schemeProvider, IOptionsMonitorCache monitorCache)
- {
- _schemeProvider = schemeProvider;
- _monitorCache = monitorCache;
- }
-
- public void PostConfigure(string name, TOptions options)
- {
- var schemes = _schemeProvider.GetAllSchemesAsync().GetAwaiter().GetResult();
- foreach(var scheme in schemes)
- {
- if (name == scheme.Name)
- {
- continue;
- }
- var other = _monitorCache.GetOrAdd(scheme.Name, () => options);
- if (other is RemoteAuthenticationOptions otherRemote && otherRemote.CallbackPath == options.CallbackPath)
- {
- throw new InvalidOperationException($"Callbacks paths for schemes {name} and {scheme.Name} are equals: {options.CallbackPath}");
- }
- }
- }
- }
}
}
diff --git a/src/Aguacongas.AspNetCore.Authentication/DynamicManager.cs b/src/Aguacongas.AspNetCore.Authentication/DynamicManager.cs
index 933a291..1c4f443 100644
--- a/src/Aguacongas.AspNetCore.Authentication/DynamicManager.cs
+++ b/src/Aguacongas.AspNetCore.Authentication/DynamicManager.cs
@@ -103,9 +103,6 @@ public virtual Task FindBySchemeAsync(string scheme)
///
public virtual void Load()
{
- var platform = Environment.OSVersion.Platform.ToString();
- var runtimeAssemblyNames = DependencyContext.Default.GetRuntimeAssemblyNames(platform);
-
foreach (var definition in _store.SchemeDefinitions)
{
if (ManagedHandlerType.Contains(definition.HandlerType))