コード例 #1
0
ファイル: Extension.cs プロジェクト: flapek/Joint.Ocelot
        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));
        }