Exemplo n.º 1
0
        private Task <ClaimsIdentity> GetClaims(AuthenticateUserComand command)
        {
            var customer = _repository.Get(command.UserName);
            var pass     = Encripty.EncryptPassword(command.password).ToString().Substring(0, 12);

            if (customer == null)
            {
                return(Task.FromResult <ClaimsIdentity>(null));
            }

            if (!(customer.UserName == command.UserName && customer.Password == pass))
            {
                return(Task.FromResult <ClaimsIdentity>(null));
            }


            _customer = customer;

            return(Task.FromResult(new ClaimsIdentity(
                                       new GenericIdentity(customer.UserName, "Token"),
                                       new[] {
                new Claim("TES", "User")
            }
                                       )));
        }
        public GetCustomerCommandResult GetById(Guid?id)
        {
            _command           = new GetCustomerCommandResult();
            _command.Id        = new Guid("74d96684-817d-4b5a-8edc-1a20aca2228c");
            _command.FirstName = "Enrique";
            _command.LastName  = "Souza";
            _command.Document  = "46718115533";
            _command.Email     = "*****@*****.**";
            _command.UserId    = new Guid("96352cd9-f793-42b1-bcb8-2f9c8698b330");
            _command.Username  = "******";
            _command.Password  = "******";
            _command.Active    = true;

            return(_command);
        }