Exemplo n.º 1
0
        public bool ProcessLogIn()
        {
            try
            {
                // tcpmgr = new TCPManager();
                //Send the auth message
                String request = GetAuthMsg();

                bp = new BWProvisioningServiceService();
                string xmlResponse = bp.processOCIMessage(request);
                //string xmlResponse = bp.sendMsg(request);

                //String xmlResponse = OCIUtilClient.SendOCIMsg(request);
                System.Console.WriteLine("Results:" + xmlResponse);

                if (xmlResponse != null)
                {
                    int indx1 = xmlResponse.IndexOf("AuthenticationResponse");
                    if (indx1 < 0)
                    {
                        System.Console.WriteLine("RequestAuthentication" + " Invalid: " + xmlResponse);
                        return(false);
                    }

                    indx1 = xmlResponse.IndexOf("<nonce>");
                    int indx2 = xmlResponse.IndexOf("</nonce>");
                    if (indx2 <= indx1)
                    {
                        System.Console.WriteLine("InvalidAuthenticationResponse: " + xmlResponse);
                        return(false);
                    }

                    indx1 += "<nonce>".Length;
                    String nonceValue = xmlResponse.Substring(indx1, indx2 - indx1);

                    // hash the password
                    // MD5 Encrypted Password Calculation
                    //String pass = EncryptPassword( nonceValue );
                    String pass = OCIUtilClient.ComputeMessageDigest(this.pass, nonceValue);

                    // submit the login request message
                    String LoginRequest = this.GetLoginMsg(pass);
                    //xmlResponse = bp.sendMsg(request);

                    OCIUtilClient.SendOCIMsg(LoginRequest);


                    if (xmlResponse != null)
                    {
                        indx1 = xmlResponse.IndexOf("LoginResponse");
                        if (indx1 < 0)
                        {
                            System.Console.WriteLine("LoginRequest" + " command failed");
                            return(false);
                        }
                        System.Console.WriteLine("LoginRequest" + " command successful\n");
                    }
                    else
                    {
                        System.Console.WriteLine("LoginRequest" + " command unsuccessful\n");
                        return(false);
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine("ECaught:" + ex.Message + "  StackTrace: " + ex.StackTrace);
            }

            return(true);
        }//ProcessLogIn
Exemplo n.º 2
0
        public BworksProvisioner()
        {
            bp = new BworksService();

            this.sessionId = "208.99.195.197" + "," + this.ToString().GetHashCode() + "," + System.DateTime.Now.Millisecond;
        }
Exemplo n.º 3
0
        public BworksProvisioner()
        {
            bp = new BworksService();

            this.sessionId = "208.99.195.197" + "," + this.ToString().GetHashCode() + "," + System.DateTime.Now.Millisecond;
        }
Exemplo n.º 4
0
        public bool ProcessLogIn()
        {
            try
            {
                // tcpmgr = new TCPManager();
                //Send the auth message
                String request = GetAuthMsg();

                bp = new BWProvisioningServiceService();
                string xmlResponse = bp.processOCIMessage(request);
                //string xmlResponse = bp.sendMsg(request);

                //String xmlResponse = OCIUtilClient.SendOCIMsg(request);
                System.Console.WriteLine("Results:" + xmlResponse);

                if (xmlResponse != null)
                {
                    int indx1 = xmlResponse.IndexOf("AuthenticationResponse");
                    if (indx1 < 0)
                    {
                        System.Console.WriteLine("RequestAuthentication" + " Invalid: " + xmlResponse);
                        return false;
                    }

                    indx1 = xmlResponse.IndexOf("<nonce>");
                    int indx2 = xmlResponse.IndexOf("</nonce>");
                    if (indx2 <= indx1)
                    {
                        System.Console.WriteLine("InvalidAuthenticationResponse: " + xmlResponse);
                        return false;
                    }

                    indx1 += "<nonce>".Length;
                    String nonceValue = xmlResponse.Substring(indx1, indx2-indx1);

                    // hash the password
                    // MD5 Encrypted Password Calculation
                    //String pass = EncryptPassword( nonceValue );
                    String pass = OCIUtilClient.ComputeMessageDigest(this.pass, nonceValue);

                    // submit the login request message
                    String LoginRequest = this.GetLoginMsg(pass);
                    //xmlResponse = bp.sendMsg(request);

                    OCIUtilClient.SendOCIMsg(LoginRequest);

                    if (xmlResponse != null)
                    {
                        indx1 = xmlResponse.IndexOf("LoginResponse");
                        if (indx1 < 0)
                        {
                            System.Console.WriteLine("LoginRequest" + " command failed");
                            return false;
                        }
                        System.Console.WriteLine("LoginRequest" + " command successful\n");
                    }
                    else
                    {
                        System.Console.WriteLine("LoginRequest" + " command unsuccessful\n");
                        return false;
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine("ECaught:" + ex.Message + "  StackTrace: " + ex.StackTrace);

            }

            return true;
        }