public static IdentityServerServiceFactory Configure()
        {
            var factory = new IdentityServerServiceFactory();

            var scopeStore = new InMemoryScopeStore(Scopes.Get());
            factory.ScopeStore = new Registration<IScopeStore>(resolver => scopeStore);
            
            var clientStore = new InMemoryClientStore(Clients.Get());
            factory.ClientStore = new Registration<IClientStore>(resolver => clientStore);            
            //var corsPolicyService = new CorsPolicyService();
            //factory.CorsPolicyService = new Registration<ICorsPolicyService>(ressolver => corsPolicyService);

            var origns = new List<string>();
            
            origns.Add("http://thebeast.com:15831");
            origns.Add("http://localhost:15831");
            origns.Add("http://localhost:15832");
            origns.Add("http://karamaangular.azurewebsites.net");

            var defaultCorsPolicyService = new DefaultCorsPolicyService() { AllowAll = false, AllowedOrigins = origns };
            factory.CorsPolicyService = new Registration<ICorsPolicyService>(ressolver => defaultCorsPolicyService);

            /*            factory.ConfigureDefaultViewService(new DefaultViewServiceOptions(){})*/
            ;
            return factory;
        }
        public void ctor_CopiesCorsPolicyOrigins()
        {
            var policy = new CorsPolicy();
            policy.AllowedOrigins.Add("http://foo");
            policy.AllowedOrigins.Add("http://bar");
            policy.AllowedOrigins.Add("http://baz");

            Func<string, Task<bool>> func = s => Task.FromResult(true);
            policy.PolicyCallback = func;

            subject = new DefaultCorsPolicyService(policy);
            subject.AllowedOrigins.ShouldAllBeEquivalentTo(new string[] { "http://foo", "http://bar", "http://baz" });
        }
        public void ctor_UsesCorsPolicyCallback()
        {
            var wasCalled = false;
            var policy = new CorsPolicy();
            Func<string, Task<bool>> func = s => { wasCalled = true; return Task.FromResult(true); };
            policy.PolicyCallback = func;

            subject = new DefaultCorsPolicyService(policy);
            var result = subject.IsOriginAllowedAsync("http://foo").Result;
            result.Should().Be(true);
            wasCalled.Should().Be(true);
        }
 public DefaultCorsPolicyServiceTests()
 {
     subject = new DefaultCorsPolicyService();
 }