示例#1
0
        public void ConfigureServices(IServiceCollection services)
        {
            //while(!System.Diagnostics.Debugger.IsAttached) System.Threading.Thread.Sleep(10);
            JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();

            services.AddDataProtection()
            .AddKeyManagementOptions(_ => {
            })
            .SetApplicationName("Dolittle.Sentry")
            .PersistKeysToFileSystem(new DirectoryInfo(".cookies"));

            ConfigureAuthentication(services);
            ConfigureIdentityServer(services);

            services.Configure <ForwardedHeadersOptions>(_ => {
                _.ForwardedHeaders = ForwardedHeaders.XForwardedFor |  ForwardedHeaders.XForwardedHost |  ForwardedHeaders.XForwardedProto;
                _.KnownNetworks.Clear();
                _.KnownProxies.Clear();
            });

            _bootResult = services.AddDolittle(_ => {
                _.ExecutionContextSetup.TenantIdHeaderName = "Owner-Tenant-ID";
                _.ExecutionContextSetup.SkipAuthentication = true;
            }, _loggerFactory);
        }
示例#2
0
        public void ConfigureServices(IServiceCollection services)
        {
            if (_hostingEnvironment.IsDevelopment())
            {
                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v1", new Info {
                        Title = "My API", Version = "v1"
                    });
                });
            }

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddAuthentication(sharedOptions =>
            {
                sharedOptions.DefaultScheme          = CookieAuthenticationDefaults.AuthenticationScheme;
                sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
            })
            .AddCookie(c => c.LoginPath = new PathString("/Accounts/signin"))
            .AddOpenIdConnect(_veracityOpenIdManager.GetOpenIdOptions());
            services.AddHttpClient <VeracityPlatformService>();

            services.AddMvc();
            services.AddSession();

            _bootResult = services.AddDolittle(_loggerFactory);
        }
        public void ConfigureServices(IServiceCollection services)
        {
            // Todo: understand anti forgery
            //services.AddAntiforgery();

            // Todo: RSA Signing Key for Dolittle as Authority

            services.AddCors();
            services.AddMvc();

            // /api/508c1745-5f2a-4b4c-b7a5-2fbb1484346d/Studio/accounts/login

            services.AddIdentityServer(options => {
                options.UserInteraction.LoginUrl              = "/accounts/login";
                options.UserInteraction.LogoutUrl             = "/accounts/logout";
                options.UserInteraction.DeviceVerificationUrl = "/device/verify";
                options.UserInteraction.ConsentUrl            = "/accounts/consent";
                //options.Authentication.CheckSessionCookieName = "sentry.session";
            })
            // Todo: We need our own signing key
            //.AddSigningCredential(credentials)
            .AddDeveloperSigningCredential()

            // Todo: Persist grants per application for the unique user
            .AddInMemoryPersistedGrants()
            .AddResourceStore <ResourceStore>()
            .AddClientStore <ClientStore>()
            .AddProfileService <ProfileService>();

            services.Add(new ServiceDescriptor(typeof(IConsentMessageStore), typeof(InMemoryConsentMessageStore), ServiceLifetime.Transient));

            services.AddSentryAuthentication(_hostingEnvironment);

            _bootResult = services.AddDolittle(_loggerFactory);
        }
示例#4
0
文件: Startup.cs 项目: smithmx/Bank
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            services.AddDolittleSwagger();

            _bootResult = services.AddDolittle(_loggerFactory);
        }
示例#5
0
        public void ConfigureServices(IServiceCollection services)
        {
            if (_hostingEnvironment.IsDevelopment())
            {
                services.AddCors();
                services.AddDolittleSwagger();
            }
            services.AddMvc();

            _bootResult = services.AddDolittle(_loggerFactory);
        }
示例#6
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "My API", Version = "v1"
                });
            });
            services.AddMvc();

            _bootResult = services.AddDolittle(_loggerFactory);
        }
示例#7
0
文件: Startup.cs 项目: techgeek03/cbs
        public void ConfigureServices(IServiceCollection services)
        {
            if (_hostingEnvironment.IsDevelopment())
            {
                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v2", new Info { Title = "Admin API", Version = "v2" });
                });
            }
            services.AddMvc();

            _bootResult = services.AddDolittle(_loggerFactory);
        }
示例#8
0
        static void SetupHost()
        {
            var loggerFactory = new LoggerFactory(new ILoggerProvider[]
            {
                new NullLoggerProvider()
            });

            _bootLoaderResult = Bootloader.Configure(_ => _
                                                     .UseLoggerFactory(loggerFactory)
                                                     .UseLogAppender(new NullLogAppender())
                                                     .SkipBootprocedures()
                                                     ).Start();
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="services"></param>
        public void ConfigureServices(IServiceCollection services)
        {
            //while(!System.Diagnostics.Debugger.IsAttached) System.Threading.Thread.Sleep(10);
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "My API", Version = "v1"
                });
            });
            services.AddMvc();

            _bootResult = services.AddDolittle(_loggerFactory);
        }
示例#10
0
        public void ConfigureServices(IServiceCollection services)
        {
            if (_hostingEnvironment.IsDevelopment())
            {
                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v1", new Info {
                        Title = "My API", Version = "v1"
                    });
                });
            }
            // services.AddSecurity(_hostingEnvironment, "/analytics");
            services.AddMvc();

            _bootResult = services.AddDolittle(_loggerFactory);
        }