Ejemplo n.º 1
0
        /// <summary>
        /// Autentica un Usuario
        /// </summary>
        /// <param name="strUsername">Usuario</param>
        /// <param name="strPassword">Contraseña</param>
        public static String Authenticate(String userName, String passsword, BizServer bizServer)
        {
            List<string> lstRoles = new List<string>();
            UserInfo userInfo = new UserInfo();
            String LoginSuccess = ValidateUser(userName, passsword, ref lstRoles, ref userInfo, bizServer);
            if (LoginSuccess == String.Empty)
            {
                FormsAuthentication.Initialize();
                String strRole = AssignRoles(userName, lstRoles);

                StringWriter writer = new StringWriter();
                XmlSerializer xsl = new XmlSerializer(userInfo.GetType());
                xsl.Serialize(writer, userInfo);

                strRole += "#" + writer.ToString();

                //AddMinutes determina cuanto tiempo el usuario estará logueado despues de dejar el sitio si no se deslogueo.
                FormsAuthenticationTicket fat = new FormsAuthenticationTicket(1, userName, DateTime.Now, DateTime.Now.AddMinutes(60), false, strRole, FormsAuthentication.FormsCookiePath);

                HttpContext.Current.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(fat)));

                return LoginSuccess;
            }
            else return LoginSuccess;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor (Solo para uso Externo) de la Clase BaseClass.
        /// </summary>
        /// <param name="bizSrv"></param>
        /// <param name="callingAssembly"></param>
        /// <param name="creteDBConnection"></param>
        protected BaseClass(BizServer bizSrv, string callingAssembly, bool createDBConnection)
        {
            if (callingAssembly == Assembly.GetExecutingAssembly().GetName().Name)
                throw new Exception("This constructor must be used only from external assembly.");

            try
            {
                if (bizSrv == null)
                    throw new ArgumentNullException("BizServer");

                _oBizServer = bizSrv;

                if (createDBConnection)
                {
                    _oDataAccess = EstudioDelFutbol.Data.ADONETDataAccess.DataAccess.GetSqlClientWrapper(bizSrv.DataBase.ConnectionString, new CacheHelper(), bizSrv.Log);

                    if (bizSrv.Usuario != null)
                        _oDataAccess.TrackingInfo = bizSrv.Usuario.RemoteEndpoint;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor de la Clase BaseClass.
        /// <param name="bizSrv">objeto BizServer</param>
        /// <param name="datAcc">objeto DataAccess</param>
        /// </summary>
        protected BaseClass(BizServer bizSrv, DataAccess datAcc)
        {
            try
            {
                if (bizSrv == null)
                    throw new ArgumentNullException("BizServer");

                if (datAcc == null)
                    throw new ArgumentNullException("DataAccess");

                _oBizServer = bizSrv;
                _oDataAccess = datAcc;
                _keepConnectionAlive = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
 public BaseMasterPage()
 {
     _bizServer = (BizServer)HttpContext.Current.Application["BIZSERVER"];
 }
Ejemplo n.º 5
0
 public User(BizServer bizSvr, DataAccess datAcc)
     : base(bizSvr, datAcc)
 {
 }
Ejemplo n.º 6
0
 public User(BizServer bizSvr, bool createDBConnection)
     : base(bizSvr, Assembly.GetCallingAssembly().GetName().Name, createDBConnection)
 {
 }
Ejemplo n.º 7
0
 public User(BizServer bizSvr)
     : base(bizSvr, Assembly.GetCallingAssembly().GetName().Name, true)
 {
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Validate WebClientApp User
        /// </summary>
        /// <param name="prefix"></param>
        /// <param name="mobile"></param>
        /// <param name="password"></param>
        /// <param name="companyID"></param>
        /// <param name="userInfo"></param>
        /// <param name="bizServer"></param>
        /// <returns></returns>
        private static String ValidateUser(String userName, String password, ref List<string> lstRoles, ref UserInfo userInfo, BizServer bizServer)
        {
            DataTable users;
            using (User user = new User(bizServer))
            {
                object result = new DataTable();
                user.Login(userName, password, ref result);
                users = (DataTable)result;
            }

            if (users.Rows.Count > 0)
            {
                //Get ClientApp UserInfo
                userInfo.IdClub = Convert.ToInt32(users.Rows[0]["ClubID"]);
                userInfo.Nombre = users.Rows[0]["ClubName"].ToString();
                userInfo.Email = users.Rows[0]["Mail"].ToString();
                userInfo.InternalPath = WebConfigurationManager.AppSettings["InternalMainPath"] + userName + "_" + userInfo.IdClub.ToString() + "\\";
                userInfo.ExternalPath = WebConfigurationManager.AppSettings["ExternalMainPath"] + userName + "_" + userInfo.IdClub.ToString() + "/";
                userInfo.Picture = userInfo.ExternalPath + userName + ".png";
                string NextMatchPath = Path.Combine(userInfo.InternalPath, "Rival");
                userInfo.NextMatch = Path.GetFileNameWithoutExtension(new FileInfo(Directory.GetFiles(NextMatchPath)[0]).Name);

                HttpContext.Current.Session[Consts.USER_INFO] = userInfo;

                lstRoles.Add("AppClient");

                return string.Empty; //Usuario Logueado.
            }
            else
            {
                return "Usuario y/o Contraseña incorrectos";
            }
        }
Ejemplo n.º 9
0
 public static byte[] Ping(BizServer oBizServer, XmlElement objParams)
 {
     return new byte[] { (byte)'O', (byte)'K' };
 }
Ejemplo n.º 10
0
 public CityHall(BizServer bizSvr, DataAccess datAcc)
     : base(bizSvr, datAcc)
 {
 }