예제 #1
0
        static public void DeleteCredentials(string cmdrname)
        {
            CompanionCredentials c = CompanionCredentials.FromFile(cmdrname);

            if (c != null)
            {
                c.Clear();
                c.ToFile();
            }
        }
예제 #2
0
        static public State CredentialState(string cmdrname)
        {
            CompanionCredentials c = CompanionCredentials.FromFile(cmdrname);

            if (c != null && c.IsComplete)
            {
                return(c.Confirmed ? State.CONFIRMED : State.NEEDS_CONFIRMATION);
            }
            else
            {
                return(State.NO_CREDENTIALS);
            }
        }
예제 #3
0
        ///<summary>Log in.  Throws an exception if it fails</summary>

        public void LoginAs(string cmdrname)                          // login with previous credientials stored
        {
            if (NeedLogin)
            {
                Credentials = CompanionCredentials.FromFile(cmdrname);      // if file name missing, will not be complete for login

                if (Credentials != null)
                {
                    NeedLogin = false;
                }
                else
                {
                    throw new CompanionAppException("No stored credentials");
                }
            }
            else
            {
                throw new CompanionAppIllegalStateException("Service in incorrect state to login");
            }
        }