Exemple #1
0
        /// <summary>
        /// Handle the results of the ticket query.
        /// </summary>
        private void HandleTicketLoginResult(WmLoginTicketQuery query)
        {
            // Clear the query.
            Debug.Assert(m_ticketQuery == query);
            m_ticketQuery = null;

            // Update the registry, if required.
            query.UpdateRegistry();

            // The query failed.
            if (query.Res == WmLoginTicketQueryRes.InvalidCfg ||
                query.Res == WmLoginTicketQueryRes.MiscError)
            {
                HandleLoginFailure(KwsLoginResult.CannotGetTicket, new Exception("cannot obtain ticket: " + query.OutDesc));
            }

            // The query succeeded.
            else
            {
                // Update the credentials.
                m_kws.Cd.Credentials.Ticket = query.Ticket.BinaryTicket;
                m_kws.OnStateChange(WmStateChange.Permanent);

                // Send the login command.
                SendLoginCommand();
            }
        }
Exemple #2
0
        /// <summary>
        /// Called when the KMOD ticket query results are available.
        /// </summary>
        private void OnKmodTicketResult(WmLoginTicketQuery query)
        {
            if (m_kmodQuery != query)
            {
                return;
            }
            m_kmodQuery = null;
            Debug.Assert(m_step == OpStep.TicketReply);

            try
            {
                // Update the registry information.
                query.UpdateRegistry();

                // Generic failure.
                if (query.Res != WmLoginTicketQueryRes.OK)
                {
                    throw new Exception(query.OutDesc);
                }

                // We cannot create a workspace.
                if (!KwmCfg.Cur.CanCreateKws())
                {
                    throw new EAnpExInvalidKpsConfig();
                }

                // Update the credentials.
                Creds.Ticket           = query.Ticket.BinaryTicket;
                Creds.UserName         = query.Ticket.AnpTicket.Elements[0].String;
                Creds.UserEmailAddress = query.Ticket.AnpTicket.Elements[1].String;

                // Set the KCD address.
                if (KwmCfg.Cur.CustomKcdFlag)
                {
                    Creds.KcdAddress = KwmCfg.Cur.CustomKcdAddress;
                }
                else
                {
                    Creds.KcdAddress = KwmCfg.Cur.KpsKcdAddr;
                }
                if (Creds.KcdAddress == "")
                {
                    throw new Exception("invalid KCD address");
                }

                // Create the workspace object.
                Kws = Wm.CreateWorkspace(Creds);
                RegisterToKws();

                // Start the spawn operation and wait for the connection.
                m_step = OpStep.Connecting;
                Kws.Sm.RequestTaskSwitch(KwsTask.Spawn);
                SendCreateKwsCmdIfNeeded();
            }

            catch (Exception ex)
            {
                HandleFailure(ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// Called when the KMOD ticket query results are available.
        /// </summary>
        private void OnKmodTicketResult(WmLoginTicketQuery query)
        {
            if (m_kmodQuery != query) return;
            m_kmodQuery = null;
            Debug.Assert(m_step == OpStep.TicketReply);

            try
            {
                // Update the registry information.
                query.UpdateRegistry();

                // Generic failure.
                if (query.Res != WmLoginTicketQueryRes.OK) throw new Exception(query.OutDesc);

                // We cannot create a workspace.
                if (!KwmCfg.Cur.CanCreateKws()) throw new EAnpExInvalidKpsConfig();

                // Update the credentials.
                Creds.Ticket = query.Ticket.BinaryTicket;
                Creds.UserName = query.Ticket.AnpTicket.Elements[0].String;
                Creds.UserEmailAddress = query.Ticket.AnpTicket.Elements[1].String;

                // Set the KCD address.
                if (KwmCfg.Cur.CustomKcdFlag) Creds.KcdAddress = KwmCfg.Cur.CustomKcdAddress;
                else Creds.KcdAddress = KwmCfg.Cur.KpsKcdAddr;
                if (Creds.KcdAddress == "") throw new Exception("invalid KCD address");

                // Create the workspace object.
                Kws = Wm.CreateWorkspace(Creds);
                RegisterToKws();

                // Start the spawn operation and wait for the connection.
                m_step = OpStep.Connecting;
                Kws.Sm.RequestTaskSwitch(KwsTask.Spawn);
                SendCreateKwsCmdIfNeeded();
            }

            catch (Exception ex)
            {
                HandleFailure(ex);
            }
        }
Exemple #4
0
        /// <summary>
        /// Called when the ticket query results are available.
        /// </summary>
        private void OnTicketResult(WmLoginTicketQuery query)
        {
            ClearKmodQuery();

            query.UpdateRegistry(WmWinRegistry.Spawn());
            if (query.Res != WmLoginTicketQueryRes.OK) creds.SetServerError(query.OutDesc);
            else LoginSuccess = true;

            this.Enabled = true;

            // Pass to the next page.
            if (LoginSuccess)
            {
                ((ConfigKPPWizard)GetWizard()).ShowSuccessPage();
                return;
            }
        }
        /// <summary>
        /// Handle the results of the ticket query.
        /// </summary>
        private void HandleTicketLoginResult(WmLoginTicketQuery query)
        {
            // Clear the query.
            Debug.Assert(m_ticketQuery == query);
            m_ticketQuery = null;

            // Update the registry, if required.
            query.UpdateRegistry(WmWinRegistry.Spawn());

            // The query failed.
            if (query.Res == WmLoginTicketQueryRes.InvalidCfg ||
                query.Res == WmLoginTicketQueryRes.MiscError)
            {
                HandleLoginFailure(KwsLoginResult.CannotGetTicket, "cannot obtain ticket: " + query.OutDesc);
            }

            // The query succeeded.
            else
            {
                // Update the credentials.
                m_kws.CoreData.Credentials.Ticket = query.Ticket.BinaryTicket;
                m_kws.SetDirty();

                // Send the login command.
                SendLoginCommand();
            }
        }
Exemple #6
0
        /// <summary>
        /// Handle the results of the login ticket query.
        /// </summary>
        public void HandleLoginTicketQueryResult(WmLoginTicketQuery query, WmWinRegistry registry)
        {
            Logging.Log(1, "HandleLoginTicketQueryResult()");
            Debug.Assert(Op.m_kmodQuery == query);
            Op.m_kmodQuery = null;

            // Update the registry, if required.
            query.UpdateRegistry(registry);

            // Update the credentials, if required.
            if (query.Res == WmLoginTicketQueryRes.OK)
            {
                Creds.Ticket = query.Ticket.BinaryTicket;
                Creds.UserName = query.Ticket.AnpTicket.Elements[0].String;
                Creds.UserEmailAddress = query.Ticket.AnpTicket.Elements[1].String;
            }
        }
Exemple #7
0
        /// <summary>
        /// Called when the ticket query results are available.
        /// </summary>
        private void OnTicketResult(WmLoginTicketQuery query)
        {
            ClearKmodQuery();

            query.UpdateRegistry(WmWinRegistry.Spawn());
            if (query.Res != WmLoginTicketQueryRes.OK) creds.SetServerError(query.OutDesc);
            else LoginSuccess = true;

            this.Enabled = true;

            // Pass to the next page.
            if (LoginSuccess) this.PressButton(WizardButtons.Next);
        }