Ejemplo n.º 1
0
        public string SignIn(Credential credential)
        {
            try
            {
                string user = credential.user;
                string pass = credential.pass;
                if (PdpUserProvider.IsValidUser(user, pass))
                {
                    Interlocked.Increment(ref actives_users);
                    Interlocked.Increment(ref accesscounter);

                    Session session = new Session();
                    session.user = user;

                    using (var connect = new Connect())
                    {
                        connect.BeginTrx();
                        SqlConnection sqlconn = connect.GetConnection();
                        var           smapper = new SessionDataMapper(sqlconn);
                        smapper.SetTransaction(connect.Transaction);
                        //smapper.Insert(session);
                    }



                    return(authProvider.AutenticateUser(credential));
                }
                return(null);
            }

            catch (Exception exception)
            {
                throw new FaultException <ServerError>(new ServerError());
            }
        }
Ejemplo n.º 2
0
        public override void Validate(string userName, string password)
        {
            if (userName == null || password == null)
            {
                throw new FaultException("userName cannot be null");
            }

            bool valid = false;

            try
            {
                valid = PdpUserProvider.IsValidUser(userName, password);
            }

            catch (Exception exception)
            {
                throw new Exception("Internal Server Error");
            }

            if (!valid)
            {
                throw new Exception("Incorrect credentials");
            }
        }