Exemple #1
0
        public static IReverseProxyBuilder AddSessionAffinityProvider(this IReverseProxyBuilder builder)
        {
            builder.Services.TryAddEnumerable(new[] {
                new ServiceDescriptor(typeof(IAffinityFailurePolicy), typeof(RedistributeAffinityFailurePolicy), ServiceLifetime.Singleton),
                new ServiceDescriptor(typeof(IAffinityFailurePolicy), typeof(Return503ErrorAffinityFailurePolicy), ServiceLifetime.Singleton)
            });
            builder.Services.TryAddEnumerable(new[] {
                new ServiceDescriptor(typeof(ISessionAffinityProvider), typeof(CookieSessionAffinityProvider), ServiceLifetime.Singleton),
                new ServiceDescriptor(typeof(ISessionAffinityProvider), typeof(CustomHeaderSessionAffinityProvider), ServiceLifetime.Singleton)
            });
            builder.AddTransforms <AffinitizeTransformProvider>();

            return(builder);
        }
Exemple #2
0
    public static IReverseProxyBuilder AddSessionAffinityPolicies(this IReverseProxyBuilder builder)
    {
        builder.Services.TryAddEnumerable(new[] {
            ServiceDescriptor.Singleton <IAffinityFailurePolicy, RedistributeAffinityFailurePolicy>(),
            ServiceDescriptor.Singleton <IAffinityFailurePolicy, Return503ErrorAffinityFailurePolicy>()
        });
        builder.Services.TryAddEnumerable(new[] {
            ServiceDescriptor.Singleton <ISessionAffinityPolicy, CookieSessionAffinityPolicy>(),
            ServiceDescriptor.Singleton <ISessionAffinityPolicy, CustomHeaderSessionAffinityPolicy>()
        });
        builder.AddTransforms <AffinitizeTransformProvider>();

        return(builder);
    }
    /// <summary>
    /// Wire up BFF YARP extensions to DI
    /// </summary>
    /// <param name="builder"></param>
    /// <returns></returns>
    public static IReverseProxyBuilder AddBffExtensions(this IReverseProxyBuilder builder)
    {
        builder.AddTransforms <AccessTokenTransformProvider>();

        return(builder);
    }