예제 #1
0
 public async Task <UserVM> Authenticate(UserPassVM userLg) //Usuario = userLg.Usuario, Pasword= userLg.Password,Dominio=userLg.Dominio,Token=userLg.Token
 {
     return(await Mediator.Send(new GetLoginQuery()
     {
         Usuario = userLg
     }).ConfigureAwait(false));
 }
예제 #2
0
        public async Task <ActionResult <Unit> > ChangePass(UserPassVM value)
        {
            var authHeader = AuthenticationHeaderValue.Parse(Request.Headers["Authorization"]);
            var handler    = new JwtSecurityTokenHandler();
            var jwtToken   = handler.ReadToken(authHeader.Parameter) as JwtSecurityToken;

            var CodUsuario = jwtToken.Claims.FirstOrDefault(claim => claim.Type == "primarysid").Value;

            if (CodUsuario != value.codUsuario + "")
            {
                throw new GeneralFailureException("Usuario no coincide con usuario del token");
            }
            return(await Mediator.Send(new ChangePassCommand()
            {
                user = value
            }).ConfigureAwait(false));
        }