Exemplo n.º 1
0
        static void Main(string[] args)
        {
            AuthMethods    authMethods = new AuthMethods();
            IChannelServer host        = ChannelServerBuilder.CreateServer();

            host.LoadAssemblies(AppDomain.CurrentDomain, null);
            host.AddTokenAuthentication(authMethods.AuthenticateToken);
            host.StartHosting(null);

            Console.ReadLine();
        }
        public static IApplicationBuilder UseNuclearChannels(this IApplicationBuilder app)
        {
            _server.LoadAssemblies(_appDomain);
            if (_tokenValidationDelegate != null)
            {
                _server.AuthenticationOptions(_tokenValidationDelegate);
            }
            if (_basicValidationDelegate != null)
            {
                _server.AuthenticationOptions(_basicValidationDelegate);
            }

            _server.StartHosting(_baseUrl);
            return(app);
        }
        static void Main(string[] args)
        {
            AuthMethods    authMethods = new AuthMethods();
            IChannelServer host        = ChannelServerBuilder.CreateServer();
            //host.LoadAssemblies(AppDomain.CurrentDomain, null);
            List <string> asm = new List <string>
            {
                "Nuclear.Channels.Monolithic.Tests"
            };

            host.RegisterChannels(asm);
            host.AddTokenAuthentication(authMethods.AuthenticateToken);
            //host.ConfigureCacheCleaner(TimeSpan.FromSeconds(30));
            host.StartHosting(null);

            Console.ReadLine();
        }
Exemplo n.º 4
0
        public void Start()
        {
            _server.StartHosting(null);
            Thread.Sleep(4000);
            ServerLoggerFactory.Init();

            var methodHandlers    = _services.Get <IChannelMethodHandlerCollection>().AsList();
            var initiatedHandlers = _services.Get <IInitiatedHandlersCollection>();

            methodHandlers.ForEach(handler =>
            {
                var channelName = handler.Url.Split('/')[4];
                var isProtected = "ServerChannel".Equals(channelName, StringComparison.OrdinalIgnoreCase) ||
                                  "PluginsChannel".Equals(channelName, StringComparison.OrdinalIgnoreCase);

                initiatedHandlers.AddHandler(handler.HandlerId, handler.Url, handler.StateName, isProtected);
            });
        }
Exemplo n.º 5
0
        public static IApplicationBuilder UseChannels(this IApplicationBuilder app)
        {
            IChannelServer server = ChannelServerBuilder.CreateServer();

            //If you have channels or services in another project add them into your current AppDomain
            //Same goes for services if you use IServiceLocator from Nuclear.ExportLocator package
            server.LoadAssemblies(AppDomain.CurrentDomain);

            //Add authentication if you have for basic or for token authentication
            //server.AddTokenAuthentication( // your delegate goes here );
            //server.AddBasicAuthentication( // your delegate goes here );

            //or setup server.AuthenticationOption

            //Change the route for your web url
            server.StartHosting("https://localhost:44386");

            return(app);
        }
 public void Execute()
 {
     _server.StartHosting(null);
 }