Пример #1
0
 internal static RequestDelegate ShareMyData(RequestDelegate next)
 {
     return(async ctx =>
     {
         var navigations = NavigationApiMiddleWare.GetNavigationsFromAssembly <Navigation>().ToList();
         if (navigations.HasAny())
         {
             try
             {
                 var url = Microservice.Of("Hub").Url("local-setup");
                 navigations.Do(r => r.Define());
                 new WebClient().UploadString(url, Newtonsoft.Json.JsonConvert.SerializeObject(new
                 {
                     Service = GetService(),
                     BoardSources = GetBoardSources(navigations),
                     Features = GetFeatures(navigations),
                     GlobalySearchable = GetControllerFromAssembly <Olive.GlobalSearch.SearchSource>().HasAny()
                 }));
                 Shared = true;
             }
             catch (Exception ex)
             {
                 Log.For(typeof(DevelopmentShareInfo)).Error("With URL: " + Microservice.Of("Hub").Url("local-setup") + "\nCould not reach local hub.\n" + ex);
             }
         }
         await next(ctx);
     });
 }
Пример #2
0
        public override void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(x => x.AddPolicy("AllowHubOrigin",
                                              f => f.WithOrigins(Microservice.Of("Hub").Url().TrimEnd("/"), HubDevUrl)
                                              .AllowAnyHeader().AllowAnyMethod().AllowCredentials()));

            base.ConfigureServices(services);
        }
Пример #3
0
        public override void ConfigureServices(IServiceCollection services)
        {
            Configuration.MergeEnvironmentVariables();
            services.AddCors(x => x.AddPolicy("AllowHubOrigin",
                                              f => f.WithOrigins(Microservice.Of("Hub").Url().TrimEnd("/"), HubDevUrl)
                                              .SetIsOriginAllowed(x => true)
                                              .AllowAnyHeader().AllowAnyMethod().AllowCredentials()));

            base.ConfigureServices(services);
        }
Пример #4
0
        public override void ConfigureServices(IServiceCollection services)
        {
            var permittedUrls = Config.Get("PermittedDomains").Split(",").Union(Microservice.Of("Hub").Url()).Select(d => d.TrimEnd("/")).Union(HubDevUrl).ToArray();

            Configuration.MergeEnvironmentVariables();
            services.AddCors(x => x.AddPolicy("AllowHubOrigin",
                                              f => f.WithOrigins(permittedUrls)
                                              .SetIsOriginAllowed(x => true)
                                              .AllowAnyHeader().AllowAnyMethod().AllowCredentials()));

            base.ConfigureServices(services);
        }
Пример #5
0
 public async Task <ActionResult> Login() => Redirect(Microservice.Of("Hub").Url());