Egy kis authentikáció
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user