Persist external authentication in identity shell
This commit is contained in:
parent
0fa7657b30
commit
75a3216ae8
|
|
@ -14,6 +14,7 @@ public abstract class EFCoreIdentityPersistenceShellFeatureBase : PersistenceShe
|
|||
{
|
||||
protected override void OnConfiguring(IServiceCollection services)
|
||||
{
|
||||
services.AddExternalAuthenticationEntityFrameworkCore();
|
||||
services.AddScoped<IUserStore, EFCoreUserStore>();
|
||||
services.AddScoped<IApplicationStore, EFCoreApplicationStore>();
|
||||
services.AddScoped<IRoleStore, EFCoreRoleStore>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Elsa.ExternalAuthentication.Contracts;
|
||||
using Elsa.ExternalAuthentication.Services;
|
||||
using Elsa.Persistence.EFCore.Modules.ExternalAuthentication;
|
||||
using Elsa.Persistence.EFCore.Sqlite.ShellFeatures.Identity;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Elsa.ExternalAuthentication.IntegrationTests.Persistence;
|
||||
|
|
@ -17,4 +19,22 @@ public class ExternalAuthenticationPersistenceRegistrationTests
|
|||
Assert.IsType<HmacExternalAuthenticationHandleHasher>(
|
||||
serviceProvider.GetRequiredService<IExternalAuthenticationHandleHasher>());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SqliteIdentityShellFeatureUsesEntityFrameworkCoreForExternalAuthentication()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddExternalAuthenticationServices();
|
||||
|
||||
var feature = new SqliteIdentityPersistenceShellFeature
|
||||
{
|
||||
ConnectionString = "Data Source=:memory:"
|
||||
};
|
||||
feature.ConfigureServices(services);
|
||||
|
||||
var registration = services.Last(x => x.ServiceType == typeof(IIdentityProviderConnectionStore));
|
||||
|
||||
Assert.Equal(typeof(EFCoreIdentityProviderConnectionStore), registration.ImplementationType);
|
||||
Assert.Equal(ServiceLifetime.Scoped, registration.Lifetime);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue