コード例 #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.ConfigureRootConfiguration(Configuration);

            ///// Add single tenant configuration
            services.AddSingleTenantConfiguration(Configuration, Environment, Logger,
                                                  StartupHelpers.DefaultIdentityDbContextOptions(Configuration),
                                                  StartupHelpers.DefaultIdentityOptions(),
                                                  StartupHelpers.DefaultIdentityServerOptions(),
                                                  StartupHelpers.DefaultIdentityServerConfigurationOptions(Configuration),
                                                  StartupHelpers.DefaultIdentityServerOperationalStoreOptions(Configuration)
                                                  );

            /// Add multi tenant configuration
            /// Seeding data requires that you build the identity migration using the <see cref="MultiTenantUserIdentityDbContext"/>
            /// The _layout page requires the SignInManager to have the type specified to use the <see cref="MultiTenantUserIdentity"/>
            //services.AddMultiTenantConfiguration(Configuration, Environment, Logger,
            //    StartupHelpers.DefaultIdentityDbContextOptions(Configuration),
            //    StartupHelpers.DefaultIdentityOptions(),
            //    StartupHelpers.DefaultIdentityServerOptions(),
            //    StartupHelpers.DefaultIdentityServerConfigurationOptions(Configuration),
            //    StartupHelpers.DefaultIdentityServerOperationalStoreOptions(Configuration)
            //    );

            // Add email senders which is currently setup for SendGrid and SMTP
            services.AddEmailSenders(Configuration);

            // Add services for authentication, including Identity model, IdentityServer4 and external providers
            services.AddAuthenticationServices(Configuration);

            // Add authorization policies for MVC
            services.AddAuthorizationPolicies();
        }