Пример #1
0
        public string CheckPasswords(UserAccount instance, string testNaasPassword, string prodNaasPassword, NodeVisit visit)
        {
            ValidateByRole(visit, SystemRoleType.Admin);

            if ((instance == null) || string.IsNullOrEmpty(instance.NaasAccount) ||
                string.IsNullOrEmpty(testNaasPassword) || string.IsNullOrEmpty(prodNaasPassword))
            {
                throw new ArgumentException("Input values are null.");
            }

            string testException = null;

            try
            {
                NAASManager.ValidateUsernameAndPassword(instance.NaasAccount, testNaasPassword, true);
            }
            catch (Exception e)
            {
                testException = ExceptionUtils.GetDeepExceptionMessageOnly(e);
            }
            string prodException = null;

            try
            {
                NAASManager.ValidateUsernameAndPassword(instance.NaasAccount, prodNaasPassword, false);
            }
            catch (Exception e)
            {
                prodException = ExceptionUtils.GetDeepExceptionMessageOnly(e);
            }

            string rtnMessage = string.Empty;

            if (!string.IsNullOrEmpty(testException))
            {
                rtnMessage = "The Test username and password failed to authenticate with message: " + testException;
            }
            if (!string.IsNullOrEmpty(prodException))
            {
                if (!string.IsNullOrEmpty(rtnMessage))
                {
                    rtnMessage += Environment.NewLine + Environment.NewLine;
                }
                rtnMessage += "The Prod username and password failed to authenticate with message: " + prodException;
            }
            return(rtnMessage);
        }
Пример #2
0
 public CachedUserAccountInfo(NAAS_USRMGR.UserAccountType userAcct)
 {
     _username  = NAASManager.CleanUpNAASReturnedAccountName(userAcct.userId);
     _affiliate = string.IsNullOrEmpty(userAcct.node) ? userAcct.affiliate : userAcct.node;
 }