From 6ce4a08c531f7d7cb2ef90a0de6522546a62acbc Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Tue, 19 Nov 2024 13:19:14 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20DI-Erweiterung=20zur=20Registrierung=20?= =?UTF-8?q?von=20CryptFactory=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Security/ICryptFactory.cs | 10 ++-------- DigitalData.Core.Security/CryptFactory.cs | 2 +- DigitalData.Core.Security/DIExtensions.cs | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 DigitalData.Core.Security/DIExtensions.cs diff --git a/DigitalData.Core.Abstractions/Security/ICryptFactory.cs b/DigitalData.Core.Abstractions/Security/ICryptFactory.cs index d61f227..f47513c 100644 --- a/DigitalData.Core.Abstractions/Security/ICryptFactory.cs +++ b/DigitalData.Core.Abstractions/Security/ICryptFactory.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DigitalData.Core.Abstractions.Security +namespace DigitalData.Core.Abstractions.Security { public interface ICryptFactory { } -} +} \ No newline at end of file diff --git a/DigitalData.Core.Security/CryptFactory.cs b/DigitalData.Core.Security/CryptFactory.cs index 2407c1a..473a45b 100644 --- a/DigitalData.Core.Security/CryptFactory.cs +++ b/DigitalData.Core.Security/CryptFactory.cs @@ -6,6 +6,6 @@ namespace DigitalData.Core.Security { private static readonly Lazy LazyStaticCryptFactory = new (() => new CryptFactory()); - public ICryptFactory Static = LazyStaticCryptFactory.Value; + public static ICryptFactory Static = LazyStaticCryptFactory.Value; } } \ No newline at end of file diff --git a/DigitalData.Core.Security/DIExtensions.cs b/DigitalData.Core.Security/DIExtensions.cs new file mode 100644 index 0000000..649b80d --- /dev/null +++ b/DigitalData.Core.Security/DIExtensions.cs @@ -0,0 +1,15 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; + +namespace DigitalData.Core.Security +{ + public static class DIExtensions + { + public static IServiceCollection AddSecurity(this IServiceCollection services) + { + services.TryAddScoped(_ => CryptFactory.Static); + + return services; + } + } +} \ No newline at end of file