コード例 #1
0
 private IPromise <IAuthenticator> GetAuthenticator(ICredentials credentials, bool async)
 {
     if (_authenticator != null)
     {
         return(Promises.Resolved(_authenticator));
     }
     return(AuthenticationFactory.GetAuthenticator(Url, Service, credentials, async)
            .Done(a => _authenticator = a));
 }
コード例 #2
0
        public IEnumerable <IBusinessEntity> LoginUser(string LoginId, string Password, string UserIP)
        {
            IList <IBusinessEntity> response = new List <IBusinessEntity>();

            UserEntity userEntity;

            try
            {
                userEntity = GetUserDetailbyLoginId(LoginId);
            }
            catch (FinderException)
            {
                throw new BusinessException("Invalid User Name");
            }

            var isAuthenticated = AuthenticationFactory.GetAuthenticator().IsAuthenticated(userEntity.UserId, Password);

            if (isAuthenticated)
            {
                response.Add(SessionManager.CreateSession(LoginId, UserIP));
                response.Add(userEntity);
            }

            if (!isAuthenticated)
            {
                throw new BusinessException("Your password is invalid.");
            }

            if (userEntity.IsActive == false)
            {
                throw new BusinessException("Your account is disabled, Please contact the administrator.");
            }

            // AuditLogger.LogActivity(userEntity.UserEntityId.ToString(), DateTime.Now, ScreenActivityType.Login,11,"User Logon",-1,-1);
            return(response);
        }
コード例 #3
0
ファイル: Director.cs プロジェクト: SomeZyla/TsGui
        private void LoadXml(XElement SourceXml)
        {
            XElement x;
            TsPage   currPage = null;
            TsPage   prevPage = null;

            IEnumerable <XElement> pagesXml;

            if (SourceXml != null)
            {
                this._debug    = XmlHandler.GetBoolFromXAttribute(SourceXml, "Debug", this._debug);
                this._livedata = XmlHandler.GetBoolFromXAttribute(SourceXml, "LiveData", this._livedata);

                //Set show grid lines after pages and columns have been created.
                x = SourceXml.Element("ShowGridLines");
                if ((x != null) && (this._prodmode == false))
                {
                    this.ShowGridLines = true;
                }

                x = SourceXml.Element("UseTouchDefaults");
                if (x != null)
                {
                    this.UseTouchDefaults = true;
                }

                //turn hardware eval on or off
                x = SourceXml.Element("HardwareEval");
                if (x != null)
                {
                    this._hardwareevaluator = new HardwareEvaluator();
                }

                //start layout import
                this.TsMainWindow = new TsMainWindow(this.ParentWindow, SourceXml);

                this._buttons = new TsButtons();
                this._buttons.LoadXml(SourceXml.Element("Buttons"));

                PageDefaults pagedef = new PageDefaults();

                x = SourceXml.Element("Heading");
                if (x != null)
                {
                    pagedef.PageHeader = new TsPageHeader(this.TsMainWindow, x);
                }
                else
                {
                    pagedef.PageHeader = new TsPageHeader();
                }

                x = SourceXml.Element("LeftPane");
                if (x != null)
                {
                    pagedef.LeftPane = new TsPane(x);
                }
                else
                {
                    pagedef.LeftPane = new TsPane();
                }

                x = SourceXml.Element("RightPane");
                if (x != null)
                {
                    pagedef.RightPane = new TsPane(x);
                }
                else
                {
                    pagedef.RightPane = new TsPane();
                }

                pagedef.Buttons    = this._buttons;
                pagedef.MainWindow = this.TsMainWindow;


                this.TsMainWindow.LoadXml(SourceXml);
                GuiTimeout.Init(SourceXml.Element("Timeout"));

                foreach (XElement xauth in SourceXml.Elements("Authentication"))
                {
                    this._authlibrary.AddAuthenticator(AuthenticationFactory.GetAuthenticator(xauth));
                }

                //now read in the options and add to a dictionary for later use
                pagesXml = SourceXml.Elements("Page");
                if (pagesXml != null)
                {
                    //Debug.WriteLine("pagesXml not null");
                    foreach (XElement xPage in pagesXml)
                    {
                        #region
                        //Debug.WriteLine("creating new page");
                        if (currPage != null)
                        {
                            //record the last page as the prevPage
                            prevPage = currPage;
                            currPage = new TsPage(this.TsMainWindow, xPage, pagedef);
                        }
                        else
                        {
                            currPage         = new TsPage(this.TsMainWindow, xPage, pagedef);
                            currPage.IsFirst = true;
                        }

                        //create the new page and assign the next page/prev page links
                        currPage.PreviousPage = prevPage;
                        if (prevPage != null)
                        {
                            prevPage.NextPage = currPage;
                        }

                        this._pages.Add(currPage);
                        currPage.Page.Loaded += this.OnWindowLoaded;
                        #endregion
                    }

                    //currPage.IsLast = true;
                }

                x = SourceXml.Element("NoUI");
                if (x != null)
                {
                    this._nouicontainer = new NoUIContainer(x);
                }
            }

            LoggerFacade.Info("Config load finished");
            this.ConfigLoadFinished?.Invoke(this, null);
        }