public void ConfigureServices(IServiceCollection services) { var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name; services.AddMvc(opts => opts.EnableEndpointRouting = false).AddNewtonsoftJson(); services.AddAuthentication(options => { options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { IssuerSigningKey = ExtractKey("openid_puk.txt"), ValidAudiences = new List <string> { "http://localhost:60000", "http://simpleidserver.northeurope.cloudapp.azure.com/openid" }, ValidIssuers = new List <string> { "http://localhost:60000", "http://simpleidserver.northeurope.cloudapp.azure.com/openid" } }; }); services.AddAuthorization(_ => _.AddDefaultBPMNAuthorizationPolicy()); services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader())); services.AddHostedService <BPMNJobServerHostedService>(); services.AddProcessJobServer(callbackServerOpts: opts => { opts.WSHumanTaskAPI = "http://localhost:60006"; opts.CallbackUrl = "http://localhost:60007/processinstances/{id}/complete/{eltId}"; }); services.AddBPMNStoreEF(opts => { opts.UseSqlServer(_configuration.GetConnectionString("db"), o => o.MigrationsAssembly(migrationsAssembly)); }); var factory = new NetStandardConnectionFactory(SqlClientFactory.Instance, _configuration.GetConnectionString("db")); var wireup = Wireup.Init() .UsingSqlPersistence(factory) .WithDialect(new MsSqlDialect()) .UsingBinarySerialization() .Build(); services.AddSingleton <IStoreEvents>(wireup); services.AddSwaggerGen(); services.Configure <ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; }); }
public static SqlPersistenceWireup UsingSqlPersistence(this Wireup wireup, DbProviderFactory providerFactory, string connectionString) { var factory = new NetStandardConnectionFactory(providerFactory, connectionString); return(wireup.UsingSqlPersistence(factory)); }