elsa-core/src/samples/aspnet/Elsa.Samples.Webhooks.WorkflowServer/Program.cs
gurkanguran 407bfa6913
Use workflow definition as activity (#3654)
* Implemented usage of workflow definitions as activities

* Updated designer

* Removed activity definitions module

* Allow user to mark workflow to be used as activity

* Refactor

* Refactor

* Cleanup csproj

* Cleanup WorkflowDefinitionActivity

* Pascalize typename

* Fix JS intellisense initial load issue

* Add XML comments

* Add Jobs dependency

* Hide Composite root port from designer

* Move finding workflow activities logic to lower level

* Generate unique identities across hierarchy

* Refactor

* Revert "Generate unique identities across hierarchy"

This reverts commit 74f5e7830309ee76af6ab3a000a5e1ec41f1e90c.

* Implement unique node IDs

* Introduce new VersionOptions option

* Remove unused namespaces

---------

Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
2023-01-28 00:36:03 +01:00

35 lines
1.1 KiB
C#

using Elsa.Extensions;
using Elsa.Samples.Webhooks.WorkflowServer.Workflows;
using Elsa.Webhooks.Extensions;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddHandlersFrom<Program>();
builder.Services.AddElsa(elsa =>
{
elsa.AddWorkflow<HungryWorkflow>()
.UseHttp()
.UseIdentity(identity =>
{
identity.IdentityOptions.CreateDefaultAdmin = true;
identity.TokenOptions.SigningKey = "secret-signing-key-for-tokens";
})
.UseWorkflowsApi(api => api.CompleteTaskPolicy = policy => policy.RequireAssertion(_ => true)) // Allows anonymous requests. Will be replaced with an API key scheme.
.UseDefaultAuthentication()
.UseWebhooks(webhooks => webhooks.WebhookOptions = options => builder.Configuration.GetSection("Webhooks").Bind(options));
});
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
app.UseWorkflowsApi();
app.UseWorkflows();
app.Run();