public ActionResult Login(SamlLoginModel model) { if (ModelState.IsValid) { AccountSettings accountSettings = new AccountSettings(); var samlResponse = new Response(accountSettings); samlResponse.LoadXmlFromBase64(model.SAMLResponse); if (samlResponse.IsValid()) { FormsAuthentication.SetAuthCookie(samlResponse.GetNameID(), true); // Redirect to targetURL, or to /Home by default return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } } else { ModelState.AddModelError("", "The user name or password provided is incorrect."); } // If we got this far, something failed, redisplay form return View(model); }
public AuthRequest(AppSettings appSettings, AccountSettings accountSettings) { this.appSettings = appSettings; this.accountSettings = accountSettings; id = "_" + System.Guid.NewGuid().ToString(); issue_instant = DateTime.UtcNow.ToString("yyyy-mm-ddTH:mm:ssZ"); }
public ActionResult Login() { AccountSettings accountSettings = new AccountSettings(); AuthRequest req = new AuthRequest(new AppSettings(), accountSettings); return this.Redirect(accountSettings.idp_sso_target_url + "?SAMLRequest=" + Server.UrlEncode(req.GetRequest(AuthRequest.AuthRequestFormat.Base64))); }
public Response(AccountSettings accountSettings) { this.accountSettings = accountSettings; certificate = new Certificate(); certificate.LoadCertificate(accountSettings.certificate); }