public void Configuration(IAppBuilder app) { StagedDbContext.Instance.InitializeDatabase(); app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); app.UseSignalRNotificationMiddleware(); app.UseJwtBearerAuthentication(new JwtBearerAuthenticationOptions { AuthenticationMode = AuthenticationMode.Passive, AllowedAudiences = new[] { IdentityProviders.StagedClient.Key }, IssuerSecurityTokenProviders = new[] { new SymmetricKeyIssuerSecurityTokenProvider(IdentityProviders.StagedTokenIssuer, Convert.FromBase64String(ConfigurationManager.AppSettings["signing_key"])) } }); app.UseOAuthAuthorizationServer(new OAuthAuthorizationServerOptions { AllowInsecureHttp = true, TokenEndpointPath = new PathString("/token"), AccessTokenExpireTimeSpan = TimeSpan.FromHours(8), Provider = new StagedAuthorizationServerProvider(), AccessTokenFormat = new JsonWebTokenFormat(new JwtSecurityTokenHandler(), IdentityProviders.StagedTokenIssuer, IdentityProviders.StagedClient.Key) }); app.SetupWebApiServices(); app.CacheMetadata(); }