예제 #1
0
 public EndpointRouterTests()
 {
     _pathMap   = new Dictionary <string, IdentityServer4.Hosting.Endpoint>();
     _endpoints = new List <IdentityServer4.Hosting.Endpoint>();
     _options   = new IdentityServerOptions();
     _subject   = new EndpointRouter(_endpoints, _options, TestLogger.Create <EndpointRouter>());
 }
 public EndpointRouterTests()
 {
     _pathMap  = new Dictionary <string, EndpointName>();
     _mappings = new List <EndpointMapping>();
     _options  = new IdentityServerOptions();
     _subject  = new EndpointRouter(_pathMap, _options, _mappings, TestLogger.Create <EndpointRouter>());
 }
예제 #3
0
        public void can_handle_localhost_consistently_2()
        {
            var router        = new EndpointRouter();
            var uri           = new Uri("http://127.0.0.1/blahdee");
            var normalizedUri = uri.NormalizeLocalhost();
            var routeFrom     = new Uri("http://remotehost/zippee");

            router.RemapEndpoint(routeFrom, uri);

            Assert.Equal(normalizedUri, router.GetRoutedEndpoint(routeFrom).Uri);
        }
예제 #4
0
        private void MessageReceivedOnChannel(object sender, MessageReceivedOnChannelArgs e)
        {
            TransportMessage messageToSend = e.Message;

            messageToSend.ReplyToAddress = replyToAddress;

            Address destination = EndpointRouter.GetDestinationFor(messageToSend);

            Logger.Info("Sending message to " + destination);

            MessageSender.Send(messageToSend, destination);
        }
예제 #5
0
        public void can_handle_localhost_consistently()
        {
            var router        = new EndpointRouter();
            var uri           = new Uri("http://lOcAlHoSt/blahdee");
            var normalizedUri = uri.NormalizeLocalhost();
            var routeTo       = new Uri("http://remotehost/zippee");

            router.RemapEndpoint(uri, routeTo);

            Assert.Equal(routeTo, router.GetRoutedEndpoint(normalizedUri).Uri);
            Assert.Equal(routeTo, router.GetRoutedEndpoint(uri).Uri);
        }
        public void endpoints_should_be_bound_to_requests(string endpointPath)
        {
            var map = new Dictionary <string, Type> {
                { endpointPath, typeof(MyEndpoint) }
            };
            var subject = new EndpointRouter(map);

            var ctx = new DefaultHttpContext();

            ctx.Request.Path    = new PathString("/endpoint1");
            ctx.RequestServices = new StubServiceProvider();

            var result = subject.Find(ctx);

            result.Should().BeOfType <MyEndpoint>();
        }
예제 #7
0
 public GatewayReceiverStartupTask(IManageReceiveChannels channelManager, Func <string, IChannelReceiver> channelReceiverFactory, EndpointRouter endpointRouter, IDispatchMessages dispatcher, IDeduplicateMessages deduplicator, IDataBus databus, string replyToAddress)
 {
     dispatchMessages            = dispatcher;
     this.deduplicator           = deduplicator;
     this.databus                = databus;
     this.endpointRouter         = endpointRouter;
     manageReceiveChannels       = channelManager;
     this.channelReceiverFactory = channelReceiverFactory;
     this.replyToAddress         = replyToAddress;
 }
 public GatewayReceiverStartupTask(IManageReceiveChannels channelManager, Func <string, IChannelReceiver> channelReceiverFactory, EndpointRouter endpointRouter, IMessageDispatcher dispatcher, IGatewayDeduplicationStorage deduplicationStorage, IDataBus databus, string replyToAddress, TransportTransactionMode transportTransactionMode)
 {
     dispatchMessages          = dispatcher;
     this.deduplicationStorage = deduplicationStorage;
     this.databus                  = databus;
     this.endpointRouter           = endpointRouter;
     manageReceiveChannels         = channelManager;
     this.channelReceiverFactory   = channelReceiverFactory;
     this.replyToAddress           = replyToAddress;
     this.transportTransactionMode = transportTransactionMode;
 }
예제 #9
0
 public static IMiddlewareBuilder <TContext> UseRouting <TContext>(this IMiddlewareBuilder <TContext> self) where TContext : Context
 => self.Use(EndpointRouter.CreateRoutingSetupMiddlewareFactory(self));
예제 #10
0
 public static IMiddlewareBuilder <TContext> UseEndpoints <TContext>(this IMiddlewareBuilder <TContext> self, Action <IEndpointRouteBuilder <TContext> > endpoints) where TContext : Context
 => self.Use(EndpointRouter.CreateEndpointDispatcherMiddlewareFactory(self, endpoints));