public static void UseIdento(this IAppBuilder app, IdentoOptions options)
        {
            app.UseCors(CorsOptions.AllowAll);
            options.Validate();
            app.UseAutofacMiddleware(new DependencyContainerBuilder(options).Build());

            // The order is very important, if we call UseIdentityServer first, then models posted to
            // the manager Web API are not converted anymore.
            app.Map("/api", apiApp => apiApp.UseIdentoWebApi());
            app.UseIdentityServer(options);
        }
 public DependencyContainerBuilder(IdentoOptions options)
 {
     this.RegisterApiControllers(Assembly.GetExecutingAssembly());
     this.RegisterAssemblyModules(Assembly.GetExecutingAssembly(), typeof(DataContext).Assembly);
     this.Register(ctx => options).AsSelf().SingleInstance();
 }