diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-16 09:22:08 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-16 09:22:08 -0700 |
commit | 45068758daa9d7747565af3f95bea7abfa2db54a (patch) | |
tree | b11c17d32763b77e4bfc03005e202b0c14e8bbdf /samples/OpenIdProviderMvc/Controllers/UserController.cs | |
parent | e72da4887ebf36073d1235e28e44b44004602311 (diff) | |
download | DotNetOpenAuth-45068758daa9d7747565af3f95bea7abfa2db54a.zip DotNetOpenAuth-45068758daa9d7747565af3f95bea7abfa2db54a.tar.gz DotNetOpenAuth-45068758daa9d7747565af3f95bea7abfa2db54a.tar.bz2 |
Added ASP.NET MVC OpenID Provider sample.
Diffstat (limited to 'samples/OpenIdProviderMvc/Controllers/UserController.cs')
-rw-r--r-- | samples/OpenIdProviderMvc/Controllers/UserController.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/samples/OpenIdProviderMvc/Controllers/UserController.cs b/samples/OpenIdProviderMvc/Controllers/UserController.cs new file mode 100644 index 0000000..70bea04 --- /dev/null +++ b/samples/OpenIdProviderMvc/Controllers/UserController.cs @@ -0,0 +1,37 @@ +namespace OpenIdProviderMvc.Controllers { + using System; + using System.Collections.Generic; + using System.Linq; + using System.Web; + using System.Web.Mvc; + using System.Web.Mvc.Ajax; + + public class UserController : Controller { + public ActionResult Identity(string id) { + var redirect = this.RedirectIfNotNormalizedRequestUri(); + if (redirect != null) { + return redirect; + } + + if (Request.AcceptTypes.Contains("application/xrds+xml")) { + return View("Xrds"); + } + + this.ViewData["username"] = id; + return View(); + } + + public ActionResult Xrds(string id) { + return View(); + } + + private ActionResult RedirectIfNotNormalizedRequestUri() { + Uri normalized = Models.User.GetNormalizedClaimedIdentifier(Request.Url); + if (Request.Url != normalized) { + return Redirect(normalized.AbsoluteUri); + } + + return null; + } + } +} |