summaryrefslogtreecommitdiffstats
path: root/samples/OpenIdProviderMvc/Controllers/UserController.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-11-03 11:48:03 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-11-03 11:48:03 -0800
commit71bc6d9e10f7f49e6229121d8257c90df2563cb1 (patch)
tree8839cc1d705decc7f59c6f38842a1fdb946dbeeb /samples/OpenIdProviderMvc/Controllers/UserController.cs
parent1328af341acee67bc7b3cdff1f8d6b0151a429cd (diff)
downloadDotNetOpenAuth-71bc6d9e10f7f49e6229121d8257c90df2563cb1.zip
DotNetOpenAuth-71bc6d9e10f7f49e6229121d8257c90df2563cb1.tar.gz
DotNetOpenAuth-71bc6d9e10f7f49e6229121d8257c90df2563cb1.tar.bz2
Updated the way the MVC Provider sample handles XRDS, PPID and normal user identities.
Diffstat (limited to 'samples/OpenIdProviderMvc/Controllers/UserController.cs')
-rw-r--r--samples/OpenIdProviderMvc/Controllers/UserController.cs33
1 files changed, 18 insertions, 15 deletions
diff --git a/samples/OpenIdProviderMvc/Controllers/UserController.cs b/samples/OpenIdProviderMvc/Controllers/UserController.cs
index 4fc2f9f..5e0c21f 100644
--- a/samples/OpenIdProviderMvc/Controllers/UserController.cs
+++ b/samples/OpenIdProviderMvc/Controllers/UserController.cs
@@ -7,25 +7,28 @@ namespace OpenIdProviderMvc.Controllers {
using System.Web.Mvc.Ajax;
public class UserController : Controller {
- public ActionResult PpidIdentity() {
- if (Request.AcceptTypes.Contains("application/xrds+xml")) {
- return View("Xrds");
- }
-
- 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;
+ if (!anon) {
+ this.ViewData["username"] = id;
+ }
+
return View();
}
@@ -33,8 +36,8 @@ namespace OpenIdProviderMvc.Controllers {
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);
}