static Global() { CommitId = ConfigurationManager.AppSettings.Get("appharbor.commit_id"); var settings = LoadSettings(); var integrationPath = settings["DataPath"]; var contracts = Contracts.CreateStreamer(); var strategy = new DocumentStrategy(); if (integrationPath.StartsWith("file:")) { var path = integrationPath.Remove(0, 5); var config = FileStorage.CreateConfig(path); Docs = config.CreateNuclear(strategy).Container; Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue)); } else if (integrationPath.StartsWith("azure:")) { var path = integrationPath.Remove(0, 6); var config = AzureStorage.CreateConfig(path); Docs = config.CreateNuclear(strategy).Container; Client = new WebEndpoint(new NuclearStorage(Docs), contracts, config.CreateQueueWriter(Topology.RouterQueue)); } else { throw new InvalidOperationException("Unsupperted environment"); } Forms = new FormsAuth(Docs.GetReader<UserId, LoginView>()); Auth = new WebAuth(Client); }
/// <summary> /// Initializes the session, using the auth information /// associated with the current request /// </summary> public static void InitializeSessionFromRequest() { var context = HttpContext.Current; // we are fine if (context.Session[AccountSessionKey] != null) { return; } // unauthenticated session here if (!context.Request.IsAuthenticated) { return; } // authenticated session but without our data. // recover expired session (or use cookie) Debug.WriteLine("Session initialization attempt"); FormsAuth .GetSessionIdentityFromRequest() .Apply(InitializeSession); }