public void Configuration(IAppBuilder app)
 {
     app.Map(
         "/core",
         coreApp => {
         coreApp.UseIdentityServer(new IdentityServerOptions
         {
             SiteName           = "Standalone Identity Server",
             SigningCertificate = Cert.Load(),
             Factory            = new IdentityServerServiceFactory()
                                  .UseInMemoryClients(Clients.Get())
                                  .UseInMemoryScopes(Scopes.Get())
                                  .UseInMemoryUsers(Users.Get()),
             PluginConfiguration = ConfigurePlugins,
             RequireSsl          = true
         });
     });
 }
示例#2
0
        private void ConfigureSecurity(IServiceCollection services)
        {
            var identityServer = services.AddIdentityServer(options =>
            {
                // Use ONLY for developing! Never use this in production. Never.
                options.IssuerUri = "http://localhost:5001/";
            });

            //needed?
            identityServer.AddInMemoryStores();

            identityServer.AddInMemoryClients(Clients.Get());
            identityServer.AddInMemoryScopes(Scopes.Get());
            identityServer.AddInMemoryUsers(Users.Get());

            // Enable CORS on identity server
            identityServer.Services.AddTransient <ICorsPolicyService>(p => {
                var corsService      = new DefaultCorsPolicyService(p.GetRequiredService <ILogger <DefaultCorsPolicyService> >());
                corsService.AllowAll = true;
                return(corsService);
            });
        }