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; }
public ActionResult DiscoverAndAddChallenge(DiscoverAddModel dam) { DiscoverAddModel model = Session["DAM"] as DiscoverAddModel; model.UseSame = dam.UseSame; model.Answer = dam.Answer; model = this.serviceOperations.DiscoverAndAddResponse(model); Session["DAM"] = model; return RedirectToAction("DiscoverAndAddResult", "Institutions"); }
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; }