diff options
Diffstat (limited to 'samples/OpenIdProviderMvc/Controllers/UserController.cs')
-rw-r--r-- | samples/OpenIdProviderMvc/Controllers/UserController.cs | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/samples/OpenIdProviderMvc/Controllers/UserController.cs b/samples/OpenIdProviderMvc/Controllers/UserController.cs index 8b3f944..5e0c21f 100644 --- a/samples/OpenIdProviderMvc/Controllers/UserController.cs +++ b/samples/OpenIdProviderMvc/Controllers/UserController.cs @@ -7,38 +7,37 @@ namespace OpenIdProviderMvc.Controllers { using System.Web.Mvc.Ajax; public class UserController : Controller { - public ActionResult PpidIdentity() { - if (Request.AcceptTypes.Contains("application/xrds+xml")) { - return View("PpidXrds"); - } - - return View(); - } - - public ActionResult Identity(string id) { - var redirect = this.RedirectIfNotNormalizedRequestUri(); - if (redirect != null) { - return redirect; + /// <summary> + /// Identities the specified id. + /// </summary> + /// <param name="id">The username or anonymous identifier.</param> + /// <param name="anon">if set to <c>true</c> then <paramref name="id"/> represents an anonymous identifier rather than a username.</param> + /// <returns>The view to display.</returns> + public ActionResult Identity(string id, bool anon) { + if (!anon) { + var redirect = this.RedirectIfNotNormalizedRequestUri(id); + if (redirect != null) { + return redirect; + } } if (Request.AcceptTypes != null && Request.AcceptTypes.Contains("application/xrds+xml")) { return View("Xrds"); } - this.ViewData["username"] = id; - return View(); - } + if (!anon) { + this.ViewData["username"] = id; + } - public ActionResult Xrds(string id) { return View(); } - public ActionResult PpidXrds() { + public ActionResult Xrds(string id) { return View(); } - private ActionResult RedirectIfNotNormalizedRequestUri() { - Uri normalized = Models.User.GetNormalizedClaimedIdentifier(Request.Url); + private ActionResult RedirectIfNotNormalizedRequestUri(string user) { + Uri normalized = Models.User.GetClaimedIdentifierForUser(user); if (Request.Url != normalized) { return Redirect(normalized.AbsoluteUri); } |