예제 #1
0
        /// <summary>
        /// The middleware used for forwarding incoming hub messages to other servers.
        /// </summary>
        /// <param name="config">DotNetify configuration.</param>
        /// <param name="serverUrls">Array of URLs of the servers to forward messages to.</param>
        /// <param name="haltPipeline">Whether to prevent further processing in this server after forwarding messages.</param>
        public static IDotNetifyConfiguration UseForwarding(this IDotNetifyConfiguration config, string[] serverUrls, Action <ForwardingOptions> optionsAccessor = null)
        {
            for (int i = 0; i < serverUrls.Length; i++)
            {
                var forwardingOptions = new ForwardingOptions();
                optionsAccessor?.Invoke(forwardingOptions);

                if (i < serverUrls.Length - 1)
                {
                    forwardingOptions.HaltPipeline = false;
                }

                config.UseMiddleware <ForwardingMiddleware>(serverUrls[i], forwardingOptions);
            }
            return(config);
        }
 public static void UseDeveloperLogging(this IDotNetifyConfiguration config, LogTraceDelegate logTraceDelegate = null)
 {
     config.UseMiddleware <DeveloperLoggingMiddleware>(logTraceDelegate ?? (log => Trace.WriteLine(log)));
 }
예제 #3
0
 public static void UseDeveloperLogging(this IDotNetifyConfiguration config, LogTraceDelegate logTraceDelegate = null)
 {
     config.UseMiddleware <DeveloperLoggingMiddleware>(logTraceDelegate ?? (log => Logger.LogInformation(log)));
 }
예제 #4
0
 public static void UseJwtBearerAuthentication(this IDotNetifyConfiguration config, TokenValidationParameters tokenValidationParameters)
 {
     config.UseMiddleware <JwtBearerAuthenticationMiddleware>(tokenValidationParameters);
 }