diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-26 11:19:06 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-26 11:19:06 -0700 |
commit | 3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb (patch) | |
tree | c15816c3d7f6e74334553f2ff98605ce1c22c538 /samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs | |
parent | 5e9014f36b2d53b8e419918675df636540ea24e2 (diff) | |
parent | e6f7409f4caceb7bc2a5b4ddbcb1a4097af340f2 (diff) | |
download | DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.zip DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.gz DotNetOpenAuth-3d37ff45cab6838d80b22e6b782a0b9b4c2f4aeb.tar.bz2 |
Move to HttpClient throughout library.
Diffstat (limited to 'samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs')
-rw-r--r-- | samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs b/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs index 3ff405f..41a090f 100644 --- a/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs +++ b/samples/OpenIdRelyingPartyMvc/Controllers/UserController.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; + using System.Threading.Tasks; using System.Web; using System.Web.Mvc; using System.Web.Security; @@ -31,14 +32,16 @@ } [ValidateInput(false)] - public ActionResult Authenticate(string returnUrl) { - var response = openid.GetResponse(); + public async Task<ActionResult> Authenticate(string returnUrl) { + var response = await openid.GetResponseAsync(this.Request, this.Response.ClientDisconnectedToken); if (response == null) { // Stage 2: user submitting Identifier Identifier id; if (Identifier.TryParse(Request.Form["openid_identifier"], out id)) { try { - return openid.CreateRequest(Request.Form["openid_identifier"]).RedirectingResponse.AsActionResult(); + var request = await openid.CreateRequestAsync(Request.Form["openid_identifier"]); + var redirectingResponse = await request.GetRedirectingResponseAsync(this.Response.ClientDisconnectedToken); + return redirectingResponse.AsActionResult(); } catch (ProtocolException ex) { ViewData["Message"] = ex.Message; return View("Login"); @@ -52,7 +55,8 @@ switch (response.Status) { case AuthenticationStatus.Authenticated: Session["FriendlyIdentifier"] = response.FriendlyIdentifierForDisplay; - FormsAuthentication.SetAuthCookie(response.ClaimedIdentifier, false); + var cookie = FormsAuthentication.GetAuthCookie(response.ClaimedIdentifier, false); + Response.SetCookie(cookie); if (!string.IsNullOrEmpty(returnUrl)) { return Redirect(returnUrl); } else { |