public static IAppBuilder UseIdentityServerCore(this IAppBuilder app, IdentityServerCoreOptions options)
        {
            if (options == null) throw new ArgumentNullException("options");

            var internalConfig = new InternalConfiguration();

            var settings = options.Factory.CoreSettings();
            if (settings.DataProtector == null)
            {
                var provider = app.GetDataProtectionProvider();
                if (provider == null)
                {
                    provider = new DpapiDataProtectionProvider("idsrv3");
                }

                internalConfig.DataProtector = new HostDataProtector(provider);
            }
            else
            {
                internalConfig.DataProtector = settings.DataProtector;
            }

            // thank you Microsoft for the clean syntax
            JwtSecurityTokenHandler.InboundClaimTypeMap = ClaimMappings.None;
            JwtSecurityTokenHandler.OutboundClaimTypeMap = ClaimMappings.None;

            app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.PrimaryAuthenticationType });
            app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.ExternalAuthenticationType, AuthenticationMode = AuthenticationMode.Passive });
            app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.PartialSignInAuthenticationType, AuthenticationMode = AuthenticationMode.Passive });

            if (options.AdditionalIdentityProviderConfiguration != null)
            {
                options.AdditionalIdentityProviderConfiguration(app, Constants.ExternalAuthenticationType);
            }

            if (options.PluginConfiguration != null)
            {
                options.PluginConfiguration(app, internalConfig.PluginConfiguration);
            }

            app.UseFileServer(new FileServerOptions
            {
                RequestPath = new PathString("/assets"),
                FileSystem = new EmbeddedResourceFileSystem(typeof(Constants).Assembly, "Thinktecture.IdentityServer.Core.Assets")
            });
            app.UseStageMarker(PipelineStage.MapHandler);

            app.UseFileServer(new FileServerOptions
            {
                RequestPath = new PathString("/assets/libs/fonts"),
                FileSystem = new EmbeddedResourceFileSystem(typeof(Constants).Assembly, "Thinktecture.IdentityServer.Core.Assets.libs.bootstrap.fonts")
            });
            app.UseStageMarker(PipelineStage.MapHandler);

            app.Use<AutofacContainerMiddleware>(AutofacConfig.Configure(options, internalConfig));
            Microsoft.Owin.Infrastructure.SignatureConversions.AddConversions(app);
            app.UseWebApi(WebApiConfig.Configure(options));

            return app;
        }
        public void Configuration(IAppBuilder app)
        {
            LogProvider.SetCurrentLogProvider(new DiagnosticsTraceLogProvider());

            app.Map("/core", coreApp =>
                {
                    // allow cross origin calls
                    coreApp.UseCors(CorsOptions.AllowAll);

                    var factory = LocalTestFactory.Create(
                        issuerUri: "https://idsrv3.com",
                        siteName: "Thinktecture IdentityServer v3 - preview 1",
                        publicHostAddress: "http://localhost:3333/core");

                    //factory.UserService = Thinktecture.IdentityServer.MembershipReboot.UserServiceFactory.Factory;
                    //factory.UserService = Thinktecture.IdentityServer.AspNetIdentity.UserServiceFactory.Factory;

                    var idsrvOptions = new IdentityServerCoreOptions
                    {
                        Factory = factory,
                        AdditionalIdentityProviderConfiguration = ConfigureAdditionalIdentityProviders,
                        ConfigurePlugins = ConfigurePlugins
                    };

                    coreApp.UseIdentityServerCore(idsrvOptions);
                        
                });
        }
            public void Configuration(IAppBuilder appBuilder)
            {
                IdentityServerServiceFactory factory = TestOptionsFactory.Create(
                    "https://idsrv3.com",
                    "Thinktecture IdentityServer v3- Selfhost", 
                    "http://localhost:3333");

                var opts = new IdentityServerCoreOptions
                {
                    Factory = factory,
                };

                appBuilder.UseIdentityServerCore(opts);
            }
        public void Configuration(IAppBuilder appBuilder)
        {
            var factory = LocalTestFactory.Create(
                    issuerUri: "https://idsrv3.com",
                    siteName: "Thinktecture IdentityServer v3 - preview 1 (SelfHost)",
                    publicHostAddress: "http://localhost:3333");

            var opts = new IdentityServerCoreOptions
            {
                Factory = factory,
            };

            appBuilder.UseIdentityServerCore(opts);
        }
        public static HttpConfiguration Configure(IdentityServerCoreOptions options)
        {
            var config = new HttpConfiguration();

            config.MapHttpAttributeRoutes();
            config.SuppressDefaultHostAuthentication();

            config.MessageHandlers.Insert(0, new KatanaDependencyResolver());
            config.Services.Add(typeof(IExceptionLogger), new LogProviderExceptionLogger());

            config.Formatters.Remove(config.Formatters.XmlFormatter);

            return config;
        }
        public static HttpConfiguration Configure(IdentityServerCoreOptions options)
        {
            var config = new HttpConfiguration();

            config.EnableCors();

            config.MapHttpAttributeRoutes();
            config.SuppressDefaultHostAuthentication();

            config.MessageHandlers.Insert(0, new KatanaDependencyResolver());
            config.Services.Add(typeof(IExceptionLogger), new IdentityServerExceptionLogger());

            config.Formatters.Remove(config.Formatters.XmlFormatter);

            return(config);
        }
        public static HttpConfiguration Configure(IdentityServerCoreOptions options)
        {
            var config = new HttpConfiguration();

            config.MapHttpAttributeRoutes();
            config.SuppressDefaultHostAuthentication();

            config.MessageHandlers.Insert(0, new KatanaDependencyResolver());
            config.Services.Add(typeof(IExceptionLogger), new IdentityServerExceptionLogger());

            config.Formatters.Remove(config.Formatters.XmlFormatter);

            //var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
            //config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);

            return(config);
        }
        public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
                {
                    var factory = TestOptionsFactory.Create(
                        issuerUri:         "https://idsrv3.com",
                        siteName:          "Thinktecture IdentityServer v3 - preview 1",
                        publicHostAddress: "http://localhost:3333");
                    
                    var opts = new IdentityServerCoreOptions
                    {
                        Factory = factory,
                    };

                    coreApp.UseIdentityServerCore(opts);
                });
        }
        public static HttpConfiguration Configure(IdentityServerCoreOptions options)
        {
            var config = new HttpConfiguration();

            config.MapHttpAttributeRoutes();
            config.SuppressDefaultHostAuthentication();

            config.MessageHandlers.Insert(0, new KatanaDependencyResolver());
            config.Services.Add(typeof(IExceptionLogger), new IdentityServerExceptionLogger());

            config.Formatters.Remove(config.Formatters.XmlFormatter);

            //var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
            //config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);

            return config;
        }
        public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
                {
                    var factory = TestOptionsFactory.Create(
                        issuerUri: "https://idsrv3.com",
                        siteName: "Thinktecture IdentityServer v3 - preview 1 (WAWS)",
                        publicHostAddress: "http://idsrv3.azurewebsites.net");

                    var options = new IdentityServerCoreOptions
                    {
                        Factory = factory,
                        SocialIdentityProviderConfiguration = ConfigureSocialIdentityProviders
                    };

                    coreApp.UseIdentityServerCore(options);
                });
        }
        private void ConfigurePlugins(IAppBuilder pluginApp, IdentityServerCoreOptions coreOptions)
        {
            var wsfedOptions = new WsFederationPluginOptions
            {
                // todo - also signoutcleanup is broken right now
                LoginPageUrl = "http://localhost:3333/core/login",
                LogoutPageUrl = "http://localhost:3333/core/connect/logout",

                Factory = new WsFederationServiceFactory
                {
                    UserService = coreOptions.Factory.UserService,
                    CoreSettings = coreOptions.Factory.CoreSettings,
                    RelyingPartyService = () => new InMemoryRelyingPartyService(LocalTestRelyingParties.Get()),
                    WsFederationSettings = () => new LocalTestWsFederationSettings()
                },
            };

            pluginApp.UseWsFederationPlugin(wsfedOptions);
        }
        public static IdentityServerAppBuilder UseIdentityServerCore(this IAppBuilder app, IdentityServerCoreOptions options)
        {
            if (options == null) throw new ArgumentNullException("options");

            // thank you Microsoft for the clean syntax
            JwtSecurityTokenHandler.InboundClaimTypeMap = ClaimMappings.None;
            JwtSecurityTokenHandler.OutboundClaimTypeMap = ClaimMappings.None;

            app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.PrimaryAuthenticationType });
            app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.ExternalAuthenticationType, AuthenticationMode = AuthenticationMode.Passive });
            app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = Constants.PartialSignInAuthenticationType, AuthenticationMode = AuthenticationMode.Passive });

            if (options.SocialIdentityProviderConfiguration != null)
            {
                options.SocialIdentityProviderConfiguration(app, Constants.ExternalAuthenticationType);
            }

            var pluginDependencies = new PluginDependencies();
            if (options.PluginConfiguration != null)
            {
                options.PluginConfiguration(app, pluginDependencies);
            }

            app.UseFileServer(new FileServerOptions
            {
                RequestPath = new PathString("/assets"),
                FileSystem = new EmbeddedResourceFileSystem(typeof(Constants).Assembly, "Thinktecture.IdentityServer.Core.Assets")
            });
            app.UseStageMarker(PipelineStage.MapHandler);

            app.UseFileServer(new FileServerOptions
            {
                RequestPath = new PathString("/assets/libs/fonts"),
                FileSystem = new EmbeddedResourceFileSystem(typeof(Constants).Assembly, "Thinktecture.IdentityServer.Core.Assets.libs.bootstrap.fonts")
            });
            app.UseStageMarker(PipelineStage.MapHandler);

            app.Use<AutofacContainerMiddleware>(AutofacConfig.Configure(options, pluginDependencies));
            Microsoft.Owin.Infrastructure.SignatureConversions.AddConversions(app);
            app.UseWebApi(WebApiConfig.Configure(options));

            return new IdentityServerAppBuilder(app);
        }
        public void Configuration(IAppBuilder app)
        {
            app.Map("/core", coreApp =>
                {
                    var factory = TestOptionsFactory.Create(
                        issuerUri: "https://idsrv3.com",
                        siteName: "Thinktecture IdentityServer v3 - preview 1",
                        publicHostAddress: "http://localhost:3333/core");

                    //factory.UserService = Thinktecture.IdentityServer.MembershipReboot.UserServiceFactory.Factory;
                    //factory.UserService = Thinktecture.IdentityServer.AspNetIdentity.UserServiceFactory.Factory;

                    var options = new IdentityServerCoreOptions
                    {
                        Factory = factory,
                        SocialIdentityProviderConfiguration = ConfigureSocialIdentityProviders
                    };

                    coreApp.UseIdentityServerCore(options);
                });
        }
        public static IContainer Configure(IdentityServerCoreOptions options)
        {
            if (options == null) throw new ArgumentNullException("options");
            if (options.Factory == null) throw new InvalidOperationException("null factory");
            
            IdentityServerServiceFactory fact = options.Factory;
            fact.Validate();

            var builder = new ContainerBuilder();

            // mandatory from factory
            builder.Register(ctx => fact.AuthorizationCodeStore()).As<IAuthorizationCodeStore>();
            builder.Register(ctx => fact.CoreSettings()).As<ICoreSettings>();
            builder.Register(ctx => fact.Logger()).As<ILogger>();
            builder.Register(ctx => fact.TokenHandleStore()).As<ITokenHandleStore>();
            builder.Register(ctx => fact.UserService()).As<IUserService>();
            builder.Register(ctx => fact.ConsentService()).As<IConsentService>();

            // optional from factory
            if (fact.ClaimsProvider != null)
            {
                builder.Register(ctx => fact.ClaimsProvider()).As<IClaimsProvider>();
            }
            else
            {
                builder.RegisterType<DefaultClaimsProvider>().As<IClaimsProvider>();
            }

            if (fact.TokenService != null)
            {
                builder.Register(ctx => fact.TokenService()).As<ITokenService>();
            }
            else
            {
                builder.RegisterType<DefaultTokenService>().As<ITokenService>();
            }

            if (fact.CustomRequestValidator != null)
            {
                builder.Register(ctx => fact.CustomRequestValidator()).As<ICustomRequestValidator>();
            }
            else
            {
                builder.RegisterType<DefaultCustomRequestValidator>().As<ICustomRequestValidator>();
            }

            if (fact.AssertionGrantValidator != null)
            {
                builder.Register(ctx => fact.AssertionGrantValidator()).As<IAssertionGrantValidator>();
            }
            else
            {
                builder.RegisterType<DefaultAssertionGrantValidator>().As<IAssertionGrantValidator>();
            }

            if (fact.ExternalClaimsFilter != null)
            {
                builder.Register(ctx => fact.ExternalClaimsFilter()).As<IExternalClaimsFilter>();
            }
            else
            {
                builder.RegisterType<DefaultExternalClaimsFilter>().As<IExternalClaimsFilter>();
            }

            // validators
            builder.RegisterType<TokenRequestValidator>();
            builder.RegisterType<AuthorizeRequestValidator>();
            builder.RegisterType<ClientValidator>();
            builder.RegisterType<TokenValidator>();

            // processors
            builder.RegisterType<TokenResponseGenerator>();
            builder.RegisterType<AuthorizeResponseGenerator>();
            builder.RegisterType<AuthorizeInteractionResponseGenerator>();
            builder.RegisterType<UserInfoResponseGenerator>();

            // for authentication
            var authenticationOptions = options.AuthenticationOptions ?? new AuthenticationOptions();
            builder.RegisterInstance(authenticationOptions).AsSelf();

            // controller
            builder.RegisterApiControllers(typeof(AuthorizeEndpointController).Assembly);

            return builder.Build();
        }
        public static IContainer Configure(IdentityServerCoreOptions options, InternalConfiguration internalConfig)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            if (options.Factory == null)
            {
                throw new InvalidOperationException("null factory");
            }
            if (internalConfig == null)
            {
                throw new ArgumentNullException("internalConfig");
            }

            IdentityServerServiceFactory fact = options.Factory;

            fact.Validate();

            var builder = new ContainerBuilder();

            builder.RegisterInstance(internalConfig).AsSelf();

            // mandatory from factory
            builder.Register(ctx => fact.AuthorizationCodeStore()).As <IAuthorizationCodeStore>();
            builder.Register(ctx => fact.CoreSettings()).As <CoreSettings>();
            builder.Register(ctx => fact.TokenHandleStore()).As <ITokenHandleStore>();
            builder.Register(ctx => fact.UserService()).As <IUserService>();
            builder.Register(ctx => fact.ScopeService()).As <IScopeService>();
            builder.Register(ctx => fact.ClientService()).As <IClientService>();
            builder.Register(ctx => fact.ConsentService()).As <IConsentService>();

            // optional from factory
            if (fact.Logger != null)
            {
                builder.Register(ctx => fact.Logger()).As <ILogger>();
            }
            else
            {
                builder.RegisterType <TraceLogger>().As <ILogger>();
            }

            if (fact.ClaimsProvider != null)
            {
                builder.Register(ctx => fact.ClaimsProvider()).As <IClaimsProvider>();
            }
            else
            {
                builder.RegisterType <DefaultClaimsProvider>().As <IClaimsProvider>();
            }

            if (fact.TokenService != null)
            {
                builder.Register(ctx => fact.TokenService()).As <ITokenService>();
            }
            else
            {
                builder.RegisterType <DefaultTokenService>().As <ITokenService>();
            }

            if (fact.CustomRequestValidator != null)
            {
                builder.Register(ctx => fact.CustomRequestValidator()).As <ICustomRequestValidator>();
            }
            else
            {
                builder.RegisterType <DefaultCustomRequestValidator>().As <ICustomRequestValidator>();
            }

            if (fact.AssertionGrantValidator != null)
            {
                builder.Register(ctx => fact.AssertionGrantValidator()).As <IAssertionGrantValidator>();
            }
            else
            {
                builder.RegisterType <DefaultAssertionGrantValidator>().As <IAssertionGrantValidator>();
            }

            if (fact.ExternalClaimsFilter != null)
            {
                builder.Register(ctx => fact.ExternalClaimsFilter()).As <IExternalClaimsFilter>();
            }
            else
            {
                builder.RegisterType <DefaultExternalClaimsFilter>().As <IExternalClaimsFilter>();
            }

            // validators
            builder.RegisterType <TokenRequestValidator>();
            builder.RegisterType <AuthorizeRequestValidator>();
            builder.RegisterType <ClientValidator>();
            builder.RegisterType <TokenValidator>();

            // processors
            builder.RegisterType <TokenResponseGenerator>();
            builder.RegisterType <AuthorizeResponseGenerator>();
            builder.RegisterType <AuthorizeInteractionResponseGenerator>();
            builder.RegisterType <UserInfoResponseGenerator>();

            // for authentication
            var authenticationOptions = options.AuthenticationOptions ?? new AuthenticationOptions();

            builder.RegisterInstance(authenticationOptions).AsSelf();

            // load core controller
            builder.RegisterApiControllers(typeof(AuthorizeEndpointController).Assembly);

            // plugin configuration
            var pluginDepencies = internalConfig.PluginDependencies;

            if (pluginDepencies != null)
            {
                if (pluginDepencies.ApiControllerAssemblies != null)
                {
                    foreach (var asm in pluginDepencies.ApiControllerAssemblies)
                    {
                        builder.RegisterApiControllers(asm);
                    }
                }

                if (pluginDepencies.Types != null)
                {
                    foreach (var type in pluginDepencies.Types)
                    {
                        if (type.Value == null)
                        {
                            builder.RegisterType(type.Key);
                        }
                        else
                        {
                            builder.RegisterType(type.Key).As(type.Value);
                        }
                    }
                }

                if (pluginDepencies.Factories != null)
                {
                    foreach (var factory in pluginDepencies.Factories)
                    {
                        builder.Register(ctx => factory.Value()).As(factory.Key);
                    }
                }
            }

            return(builder.Build());
        }
Beispiel #16
0
        public static IContainer Configure(IdentityServerCoreOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }
            if (options.Factory == null)
            {
                throw new InvalidOperationException("null factory");
            }

            IdentityServerServiceFactory fact = options.Factory;

            fact.Validate();

            var builder = new ContainerBuilder();

            // mandatory from factory
            builder.Register(ctx => fact.AuthorizationCodeStore()).As <IAuthorizationCodeStore>();
            builder.Register(ctx => fact.CoreSettings()).As <ICoreSettings>();
            builder.Register(ctx => fact.Logger()).As <ILogger>();
            builder.Register(ctx => fact.TokenHandleStore()).As <ITokenHandleStore>();
            builder.Register(ctx => fact.UserService()).As <IUserService>();
            builder.Register(ctx => fact.ConsentService()).As <IConsentService>();

            // optional from factory
            if (fact.ClaimsProvider != null)
            {
                builder.Register(ctx => fact.ClaimsProvider()).As <IClaimsProvider>();
            }
            else
            {
                builder.RegisterType <DefaultClaimsProvider>().As <IClaimsProvider>();
            }

            if (fact.TokenService != null)
            {
                builder.Register(ctx => fact.TokenService()).As <ITokenService>();
            }
            else
            {
                builder.RegisterType <DefaultTokenService>().As <ITokenService>();
            }

            if (fact.CustomRequestValidator != null)
            {
                builder.Register(ctx => fact.CustomRequestValidator()).As <ICustomRequestValidator>();
            }
            else
            {
                builder.RegisterType <DefaultCustomRequestValidator>().As <ICustomRequestValidator>();
            }

            if (fact.AssertionGrantValidator != null)
            {
                builder.Register(ctx => fact.AssertionGrantValidator()).As <IAssertionGrantValidator>();
            }
            else
            {
                builder.RegisterType <DefaultAssertionGrantValidator>().As <IAssertionGrantValidator>();
            }

            if (fact.ExternalClaimsFilter != null)
            {
                builder.Register(ctx => fact.ExternalClaimsFilter()).As <IExternalClaimsFilter>();
            }
            else
            {
                builder.RegisterType <DefaultExternalClaimsFilter>().As <IExternalClaimsFilter>();
            }

            // validators
            builder.RegisterType <TokenRequestValidator>();
            builder.RegisterType <AuthorizeRequestValidator>();
            builder.RegisterType <ClientValidator>();
            builder.RegisterType <TokenValidator>();

            // processors
            builder.RegisterType <TokenResponseGenerator>();
            builder.RegisterType <AuthorizeResponseGenerator>();
            builder.RegisterType <AuthorizeInteractionResponseGenerator>();
            builder.RegisterType <UserInfoResponseGenerator>();

            // for authentication
            var authenticationOptions = options.AuthenticationOptions ?? new AuthenticationOptions();

            builder.RegisterInstance(authenticationOptions).AsSelf();

            // controller
            builder.RegisterApiControllers(typeof(AuthorizeEndpointController).Assembly);

            return(builder.Build());
        }
        public static IContainer Configure(IdentityServerCoreOptions options, InternalConfiguration internalConfig)
        {
            if (options == null) throw new ArgumentNullException("options");
            if (options.Factory == null) throw new InvalidOperationException("null factory");
            if (internalConfig == null) throw new ArgumentNullException("internalConfig");

            IdentityServerServiceFactory fact = options.Factory;
            fact.Validate();

            var builder = new ContainerBuilder();

            builder.RegisterInstance(internalConfig).AsSelf();

            // mandatory from factory
            builder.Register(ctx => fact.AuthorizationCodeStore()).As<IAuthorizationCodeStore>();
            builder.Register(ctx => fact.CoreSettings()).As<CoreSettings>();
            builder.Register(ctx => fact.TokenHandleStore()).As<ITokenHandleStore>();
            builder.Register(ctx => fact.UserService()).As<IUserService>();
            builder.Register(ctx => fact.ScopeService()).As<IScopeService>();
            builder.Register(ctx => fact.ClientService()).As<IClientService>();
            builder.Register(ctx => fact.ConsentService()).As<IConsentService>();

            // optional from factory
            if (fact.ClaimsProvider != null)
            {
                builder.Register(ctx => fact.ClaimsProvider()).As<IClaimsProvider>();
            }
            else
            {
                builder.RegisterType<DefaultClaimsProvider>().As<IClaimsProvider>();
            }

            if (fact.TokenService != null)
            {
                builder.Register(ctx => fact.TokenService()).As<ITokenService>();
            }
            else
            {
                builder.RegisterType<DefaultTokenService>().As<ITokenService>();
            }

            if (fact.CustomRequestValidator != null)
            {
                builder.Register(ctx => fact.CustomRequestValidator()).As<ICustomRequestValidator>();
            }
            else
            {
                builder.RegisterType<DefaultCustomRequestValidator>().As<ICustomRequestValidator>();
            }

            if (fact.AssertionGrantValidator != null)
            {
                builder.Register(ctx => fact.AssertionGrantValidator()).As<IAssertionGrantValidator>();
            }
            else
            {
                builder.RegisterType<DefaultAssertionGrantValidator>().As<IAssertionGrantValidator>();
            }

            if (fact.ExternalClaimsFilter != null)
            {
                builder.Register(ctx => fact.ExternalClaimsFilter()).As<IExternalClaimsFilter>();
            }
            else
            {
                builder.RegisterType<DefaultExternalClaimsFilter>().As<IExternalClaimsFilter>();
            }

            if (fact.CustomTokenValidator != null)
            {
                builder.Register(ctx => fact.CustomTokenValidator()).As<ICustomTokenValidator>();
            }
            else
            {
                builder.RegisterType<DefaultCustomTokenValidator>().As<ICustomTokenValidator>();
            }

            // validators
            builder.RegisterType<TokenRequestValidator>();
            builder.RegisterType<AuthorizeRequestValidator>();
            builder.RegisterType<ClientValidator>();
            builder.RegisterType<TokenValidator>();

            // processors
            builder.RegisterType<TokenResponseGenerator>();
            builder.RegisterType<AuthorizeResponseGenerator>();
            builder.RegisterType<AuthorizeInteractionResponseGenerator>();
            builder.RegisterType<UserInfoResponseGenerator>();

            // general services
            builder.RegisterType<CookieMiddlewareTrackingCookieService>().As<ITrackingCookieService>();

            // for authentication
            var authenticationOptions = options.AuthenticationOptions ?? new AuthenticationOptions();
            builder.RegisterInstance(authenticationOptions).AsSelf();

            // load core controller
            builder.RegisterApiControllers(typeof(AuthorizeEndpointController).Assembly);

            // plugin configuration
            var pluginConfiguration = internalConfig.PluginConfiguration;
            if (pluginConfiguration != null)
            {
                if (pluginConfiguration.ApiControllerAssemblies != null)
                {
                    foreach (var asm in pluginConfiguration.ApiControllerAssemblies)
                    {
                        builder.RegisterApiControllers(asm);
                    }
                }

                if (pluginConfiguration.Types != null)
                {
                    foreach (var type in pluginConfiguration.Types)
                    {
                        if (type.Value == null)
                        {
                            builder.RegisterType(type.Key);
                        }
                        else
                        {
                            builder.RegisterType(type.Key).As(type.Value);
                        }
                    }
                }

                if (pluginConfiguration.Factories != null)
                {
                    foreach (var factory in pluginConfiguration.Factories)
                    {
                        builder.Register(ctx => factory.Value()).As(factory.Key);
                    }
                }

                if (pluginConfiguration.Instances != null)
                {
                    foreach (var instance in pluginConfiguration.Instances)
                    {
                        builder.RegisterInstance(instance).AsSelf();
                    }
                }
            }

            return builder.Build();
        }