コード例 #1
0
        public void Login(ILoginCredentials credentials)
        {
            _credentials = (LloydsLoginCredentials)credentials;

            LoginStep1();
            LoginStep2();
        }
コード例 #2
0
ファイル: OauthLogin.cs プロジェクト: Alkrun/Eve-OpenAPI
        internal OauthLogin(ILoginConfig config, ILoginCredentials credentials, ITokenManager tokenManager)
        {
            Credentials       = credentials;
            Config            = config;
            this.tokenManager = tokenManager;

            userTokens = new Dictionary <string, List <IOauthToken> >();
        }
コード例 #3
0
        public void Login(ILoginCredentials credentials)
        {
            LoginCredentials = credentials;
            Provider         = credentials.GetProvider();

            loginManager.Login(credentials);
            accountManager.Init(Provider);
        }
コード例 #4
0
ファイル: TokenManager.cs プロジェクト: Alkrun/Eve-OpenAPI
 public TokenManager(ILoginConfig config, ILoginCredentials credentials, IResponseManager responseManager, IValidationManager validationManager, IOauthTokenFactory tokenFactory, IHttpHandler client)
 {
     this.config            = config;
     this.credentials       = credentials;
     this.responseManager   = responseManager;
     this.validationManager = validationManager;
     this.tokenFactory      = tokenFactory;
     this.client            = client;
 }
コード例 #5
0
        public void Login(ILoginCredentials credentials)
        {
            // TODO: THIS NEEDS TO BE MOVED
            var scriptManager = new ScriptManager(BrowserBot);

            var providerLoginManagerType = GetTypeFromInterface(credentials.GetProvider(), typeof(IProviderLoginManager));
            var provLoginManager         = (IProviderLoginManager)Activator.CreateInstance(providerLoginManagerType, BrowserBot, scriptManager);

            provLoginManager.Login(credentials);
        }
    public static ILoginCredentials Make(string username, string employeeID, string employeeName, string roleCode, string roleDescription, string deptName, string deptCode)
    {
        ILoginCredentials iLoginCredentials = new ILoginCredentials();

        iLoginCredentials.username        = username;
        iLoginCredentials.employeeID      = employeeID;
        iLoginCredentials.employeeName    = employeeName;
        iLoginCredentials.roleCode        = roleCode;
        iLoginCredentials.roleDescription = roleDescription;
        iLoginCredentials.deptName        = deptName;
        iLoginCredentials.deptCode        = deptCode;
        return(iLoginCredentials);
    }
コード例 #7
0
ファイル: Translator.cs プロジェクト: johnmbaughman/Locult
        /// <summary>
        /// Get translated text from Bing Translator service.
        /// </summary>
        /// <param name="textToTranslate">Text to translate.</param>
        /// <param name="fromLang">Language to translate from.</param>
        /// <param name="toLang">Language to translate to.</param>
        /// <returns>Translated text.</returns>
        List <string> ITranslator.GetTranslatedText(string textToTranslate,
                                                    string fromLang,
                                                    string toLang,
                                                    ILoginCredentials login)
        {
            if (login == null)
            {
                return(null);
            }

            // the TranslatorContainer gives us access to the Microsoft Translator services
            MSTranslate.Service.TranslatorContainer tc = new MSTranslate.Service.TranslatorContainer(login.TranslationServiceUri);

            // Give the TranslatorContainer access to your subscription
            tc.Credentials = new NetworkCredential(SecureStringExtensionMethod.ConvertToUnsecureString(login.User),
                                                   login.Password);

            try
            {
                // Generate the query
                DataServiceQuery <Translation> translationQuery = tc.Translate(textToTranslate, toLang, fromLang);

                // Call the query and get the results as a List
                var translationResults = translationQuery.Execute().ToList();

                // Verify there was a result
                if (translationResults.Count() <= 0)
                {
                    return(new List <string>());
                }

                // In case there were multiple results, pick the first one
                var translationResult = translationResults.First();

                List <string> ret = new List <string>();

                for (int i = 0; i < translationResults.Count(); i++)
                {
                    ret.Add(translationResult.Text);
                }

                return(ret);
            }
            catch (Exception exc)
            {
                throw new Exception(string.Format("Translation text:'{0}', toLang: '{1}', fromLang '{2}'", textToTranslate, toLang, fromLang), exc);
            }
        }
コード例 #8
0
    public ILoginCredentials getLoginCredentials(string username)
    {
        Employee emp = lc.getLoginCredentials(username);

        ILoginCredentials ilc = new ILoginCredentials();

        ilc.Username        = emp.UserName;
        ilc.EmployeeID      = emp.EmployeeID;
        ilc.EmployeeName    = emp.EmployeeName;
        ilc.RoleCode        = emp.RoleCode;
        ilc.RoleDescription = emp.UserRole.RoleDescription;
        ilc.DeptName        = emp.Department.DeptName;
        ilc.DeptCode        = emp.DeptCode;

        return(ilc);
    }
コード例 #9
0
        public MarketCheckService(StarSonataApi api, ILoginCredentials credentials)
        {
            this.api              = api;
            this.pendingRequests  = new ConcurrentQueue <MarketRequest>();
            this.incomingMessages = new ConcurrentQueue <TextMessage>();
            this.shouldExitMcTask = false;
            this.api.WhenConnected.Subscribe(_ => { this.TryGameLoginAsync(credentials.Username, credentials.Password); });
            this.api.WhenDisconnected.Subscribe(_ => { this.api.Connect(); });
            this.api.WhenMessageReceived.Where(msg => msg is Disconnect).Subscribe(msg =>
            {
                this.TryGameLoginAsync(credentials.Username, credentials.Password);
            });
            this.api.WhenMessageReceived.Where(msg => msg is TextMessage).Subscribe(msg =>
            {
                this.incomingMessages.Enqueue((TextMessage)msg);
            });

            this.api.Connect();
            Task.Run(this.AnalyseRequests);
        }
コード例 #10
0
ファイル: ResponseManager.cs プロジェクト: Alkrun/Eve-OpenAPI
 public ResponseManager(ILoginCredentials credentials, IFactory <IAuthResponse> authResponseFactory)
 {
     this.credentials         = credentials;
     this.authResponseFactory = authResponseFactory;
 }
コード例 #11
0
 public MarketCheckService(StarSonataApi api, ILoginCredentials credentials, CancellationToken token)
     : this(api, credentials)
 {
     token.Register(() => { this.shouldExitMcTask = true; });
 }
コード例 #12
0
        /// <summary>
        /// This method translates all selected entries
        /// from source to target <paramref name="destination"/>=Target
        /// or vice versa.
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="sourceFileLanguage"></param>
        /// <param name="targetFileLanguage"></param>
        private void TranslateSelectedEntries(ILoginCredentials login,
                                              string sourceFileLanguage,
                                              string targetFileLanguage,
                                              ProcessDestination destination = ProcessDestination.Target,
                                              CancellationTokenSource cts    = null)
        {
            foreach (EntryDiffViewModel diff in DiffSource.SelectedItems)
            {
                if (cts != null)
                {
                    cts.Token.ThrowIfCancellationRequested();
                }

                List <string> l = null;

                var translator = GetService <ITranslator>();

                switch (destination)
                {
                case ProcessDestination.Source:
                    l = translator.GetTranslatedText(diff.TargetValue,
                                                     targetFileLanguage, sourceFileLanguage,
                                                     login);
                    break;

                case ProcessDestination.Target:
                    l = translator.GetTranslatedText(diff.SourceValue,
                                                     sourceFileLanguage, targetFileLanguage,
                                                     login);
                    break;

                default:
                    throw new NotImplementedException(destination.ToString());
                }

                string translation = string.Empty;
                string newLine     = string.Empty;

                foreach (var item in l)
                {
                    translation += newLine + item;
                    newLine      = "\n";
                }


                switch (destination)
                {
                case ProcessDestination.Source:
                    diff.SetSourceValueComment(translation, (string.IsNullOrEmpty(diff.SourceComment) == true ?
                                                             diff.TargetComment : diff.SourceComment));
                    break;

                case ProcessDestination.Target:
                    diff.SetTargetValueComment(translation, (string.IsNullOrEmpty(diff.TargetComment) == true ?
                                                             diff.SourceComment : diff.TargetComment));
                    break;

                default:
                    throw new NotImplementedException(destination.ToString());
                }
            }

            // Update deatils input view after changing selected item
            DiffSource.SelectedItemBuffer = null;

            if (cts != null)
            {
                cts.Token.ThrowIfCancellationRequested();
            }

            if (DiffSource.SelectedItems.Count == 1)
            {
                // Update deatils input view after changing selected item
                DiffSource.SelectedItemBuffer = DiffSource.SelectedItems[0];
            }
        }
コード例 #13
0
 public Task <ILoginResult> PerformLoginCheck(ILoginCredentials loginCredentials)
 {
     return(Task.FromResult <ILoginResult>(new LoginResult(true, null)));
 }
コード例 #14
0
        public void Login(ILoginCredentials credentials)
        {
            _credentials = credentials as BarclaysLoginCredentials;

            browserBot.WebDriver.Url = Urls.Login;
            browserBot.WebDriver.Navigate();

            //_browserBot.WebDriver.FindElement(By.Id("surname")).SendKeys(_credentials.Surname);

            //// Chosen to use membership number
            //if (_credentials.MembershipNumber != null)
            //{
            //    _browserBot.WebDriver.FindElement(By.Id("membership-radio")).Click();
            //    _browserBot.WebDriver.FindElement(By.Id("membership-num")).SendKeys(_credentials.MembershipNumber);
            //}
            //// Chosen to use card number
            //else if (_credentials.CardNumber != null)
            //{
            //    _browserBot.WebDriver.FindElement(By.Id("card-radio")).Click();

            //    var cardSplit = AccountHelpers.SplitCardNumber(_credentials.CardNumber);
            //    for (var i = 0; i < 4; i++)
            //    {
            //        var fieldId = $"debitCardSet{i + 1}";
            //        _browserBot.WebDriver.FindElement(By.Id(fieldId)).SendKeys(cardSplit[i]);
            //    }
            //}
            //// Chosen to use account details
            //else if (_credentials.SortCode != null || _credentials.AccountNumber != null)
            //{
            //    _browserBot.WebDriver.FindElement(By.Id("account-radio")).Click();

            //    var sortcodeSplit = AccountHelpers.SplitSortCode(_credentials.SortCode);
            //    for (var i = 0; i < 3; i++)
            //    {
            //        var fieldId = $"sortCodeSet{i + 1}";
            //        _browserBot.WebDriver.FindElement(By.Id(fieldId)).SendKeys(sortcodeSplit[i]);
            //    }
            //}
            //else
            //{
            //    throw new InvalidOperationException("Could not determine login procedure from given properties.");
            //}

            //// Advance to stage 2
            //_browserBot.WebDriver.FindElement(By.Id("forward")).Click();

            //_browserBot.WebDriver.FindElement(By.Id("passcode-radio")).Click();
            //_browserBot.WebDriver.FindElement(By.Id("passcode")).SendKeys(_credentials.Passcode);

            //var passcodeCharElements = _browserBot.WebDriver
            //    .FindElement(By.ClassName("letter-select"))
            //    .FindElements(By.TagName("strong"));

            //var passcodeChar1 = _credentials.Passcode[passcodeCharElements[0].Text.AsInteger() - 1].ToString();
            //var passcodeChar2 = _credentials.Passcode[passcodeCharElements[1].Text.AsInteger() - 1].ToString();

            //_browserBot.WebDriver.FindElement(By.Id("nameOne")).SendKeys(passcodeChar1);
            //_browserBot.WebDriver.FindElement(By.Id("nameTwo")).SendKeys(passcodeChar1);

            //_browserBot.WebDriver.FindElement(By.Id("log-in-to-online-banking2")).Click();

            var scriptData = new Dictionary <string, string>
            {
                { "surname", _credentials.Surname },
                { "cardNumber", _credentials.CardNumber },
                { "sortCode", _credentials.SortCode },
                { "membershipNumber", _credentials.MembershipNumber },
                { "accountNumber", _credentials.AccountNumber }
            };

            scriptManager.Execute("barclays-login.js", scriptData, ScriptBundles.ProviderLogin);
        }