summaryrefslogtreecommitdiffstats
path: root/samples/OpenIdProviderMvc/Controllers/UserController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'samples/OpenIdProviderMvc/Controllers/UserController.cs')
-rw-r--r--samples/OpenIdProviderMvc/Controllers/UserController.cs37
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;
+ }
+ }
+}