Beispiel #1
0
        internal DiscoverAddModel DiscoverAndAddResponse(DiscoverAddModel model)
        {
            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);
                ChallengeResponses challengeResponses = new ChallengeResponses();
                if (model.Challenges.challenge[0].AnyIntuitObjects.Count() == 2)
                {
                    if (model.UseSame)
                    {
                        challengeResponses.response = new string[] { model.Challenges.challenge[0].AnyIntuitObjects[1].ToString() };
                    }
                }
                else
                {
                    challengeResponses.response = new string[] { model.Answer };
                }

                AccountList accountList = svc.DiscoverAndAddAccountsResponse(challengeResponses, model.ChallengeSession);
                model.AccountList = accountList;
                model.Success     = true;
                model.Error       = null;
            }
            catch (AggregationCategorizationException ex)
            {
                model.AccountList = null;
                model.Success     = false;
                model.Error       = ex.ToString();
            }

            return(model);
        }
        internal DiscoverAddModel DiscoverAndAddResponse(DiscoverAddModel model)
        {
            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);
                ChallengeResponses challengeResponses = new ChallengeResponses();
                if (model.Challenges.challenge[0].AnyIntuitObjects.Count() == 2)
                {
                    if (model.UseSame)
                    {
                        challengeResponses.response = new string[] { model.Challenges.challenge[0].AnyIntuitObjects[1].ToString() };
                    }
                }
                else
                {
                    challengeResponses.response = new string[] { model.Answer };
                }

                AccountList accountList = svc.DiscoverAndAddAccountsResponse(challengeResponses, model.ChallengeSession);
                model.AccountList = accountList;
                model.Success = true;
                model.Error = null;
            }
            catch (AggregationCategorizationException ex)
            {
                model.AccountList = null;
                model.Success = false;
                model.Error = ex.ToString();
            }

            return model;
        }