private static IdentityAdminServiceFactory CreateIdentityAdminServiceFactory()
        {
            var factory = new IdentityAdminServiceFactory
            {
                IdentityAdminService = new Registration <IIdentityAdminService, InMemoryIdentityManagerService>()
            };
            var rand    = new System.Random();
            var clients = ClientSeeder.Get(rand.Next(1000, 3000));
            var scopes  = ScopeSeeder.Get(rand.Next(15));

            factory.Register(new Registration <ICollection <InMemoryScope> >(scopes));
            factory.Register(new Registration <ICollection <InMemoryClient> >(clients));
            return(factory);
        }
Beispiel #2
0
        public IdentityAdminOptions GetAdminOptions()
        {
            var factory = new IdentityAdminServiceFactory
            {
                IdentityAdminService = new Registration <IIdentityAdminService, InMemoryIdentityAdminService>()
            };

            var rand    = new System.Random();
            var clients = ClientSeeder.Get(rand.Next(1000, 3000));
            var scopes  = ScopeSeeder.Get(rand.Next(15));

            factory.Register(new Registration <ICollection <InMemoryScope> >(scopes));
            factory.Register(new Registration <ICollection <InMemoryClient> >(clients));

            return(new IdentityAdminOptions
            {
                Factory = factory
            });
        }
        public void Configuration(IAppBuilder app)
        {
            LogProvider.SetCurrentLogProvider(new TraceSourceLogProvider());

            app.Map("/admin", adminApp =>
            {
                var factory = new IdentityAdminServiceFactory
                {
                    IdentityAdminService = new Registration <IIdentityAdminService, InMemoryIdentityManagerService>()
                };
                var rand    = new System.Random();
                var clients = ClientSeeder.Get(rand.Next(1000, 3000));
                var scopes  = ScopeSeeder.Get(rand.Next(15));
                factory.Register(new Registration <ICollection <InMemoryScope> >(scopes));
                factory.Register(new Registration <ICollection <InMemoryClient> >(clients));
                adminApp.UseIdentityAdmin(new IdentityAdminOptions
                {
                    Factory = factory
                });
            });
        }