Beispiel #1
0
 public static ClusterClient UseRedisClusterProvider(this ClusterClient host, Action <RedisOptions> configuration)
 {
     return(host.ConfigureServices(services =>
     {
         var options = new RedisOptions();
         configuration?.Invoke(options);
         services.AddSingleton(options).AddRedis();
     }));
 }
 public static ClusterClient UseBasicAuthenticate(this ClusterClient cluster)
 {
     cluster.ConfigureServices(x => {
         x.AddSingleton <BasicAuthenticateGatewayFilter>();
         x.AddSingleton <IAuthenticateService, BasicAuthenticateService>();
     });
     cluster.OnStart += (x) =>
     {
         var gatewayPipeline = x.GetService <IGatewayPipeline>();
         gatewayPipeline.RemoveFilter(x.GetService <NoneAuthenticateGatewayFilter>());
         gatewayPipeline.AddFilters(x.GetService <BasicAuthenticateGatewayFilter>());
     };
     return(cluster);
 }