示例#1
0
        public void Configuration(IAppBuilder app)
        {
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
            var certificate            = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]);
            var entityFrameworkOptions = new EntityFrameworkServiceOptions
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["TimeKeeperIdentity"].ConnectionString
            };

            var inMemo = new InMemoryManager();

            SetupClients(inMemo.GetClients(), entityFrameworkOptions);
            SetupScopes(inMemo.GetScopes(), entityFrameworkOptions);

            var unitOfWork = new UnitOfWork();
            var factory    = new IdentityServerServiceFactory();

            factory.RegisterConfigurationServices(entityFrameworkOptions);
            factory.RegisterOperationalServices(entityFrameworkOptions);
            factory.UserService = new Registration <IUserService>(typeof(TimeKeeperUserService));
            factory.Register(new Registration <UnitOfWork>(unitOfWork));

            var options = new IdentityServerOptions
            {
                SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]),
                RequireSsl         = false,
                Factory            = factory
            };

            app.UseIdentityServer(options);
        }
示例#2
0
        public void Configuration(IAppBuilder app)
        {
            var entityFrameworkOptions = new EntityFrameworkServiceOptions
            {
                ConnectionString = ConfigurationManager.ConnectionStrings["TimeIdentity"].ConnectionString
            };

            var inMemo = new InMemoryManager();

            SetupClients(inMemo.GetClients(), entityFrameworkOptions);
            SetupScopes(inMemo.GetScopes(), entityFrameworkOptions);

            var unitOfWork = new UnitOfWork();
            var factory    = new IdentityServerServiceFactory();

            factory.RegisterConfigurationServices(entityFrameworkOptions);
            factory.RegisterOperationalServices(entityFrameworkOptions);
            factory.UserService = new Registration <IUserService>(typeof(TimeUserService));
            factory.Register(new Registration <UnitOfWork>(unitOfWork));

            var certificate = Convert.FromBase64String(ConfigurationManager.AppSettings["SigningCertificate"]);
            var options     = new IdentityServerOptions
            {
                SigningCertificate = new X509Certificate2(certificate, ConfigurationManager.AppSettings["SigningCertificatePassword"]),
                RequireSsl         = false,
                Factory            = factory,
            };

            app.UseIdentityServer(options);
        }