예제 #1
0
        public ActionResult CrearUsuarioAdm(RegistroCrearPassWord_Request model)
        {
            MesaDinero.Domain.BaseResponse <string> result = new MesaDinero.Domain.BaseResponse <string>();
            try
            {
                result.success = true;
                Domain.DataAccess.RegistroCliente _regsitroDataAccess = new Domain.DataAccess.RegistroCliente();
                MesaDinero.Domain.BaseResponse <RegistroPassWpord_Response2> result_ = _regsitroDataAccess.CrearPasswprdAdm(model);

                if (result_.success == true)
                {
                    var claims = new List <Claim>
                    {
                        //new Claim(ClaimTypes.WindowsAccountName, result_.data.email),
                        //new Claim(ClaimTypes.Name, result_.data.email),
                        //new Claim(ClaimTypes.Actor, result_.data.vNroDocumento),
                        //new Claim(ClaimTypes.SerialNumber, result_.data.vNroDocumento),
                        //new Claim(ClaimTypes.Role, ""),
                        //new Claim(ClaimTypes.PrimarySid,result_.data.IdUsuario.ToString()),
                        //new Claim(ClaimTypes.DenyOnlySid,result_.data.IdCliente.ToString()),
                        //new Claim(ClaimTypes.PostalCode,result_.data.TipoCliente.ToString()),
                        //new Claim(ClaimTypes.NameIdentifier, result_.data.email),
                        //new Claim(ClaimTypes.Email, result_.data.email),
                        //new Claim(ClaimTypes.GivenName, result_.data.Iniciales),

                        new Claim(ClaimTypes.WindowsAccountName, result_.data.email),
                        new Claim(ClaimTypes.Name, result_.data.email),
                        new Claim(ClaimTypes.Actor, result_.data.vNroDocumento),
                        new Claim(ClaimTypes.PostalCode, result_.data.IdUsuario.ToString()),
                        new Claim(ClaimTypes.Role, ""),
                        new Claim(ClaimTypes.NameIdentifier, result_.data.email),
                        new Claim(ClaimTypes.Country, result_.data.RucEmpresa ?? ""),



                        new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", result_.data.email)
                    };
                    var id  = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
                    var ctx = Request.GetOwinContext();
                    AuthenticationManager.SignIn(id);
                }
                else
                {
                    throw new Exception(result_.error);
                }
            }
            catch (Exception ex)
            {
                result.success = false;
                result.error   = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }