SPMS_API/SPMS.Infrastructure/DependencyInjection.cs
SEAN 27f33f809b feat: E2EE 암호화 유틸리티 구현 (#28)
- AesEncryption: AES-256-CBC 암호화/복호화
- RsaEncryption: RSA-2048 키 쌍 생성/암복호화
- E2EEService: 하이브리드 암복호화 (요청 복호화, 응답 암호화)
- TimestampValidator: 타임스탬프 검증 (±30초)
- SecureTransportAttribute: Action Filter (보안등급 3 엔드포인트용)
- DI 등록: IE2EEService → E2EEService (Singleton)

Closes #28
2026-02-09 16:33:38 +09:00

35 lines
1.1 KiB
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SPMS.Application.Interfaces;
using SPMS.Domain.Interfaces;
using SPMS.Infrastructure.Auth;
using SPMS.Infrastructure.Persistence;
using SPMS.Infrastructure.Persistence.Repositories;
using SPMS.Infrastructure.Security;
namespace SPMS.Infrastructure;
public static class DependencyInjection
{
public static IServiceCollection AddInfrastructure(
this IServiceCollection services,
IConfiguration configuration)
{
// DbContext
var connectionString = configuration.GetConnectionString("DefaultConnection");
services.AddDbContext<AppDbContext>(options =>
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
// UnitOfWork & Repositories
services.AddScoped<IUnitOfWork, UnitOfWork>();
services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
// External Services
services.AddScoped<IJwtService, JwtService>();
services.AddSingleton<IE2EEService, E2EEService>();
return services;
}
}