private IDisposable StartServer(IProviderStateManager providerStateManager)
        {
            return(WebApp.Start(ServiceUri, (appBuilder) =>
            {
                var startup = new Startup();

                appBuilder.Use(typeof(ProviderStateMiddleware), providerStateManager);
                appBuilder.Use(typeof(AuthorizationTokenReplacementMiddleware),
                               appBuilder.CreateDataProtector(typeof(OAuthAuthorizationServerMiddleware).Namespace, "Access_Token", "v1"));
                startup.Configuration(appBuilder);
            }));
        }
 public ProviderStateMiddleware(Func <IDictionary <string, object>, Task> next, IProviderStateManager providerStateManager)
 {
     _mNext          = next;
     _providerStates = providerStateManager.GetStates();
 }