private void CheckForCoreData(IDocumentStore ds, IContext context) { // In case the versioning bundle is installed, make sure it will version // only what we opt-in to version using (IDocumentSession s = ds.OpenSession()) { var store = new FlexMembershipUserStore <User, Role>(s); var membership = new FlexMembershipProvider(store, new AspnetEnvironment()); var roles = new FlexRoleProvider(store); if (!membership.HasLocalAccount("sallen")) { membership.CreateAccount(new User { Username = "******", Password = "******", FavoriteNumber = 24 }); } if (!roles.RoleExists("admin")) { roles.CreateRole("admin"); } if (!roles.IsUserInRole("sallen", "admin")) { roles.AddUsersToRoles(new[] { "sallen" }, new[] { "admin" }); } } }
protected override void Seed(Models.MovieDb context) { var seed = ConfigurationManager.AppSettings["seed"]; if (seed != "false") { var membership = new FlexMembershipProvider(new UserStore(context), new AspnetEnvironment()); var roles = new FlexRoleProvider(new RoleStore(context)); if (!membership.HasLocalAccount("sallen")) { membership.CreateAccount(new User { Username = "******", Password = "******", FavoriteNumber = 24 }); } if (!roles.RoleExists("admin")) { roles.CreateRole("admin"); } if (!roles.IsUserInRole("sallen", "admin")) { roles.AddUsersToRoles(new[] { "sallen" }, new[] { "admin" }); } } base.Seed(context); }
protected override void ApplicationStartup(TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { base.ApplicationStartup(container, pipelines); CookieBasedSessions.Enable(pipelines); Conventions.ViewLocationConventions.Add((viewName, model, context) => string.Concat("views/", viewName)); Conventions.StaticContentsConventions.Add( StaticContentConventionBuilder.AddDirectory("assets", @"assets") ); container.Register <IFlexUserStore, FlexMembershipUserStore <User, Role> >(); container.Register(typeof(IDocumentStore), InitDocStore()); container.Register(typeof(IDocumentSession), (c, overloads) => c.Resolve <IDocumentStore>().OpenSession()); var cryptographyConfiguration = new CryptographyConfiguration( new RijndaelEncryptionProvider(new PassphraseKeyGenerator(Configuration.EncryptionKey, new byte[] { 8, 2, 10, 4, 68, 120, 7, 14 })), new DefaultHmacProvider(new PassphraseKeyGenerator(Configuration.HmacKey, new byte[] { 1, 20, 73, 49, 25, 106, 78, 86 }))); var authenticationConfiguration = new FormsAuthenticationConfiguration() { CryptographyConfiguration = cryptographyConfiguration, RedirectUrl = "/login", UserMapper = container.Resolve <IUserMapper>(), }; FormsAuthentication.Enable(pipelines, authenticationConfiguration); FlexMembershipProvider.RegisterClient( new GoogleOpenIdClient(), "Google", new Dictionary <string, object>()); }
public IntegrationTest() { var context = new SomeDb("name=Default"); _db = new TestDb(); UserStore = new UserStore(context); RoleStore = new RoleStore(context); Environment = new FakeApplicationEnvironment(); RoleProvider = new FlexRoleProvider(RoleStore); MembershipProvider = new FlexMembershipProvider(UserStore, Environment); }
public IntegrationTest() { DocumentStore = new EmbeddableDocumentStore() { RunInMemory = true }; DocumentStore.RegisterListener(new NoStaleQueries()); DocumentStore.Initialize(); Session = DocumentStore.OpenSession(); UserStore = new FlexMembershipUserStore <User, Role>(Session); Environment = new FakeApplicationEnvironment(); RoleProvider = new FlexRoleProvider(UserStore); MembershipProvider = new FlexMembershipProvider(UserStore, Environment); }
public static void RegisterAuth() { // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter, // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166 //FlexMembershipProvider.RegisterClient( // new MicrosoftClient("", ""), // "Microsoft", new Dictionary<string, object>()); //FlexMembershipProvider.RegisterClient( // new TwitterClient("", ""), // "Twitter", new Dictionary<string, object>()); //FlexMembershipProvider.RegisterClient( // new FacebookClient("", ""), // "Facebook", new Dictionary<string, object>()); FlexMembershipProvider <User> .RegisterClient( new GoogleOpenIdClient(), "Google", new Dictionary <string, object>()); }
public static void RegisterAuth() { // To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter, // you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166 //OAuthWebSecurity.RegisterMicrosoftClient( // clientId: "", // clientSecret: ""); //OAuthWebSecurity.RegisterTwitterClient( // consumerKey: "", // consumerSecret: ""); //OAuthWebSecurity.RegisterFacebookClient( // appId: "", // appSecret: ""); //OAuthWebSecurity.RegisterGoogleClient(); FlexMembershipProvider.RegisterClient( new GoogleOpenIdClient(), "Google", new Dictionary <string, object>()); }