Egy kis authentikáció

This commit is contained in:
2025-01-21 15:52:30 +01:00
parent 3b11c6adc5
commit 30d82fc9bf
12 changed files with 186 additions and 12 deletions
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using AutoMapper.Configuration.Conventions;
using WorkFlowCheck.BL.DTO;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
@@ -15,6 +15,9 @@ namespace WorkFlowCheck.BL.Mappings
public MapperProfile()
{
CreateMap<User, UserDTO>();
CreateMap<UserDTO, User>()
.ForMember(dest => dest.PasswordHash, opt => opt.MapFrom<PasswordHashResolver>());
}
}
}
@@ -0,0 +1,20 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.Security;
using WorkFlowCheck.DL.Entities;
namespace WorkFlowCheck.BL.Mappings
{
public class PasswordHashResolver : IValueResolver<UserDTO, User, string>
{
public string Resolve(UserDTO source, User destination, string destMember, ResolutionContext context)
{
return PasswordHasher.HashPassword(source.Password);
}
}
}