예제 #1
0
파일: WmCoreOp.cs 프로젝트: tmbx/kwm-ng
        /// <summary>
        /// Called when the KMOD ticket query results are available.
        /// </summary>
        private void OnKmodTicketResult(WmLoginTicketQuery query)
        {
            if (m_kmodQuery != query)
            {
                return;
            }
            m_kmodQuery = null;

            // Generic failure.
            if (query.Res != WmLoginTicketQueryRes.OK)
            {
                m_kmodResCode = EAnpRegisterKpsCode.Failure;
                m_kmodEx      = new Exception(query.OutDesc);
            }

            // No KCD failure.
            else if (query.Ticket.KcdAddr == "")
            {
                m_kmodResCode = EAnpRegisterKpsCode.NoKcd;
            }

            // Query completed.
            OnQueryCompletion();
        }
예제 #2
0
 /// <summary>
 /// Obtain a login ticket and login with it.
 /// </summary>
 private void HandleTicketLoginStep()
 {
     m_currentStep = KwsLoginStep.Ticket;
     m_ticketQuery = new WmLoginTicketQuery();
     m_ticketQuery.Submit(Wm.KmodBroker, KwmCfg.Cur, HandleTicketLoginResult);
 }
예제 #3
0
        /// <summary>
        /// Called when the login query results are available.
        /// </summary>
        private void OnLoginResult(KmodQuery query)
        {
            Logging.Log("OnLoginResult() called.");
            ClearKmodQuery();
            K3p.kmo_server_info_ack ack = query.OutMsg as K3p.kmo_server_info_ack;

            if (ack != null)
            {
                creds.Token = ack.Token;
                WmLoginTicketQuery ticketQuery = new WmLoginTicketQuery();
                SaveCredentials();
                m_query = ticketQuery;
                ticketQuery.Submit(m_broker, WmWinRegistry.Spawn(), OnTicketResult);
            }

            else
            {
                K3p.kmo_server_info_nack nack = query.OutMsg as K3p.kmo_server_info_nack;

                if (nack != null)
                {
                    if (nack.Error.StartsWith("cannot resolve ")) creds.SetServerError(nack.Error);
                    else creds.SetCredError(nack.Error);
                }

                else
                {
                    creds.SetServerError(query.OutDesc);
                }

                this.Enabled = true;
            }
        }
예제 #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;
            }
        }
예제 #5
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(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();
            }
        }
예제 #6
0
 /// <summary>
 /// Obtain a login ticket and login with it.
 /// </summary>
 private void HandleTicketLoginStep(WmWinRegistry registry)
 {
     m_currentStep = KwsLoginStep.Ticket;
     m_ticketQuery = new WmLoginTicketQuery();
     m_ticketQuery.Submit(m_wm.KmodBroker, registry, HandleTicketLoginResult);
 }
예제 #7
0
 /// <summary>
 /// Obtain a login ticket and login with it.
 /// </summary>
 private void HandleTicketLoginStep()
 {
     m_currentStep = KwsLoginStep.Ticket;
     m_ticketQuery = new WmLoginTicketQuery();
     m_ticketQuery.Submit(Wm.KmodBroker, KwmCfg.Cur, HandleTicketLoginResult);
 }
예제 #8
0
파일: WmCoreOp.cs 프로젝트: tmbx/kwm-ng
        /// <summary>
        /// Called when the KMOD ticket query results are available.
        /// </summary>
        private void OnKmodTicketResult(WmLoginTicketQuery query)
        {
            if (m_kmodQuery != query) return;
            m_kmodQuery = null;

            // Generic failure.
            if (query.Res != WmLoginTicketQueryRes.OK)
            {
                m_kmodResCode = EAnpRegisterKpsCode.Failure;
                m_kmodEx = new Exception(query.OutDesc);
            }

            // No KCD failure.
            else if (query.Ticket.KcdAddr == "")
                m_kmodResCode = EAnpRegisterKpsCode.NoKcd;

            // Query completed.
            OnQueryCompletion();
        }
예제 #9
0
파일: KwsSpawnHandler.cs 프로젝트: tmbx/kwm
        /// <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;
            }
        }
예제 #10
0
파일: KwsSpawnHandler.cs 프로젝트: tmbx/kwm
 /// <summary>
 /// Post a login ticket query.
 /// </summary>
 public void PostLoginTicketQuery(WmWinRegistry registry, WmLoginTicketQueryDelegate callback)
 {
     Logging.Log(1, "PostLoginTicketQuery()");
     WmLoginTicketQuery loginQuery = new WmLoginTicketQuery();
     loginQuery.Submit(Op.Wm.KmodBroker, registry, callback);
     Op.m_kmodQuery = loginQuery;
 }
예제 #11
0
파일: KwsSpawnHandler.cs 프로젝트: tmbx/kwm
        /// <summary>
        /// Handle the results of the login ticket query.
        /// </summary>
        private void HandleLoginTicketQueryResult(WmLoginTicketQuery query)
        {
            if (m_doneFlag) return;
            Debug.Assert(m_opStep == KwmCoreKwsOpStep.InitialPowerQuery ||
                         m_opStep == KwmCoreKwsOpStep.KasConnectAndGetTicket);

            WmWinRegistry registry = WmWinRegistry.Spawn();
            m_sh.HandleLoginTicketQueryResult(query, registry);

            // An error occurred.
            if (query.Res == WmLoginTicketQueryRes.MiscError)
            {
                OpRes = KwmCoreKwsOpRes.MiscError;
                ErrorString = query.OutDesc;
                ShowWizardEnd();
            }

            // We can create the workspace.
            else if (CheckCanCreateKws(registry, false))
            {
                // We were doing the initial power query. Retry the operation.
                if (m_opStep == KwmCoreKwsOpStep.InitialPowerQuery) RetryOp(false);

                // We obtained the login ticket for creating the workspace.
                else HandleKasConnectAndGetTicketResult();
            }
        }
예제 #12
0
파일: KwsSpawnHandler.cs 프로젝트: tmbx/kwm
 /// <summary>
 /// Handle the results of the login ticket query.
 /// </summary>
 private void HandleLoginTicketQueryResult(WmLoginTicketQuery query)
 {
     if (!CheckCtx(KwmCoreKwsOpStep.KasConnectAndGetTicket)) return;
     WmWinRegistry registry = WmWinRegistry.Spawn();
     m_sh.HandleLoginTicketQueryResult(query, registry);
     if (query.Res == WmLoginTicketQueryRes.MiscError) HandleMiscFailure(new Exception(query.OutDesc));
     else if (CheckCanCreateKws(registry)) HandleKasConnectAndGetTicketResult();
 }
예제 #13
0
파일: WmCoreOp.cs 프로젝트: tmbx/kwm-ng
 /// <summary>
 /// Submit the ticket query to KMOD.
 /// </summary>
 private void SubmitKmodTicketQuery()
 {
     WmLoginTicketQuery ticketQuery = new WmLoginTicketQuery();
     m_kmodQuery = ticketQuery;
     KwmCfg cfg = new KwmCfg();
     UpdateRegistryObject(cfg);
     ticketQuery.Submit(Wm.KmodBroker, cfg, OnKmodTicketResult);
 }
예제 #14
0
파일: KwsCoreOp.cs 프로젝트: tmbx/kwm-ng
        public override void Start()
        {
            try
            {
                // Make sure we can login on the KPS.
                if (!KwmCfg.Cur.CanLoginOnKps()) throw new EAnpExInvalidKpsConfig();

                // Get a ticket.
                m_step = OpStep.TicketReply;
                WmLoginTicketQuery ticketQuery = new WmLoginTicketQuery();
                m_kmodQuery = ticketQuery;
                ticketQuery.Submit(Wm.KmodBroker, KwmCfg.Cur, OnKmodTicketResult);
            }

            catch (Exception ex)
            {
                HandleFailure(ex);
            }
        }
예제 #15
0
 // Cancel and clear the ticket query, if required.
 private void ClearTicketQuery()
 {
     if (m_ticketQuery != null)
     {
         m_ticketQuery.Cancel();
         m_ticketQuery = null;
     }
 }
예제 #16
0
파일: KwsCoreOp.cs 프로젝트: tmbx/kwm-ng
        /// <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);
            }
        }
예제 #17
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);
        }