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/OAuthAuthorizationServer/Controllers/AccountController.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/OAuthAuthorizationServer/Controllers/AccountController.cs')
-rw-r--r-- | samples/OAuthAuthorizationServer/Controllers/AccountController.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/samples/OAuthAuthorizationServer/Controllers/AccountController.cs b/samples/OAuthAuthorizationServer/Controllers/AccountController.cs index d69a3b5..336f9bd 100644 --- a/samples/OAuthAuthorizationServer/Controllers/AccountController.cs +++ b/samples/OAuthAuthorizationServer/Controllers/AccountController.cs @@ -1,13 +1,12 @@ namespace OAuthAuthorizationServer.Controllers { using System; using System.Linq; + using System.Threading.Tasks; using System.Web.Mvc; using System.Web.Security; - using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.RelyingParty; - using OAuthAuthorizationServer.Code; using OAuthAuthorizationServer.Models; @@ -21,16 +20,17 @@ } [HttpPost] - public ActionResult LogOn(LogOnModel model, string returnUrl) { + public async Task<ActionResult> LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { var rp = new OpenIdRelyingParty(); - var request = rp.CreateRequest(model.UserSuppliedIdentifier, Realm.AutoDetect, new Uri(Request.Url, Url.Action("Authenticate"))); + var request = await rp.CreateRequestAsync(model.UserSuppliedIdentifier, Realm.AutoDetect, new Uri(Request.Url, Url.Action("Authenticate")), Response.ClientDisconnectedToken); if (request != null) { if (returnUrl != null) { request.AddCallbackArguments("returnUrl", returnUrl); } - return request.RedirectingResponse.AsActionResult(); + var response = await request.GetRedirectingResponseAsync(Response.ClientDisconnectedToken); + return response.AsActionResult(); } else { ModelState.AddModelError(string.Empty, "The identifier you supplied is not recognized as a valid OpenID Identifier."); } @@ -40,9 +40,9 @@ return View(model); } - public ActionResult Authenticate(string returnUrl) { + public async Task<ActionResult> Authenticate(string returnUrl) { var rp = new OpenIdRelyingParty(); - var response = rp.GetResponse(); + var response = await rp.GetResponseAsync(Request, Response.ClientDisconnectedToken); if (response != null) { switch (response.Status) { case AuthenticationStatus.Authenticated: |