fix(AuthClientTests): Abhängigkeiten hinzufügen
This commit is contained in:
parent
b2a287cab5
commit
6664a1f342
@ -1,6 +1,9 @@
|
||||
using DigitalData.Auth.Abstractions;
|
||||
using DigitalData.Auth.API.Hubs;
|
||||
using DigitalData.Auth.Client;
|
||||
using DigitalData.Core.Security;
|
||||
using DigitalData.Core.Security.Config;
|
||||
using DigitalData.Core.Security.RSAKey;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
@ -49,6 +52,12 @@ public class AuthClientTests
|
||||
// Create builder and add SignalR service
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
builder.Services.AddSignalR();
|
||||
builder.Services.AddCryptoFactory(new CryptoFactoryParams()
|
||||
{
|
||||
PemDirectory = "/",
|
||||
Decryptors = [new RSADecryptor()]
|
||||
});
|
||||
builder.Services.AddMemoryCache();
|
||||
|
||||
// Listen AvailablePort and map hub
|
||||
var _app = builder.Build();
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="DigitalData.Core.Security" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
|
||||
|
||||
@ -15,7 +15,7 @@ public class AuthHub : Hub<IAuthListenHandler>, IAuthSenderHandler
|
||||
|
||||
private readonly static string CacheId = Guid.NewGuid().ToString();
|
||||
|
||||
public AuthHub(ICryptoFactory cryptoFactory, ILogger logger, IMemoryCache cache)
|
||||
public AuthHub(ICryptoFactory cryptoFactory, ILogger<AuthHub> logger, IMemoryCache cache)
|
||||
{
|
||||
_cFactory = cryptoFactory;
|
||||
_logger = logger;
|
||||
|
||||
@ -6,12 +6,12 @@ namespace DigitalData.Auth.API.Services;
|
||||
|
||||
public static class DIExtensions
|
||||
{
|
||||
public static IServiceCollection AddAuthService(this IServiceCollection services, IConfiguration configuration, Action<List<Consumer>>? consumerOptions = null)
|
||||
public static IServiceCollection AddAuthService(this IServiceCollection services, IConfiguration? configuration = null, Action<List<Consumer>>? consumerOptions = null)
|
||||
{
|
||||
List<Consumer> consumers = new();
|
||||
|
||||
var consumerKey = $"{nameof(Consumer)}s";
|
||||
if (configuration.GetSection(consumerKey).Get<IEnumerable<Consumer>>() is IEnumerable<Consumer> consumersFromConfig)
|
||||
if (configuration?.GetSection(consumerKey).Get<IEnumerable<Consumer>>() is IEnumerable<Consumer> consumersFromConfig)
|
||||
consumers.AddRange(consumersFromConfig);
|
||||
|
||||
consumerOptions?.Invoke(consumers);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user