예제 #1
0
        public void WhenUserStartsClient()
        {
            var config = ChallengeSessionConfig.ForJourneyId(journeyId)
                         .WithServerHostname(challengeHostname)
                         .WithPort(port)
                         .WithColours(true)
                         .WithAuditStream(auditStream)
                         .WithRecordingSystemShouldBeOn(true);

            ChallengeSession.ForRunner(implementationRunner)
            .WithConfig(config)
            .WithActionProvider(actionProviderCallback)
            .Start();
        }
        /// <summary>
        /// ~~~~~~~~~~ Running the system: ~~~~~~~~~~~~~
        ///
        ///   From IDE:
        ///      Configure the "BeFaster.App" solution to Run on External Console then run.
        ///
        ///   From command line:
        ///      msbuild befaster.sln; src\BeFaster.App\bin\Debug\BeFaster.App.exe
        ///
        ///   To run your unit tests locally:
        ///      Run the "BeFaster.App.Tests - Unit Tests" configuration.
        ///
        /// ~~~~~~~~~~ The workflow ~~~~~~~~~~~~~
        ///
        ///   By running this file you interact with a challenge server.
        ///   The interaction follows a request-response pattern:
        ///        * You are presented with your current progress and a list of actions.
        ///        * You trigger one of the actions by typing it on the console.
        ///        * After the action feedback is presented, the execution will stop.
        ///
        ///   +------+-------------------------------------------------------------+
        ///   | Step | The usual workflow                                          |
        ///   +------+-------------------------------------------------------------+
        ///   |  1.  | Run this file.                                              |
        ///   |  2.  | Start a challenge by typing "start".                        |
        ///   |  3.  | Read description from the "challenges" folder               |
        ///   |  4.  | Implement the required method in                            |
        ///   |      |   .\src\BeFaster.App\Solutions                              |
        ///   |  5.  | Deploy to production by typing "deploy".                    |
        ///   |  6.  | Observe output, check for failed requests.                  |
        ///   |  7.  | If passed, go to step 3.                                    |
        ///   +------+-------------------------------------------------------------+
        ///
        ///   You are encouraged to change this project as you please:
        ///        * You can use your preferred libraries.
        ///        * You can use your own test framework.
        ///        * You can change the file structure.
        ///        * Anything really, provided that this file stays runnable.
        ///
        /// </summary>
        /// <param name="args">Action.</param>
        private static void Main(string[] args)
        {
            var runner = new QueueBasedImplementationRunner.Builder()
                         .SetConfig(Utils.GetRunnerConfig())
                         .WithSolutionFor("sum", p => SumSolution.Sum(p[0].AsInt(), p[1].AsInt()))
                         .WithSolutionFor("hello", p => HelloSolution.Hello(p[0]))
                         .WithSolutionFor("fizz_buzz", p => FizzBuzzSolution.FizzBuzz(p[0].AsInt()))
                         .WithSolutionFor("checkout", p => CheckoutSolution.Checkout(p[0]))
                         .Create();

            ChallengeSession.ForRunner(runner)
            .WithConfig(Utils.GetConfig())
            .WithActionProvider(new UserInputAction(args))
            .Start();

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey();
        }
예제 #3
0
        /// <summary>
        /// ~~~~~~~~~~ Running the system: ~~~~~~~~~~~~~
        ///
        ///   From IDE:
        ///      Configure the "BeFaster.App" solution to Run on External Console then run.
        ///
        ///   From command line:
        ///      msbuild befaster.sln; src\BeFaster.App\bin\Debug\BeFaster.App.exe
        ///        or
        ///      msbuild befaster.sln; mono src/BeFaster.App/bin/Debug/BeFaster.App.exe
        ///
        ///   To run your unit tests locally:
        ///      Run the "BeFaster.App.Tests - Unit Tests" configuration.
        ///
        /// ~~~~~~~~~~ The workflow ~~~~~~~~~~~~~
        ///
        ///   By running this file you interact with a challenge server.
        ///   The interaction follows a request-response pattern:
        ///        * You are presented with your current progress and a list of actions.
        ///        * You trigger one of the actions by typing it on the console.
        ///        * After the action feedback is presented, the execution will stop.
        ///
        ///   +------+-------------------------------------------------------------+
        ///   | Step | The usual workflow                                          |
        ///   +------+-------------------------------------------------------------+
        ///   |  1.  | Run this file.                                              |
        ///   |  2.  | Start a challenge by typing "start".                        |
        ///   |  3.  | Read description from the "challenges" folder               |
        ///   |  4.  | Implement the required method in                            |
        ///   |      |   .\src\BeFaster.App\Solutions                              |
        ///   |  5.  | Deploy to production by typing "deploy".                    |
        ///   |  6.  | Observe output, check for failed requests.                  |
        ///   |  7.  | If passed, go to step 3.                                    |
        ///   +------+-------------------------------------------------------------+
        ///
        ///   You are encouraged to change this project as you please:
        ///        * You can use your preferred libraries.
        ///        * You can use your own test framework.
        ///        * You can change the file structure.
        ///        * Anything really, provided that this file stays runnable.
        ///
        /// </summary>
        /// <param name="args">Action.</param>
        private static void Main(string[] args)
        {
            var runner = new QueueBasedImplementationRunner.Builder().
                         SetConfig(Utils.GetRunnerConfig()).
                         WithSolutionFor("sum", (List <JToken> p) => SumSolution.Sum(p[0].ToObject <int>(), p[1].ToObject <int>())).
                         WithSolutionFor("hello", (List <JToken> p) => HelloSolution.Hello(p[0].ToObject <string>())).
                         WithSolutionFor("array_sum", (List <JToken> p) => ArraySumSolution.Compute((p[0].ToObject <List <int> >()))).
                         WithSolutionFor("int_range", (List <JToken> p) => IntRangeSolution.Generate(p[0].ToObject <int>(), p[1].ToObject <int>())).
                         WithSolutionFor("fizz_buzz", (List <JToken> p) => FizzBuzzSolution.FizzBuzz(p[0].ToObject <int>())).
                         WithSolutionFor("checkout", (List <JToken> p) => CheckoutSolution.Checkout(p[0].ToObject <string>())).
                         Create();

            ChallengeSession.ForRunner(runner)
            .WithConfig(Utils.GetConfig())
            .WithActionProvider(new UserInputAction(args))
            .Start();

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey();
        }
        protected void Login_Click(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["InstitutionID"] == null)
                {
                    Response.Redirect("SelectInstitution.aspx");
                }
                AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name);
                InstitutionDetail insutitutionDetail = svc.GetInstitutionDetails(long.Parse(Request.QueryString["InstitutionID"]));
                InstitutionLogin  instLogin          = new InstitutionLogin();
                Credentials       creds       = new Credentials();
                List <Credential> credentials = new List <Credential>();
                foreach (Control control in LoginControls.Controls)
                {
                    if (control as TextBox != null)
                    {
                        Credential cred       = new Credential();
                        TextBox    loginValue = (TextBox)control;
                        cred.name  = loginValue.Attributes["KeyName"];
                        cred.value = loginValue.Text;
                        credentials.Add(cred);
                    }
                }
                creds.credential          = credentials.ToArray();
                instLogin.AnyIntuitObject = creds;

                Challenges       challenges       = null;
                ChallengeSession challengeSession = null;

                AccountList accountList = svc.DiscoverAndAddAccounts(long.Parse(Request.QueryString["InstitutionID"].ToString()), instLogin, out challenges, out challengeSession);
                Response.Redirect("MyAccounts.aspx?Success");
            }
            catch (Exception ex)
            {
                Master.ErrorMessage = "Error occurred while calling logging into the instituion: " + ex.Message;
            }
        }
예제 #5
0
        internal DiscoverAddModel DiscoverAndAdd(InstitutionModel institutionModel)
        {
            DiscoverAddModel discoverAddModel = new DiscoverAddModel();

            try
            {
                //Demo purposes only.  The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call.
                SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate,
                                                                          AggCatAppSettings.ConsumerKey,
                                                                          AggCatAppSettings.ConsumerSecret,
                                                                          AggCatAppSettings.SamlIdentityProviderId,
                                                                          AggCatAppSettings.CustomerId);
                ServiceContext ctx = new ServiceContext(validator);
                AggregationCategorizationService svc = new AggregationCategorizationService(ctx);

                InstitutionLogin  instLogin   = new InstitutionLogin();
                Credentials       creds       = new Credentials();
                List <Credential> credentials = new List <Credential>();
                Credential        cred        = new Credential();
                cred.name  = institutionModel.InstitutionDetail.keys.FirstOrDefault(k => k.displayOrder == 1).name;
                cred.value = institutionModel.Value1;
                credentials.Add(cred);

                cred       = new Credential();
                cred.name  = institutionModel.InstitutionDetail.keys.FirstOrDefault(k => k.displayOrder == 2).name;
                cred.value = institutionModel.Value2;
                credentials.Add(cred);

                IEnumerable <InstitutionDetailKey> idk = institutionModel.InstitutionDetail.keys.Where(k => k.displayOrder != 1 && k.displayOrder != 2);
                foreach (InstitutionDetailKey item in idk)
                {
                    cred       = new Credential();
                    cred.name  = item.name;
                    cred.value = item.val;
                    credentials.Add(cred);
                }

                creds.credential          = credentials.ToArray();
                instLogin.AnyIntuitObject = creds;

                Challenges       challenges       = null;
                ChallengeSession challengeSession = null;
                AccountList      accountList      = svc.DiscoverAndAddAccounts(institutionModel.InstitutionDetail.institutionId, instLogin, out challenges, out challengeSession);
                discoverAddModel.AccountList      = accountList;
                discoverAddModel.Challenges       = challenges;
                discoverAddModel.ChallengeSession = challengeSession;
                discoverAddModel.Success          = true;
                discoverAddModel.Error            = null;
                if (accountList == null && challenges != null)
                {
                    discoverAddModel.MFA = true;
                }
            }
            catch (AggregationCategorizationException ex)
            {
                discoverAddModel.AccountList      = null;
                discoverAddModel.Challenges       = null;
                discoverAddModel.ChallengeSession = null;
                discoverAddModel.Success          = false;
                discoverAddModel.Error            = ex.ToString();
            }

            return(discoverAddModel);
        }