示例#1
0
        public static IJointBuilder AddOcelot(this IJointBuilder builder, string sectionName = SectionRoutesName)
        {
            var optionsRoutes = builder.GetOptions <AnonymousRoutesOptions>(sectionName);
            var optionsOcelot = builder.GetOptions <OcelotOptions>(SectionOcelotName);

            builder.Services.AddSingleton(optionsRoutes);
            builder.Services.AddSingleton(optionsOcelot);
            builder.Services.AddSingleton <IAnonymousRouteValidator, AnonymousRouteValidator>();
            builder.Services.AddOcelot();

            return(builder);
        }
示例#2
0
        public static IJointBuilder AddJwt(this IJointBuilder builder, string sectionName = SectionName,
                                           Action <JwtBearerOptions> optionsFactory       = null)
        {
            if (string.IsNullOrWhiteSpace(sectionName))
            {
                sectionName = SectionName;
            }

            var options = builder.GetOptions <JwtOptions>(sectionName);

            return(builder.AddJwt(options, optionsFactory));
        }