diff --git a/DigitalData.Core.Abstractions/Security/IAsymCryptHandler.cs b/DigitalData.Core.Abstractions/Security/ICryptograph.cs similarity index 79% rename from DigitalData.Core.Abstractions/Security/IAsymCryptHandler.cs rename to DigitalData.Core.Abstractions/Security/ICryptograph.cs index fbf56b9..74d9fd9 100644 --- a/DigitalData.Core.Abstractions/Security/IAsymCryptHandler.cs +++ b/DigitalData.Core.Abstractions/Security/ICryptograph.cs @@ -1,6 +1,6 @@ namespace DigitalData.Core.Abstractions.Security { - public interface IAsymCryptHandler : IAsymmetricKeyFactory + public interface ICryptograph : IAsymmetricKeyFactory { IEnumerable PrivateKeys { get; } diff --git a/DigitalData.Core.Security/AsymCryptHandler.cs b/DigitalData.Core.Security/AsymCryptHandler.cs index cc0725f..3dc47b7 100644 --- a/DigitalData.Core.Security/AsymCryptHandler.cs +++ b/DigitalData.Core.Security/AsymCryptHandler.cs @@ -6,7 +6,7 @@ using Microsoft.Extensions.Options; namespace DigitalData.Core.Security { - public class AsymCryptHandler : RSAFactory, IAsymCryptHandler, IAsymmetricKeyFactory + public class AsymCryptHandler : RSAFactory, ICryptograph, IAsymmetricKeyFactory { public IEnumerable PrivateKeys { get; } diff --git a/DigitalData.Core.Security/DIExtensions.cs b/DigitalData.Core.Security/DIExtensions.cs index 9a68e7b..7faecb2 100644 --- a/DigitalData.Core.Security/DIExtensions.cs +++ b/DigitalData.Core.Security/DIExtensions.cs @@ -16,7 +16,7 @@ namespace DigitalData.Core.Security private static IServiceCollection AddAsymCryptHandler(this IServiceCollection services) => services .AddParamsConfigureOptions() .AddAutoMapper(typeof(MappingProfile).Assembly) - .AddSingleton(); + .AddSingleton(); /// /// Registers a custom asym crypt service with specified parameters from the given configuration section. diff --git a/DigitalData.Core.Security/JwtSignatureHandler.cs b/DigitalData.Core.Security/JwtSignatureHandler.cs index 0c83002..0dc5612 100644 --- a/DigitalData.Core.Security/JwtSignatureHandler.cs +++ b/DigitalData.Core.Security/JwtSignatureHandler.cs @@ -15,14 +15,14 @@ namespace DigitalData.Core.Security private readonly TokenParams _params; - private readonly IAsymCryptHandler _cryptHandler; + private readonly ICryptograph _cryptograph; - public JwtSignatureHandler(IOptions> claimDescriptorOptions, IMapper mapper, IOptions tokenParamOptions, IAsymCryptHandler asymCryptHandler) + public JwtSignatureHandler(IOptions> claimDescriptorOptions, IMapper mapper, IOptions tokenParamOptions, ICryptograph cryptograph) { _claimDescriptor = claimDescriptorOptions.Value; _mapper = mapper; _params = tokenParamOptions.Value; - _cryptHandler = asymCryptHandler; + _cryptograph = cryptograph; } public SecurityToken CreateToken(TPrincipal subject, TokenDescription description) @@ -38,7 +38,7 @@ namespace DigitalData.Core.Security var description = _params.Descriptions?.Get(issuer: issuer, audience: audience) ?? throw new InvalidOperationException($"No or multiple token description found for issuer '{issuer}' and audience '{audience}'."); - description.SigningCredentials = _cryptHandler.PrivateKeys + description.SigningCredentials = _cryptograph.PrivateKeys .Get(issuer: issuer, audience: audience) .CreateSigningCredentials(algorithm: description.SigningAlgorithm, digest: description.SigningDigest); @@ -50,7 +50,7 @@ namespace DigitalData.Core.Security var description = _params.Descriptions.SingleOrDefault(description => description.ApiRoute == apiRoute) ?? throw new InvalidOperationException($"No or multiple token description found for api route '{apiRoute}'."); - description.SigningCredentials = _cryptHandler.PrivateKeys + description.SigningCredentials = _cryptograph.PrivateKeys .Get(issuer: description.Issuer, audience: description.Audience) .CreateSigningCredentials(algorithm: description.SigningAlgorithm, digest: description.SigningDigest);