diff options
Diffstat (limited to 'samples/OpenIdProviderMvc/Global.asax.cs')
-rw-r--r-- | samples/OpenIdProviderMvc/Global.asax.cs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/samples/OpenIdProviderMvc/Global.asax.cs b/samples/OpenIdProviderMvc/Global.asax.cs index 8c57961..8390c46 100644 --- a/samples/OpenIdProviderMvc/Global.asax.cs +++ b/samples/OpenIdProviderMvc/Global.asax.cs @@ -14,21 +14,19 @@ /// visit http://go.microsoft.com/?LinkId=9394801 /// </remarks> public class MvcApplication : System.Web.HttpApplication { + private static object behaviorInitializationSyncObject = new object(); + public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "User identities", "user/{id}/{action}", - new { controller = "User", action = "Identity", id = string.Empty }); + new { controller = "User", action = "Identity", id = string.Empty, anon = false }); routes.MapRoute( "PPID identifiers", "anon", - new { controller = "User", action = "PpidIdentity", id = string.Empty }); - routes.MapRoute( - "PpidXrds", - "PpidXrds", - new { controller = "Home", action = "PpidXrds" }); // Parameter defaults + new { controller = "User", action = "Identity", id = string.Empty, anon = true }); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters @@ -38,5 +36,20 @@ protected void Application_Start() { RegisterRoutes(RouteTable.Routes); } + + protected void Application_BeginRequest(object sender, EventArgs e) { + InitializeBehaviors(); + } + + private static void InitializeBehaviors() { + if (DotNetOpenAuth.OpenId.Behaviors.PpidGeneration.PpidIdentifierProvider == null) { + lock (behaviorInitializationSyncObject) { + if (DotNetOpenAuth.OpenId.Behaviors.PpidGeneration.PpidIdentifierProvider == null) { + DotNetOpenAuth.OpenId.Behaviors.PpidGeneration.PpidIdentifierProvider = new Code.AnonymousIdentifierProvider(); + DotNetOpenAuth.OpenId.Behaviors.GsaIcamProfile.PpidIdentifierProvider = new Code.AnonymousIdentifierProvider(); + } + } + } + } } }
\ No newline at end of file |