StellaOps.Workflow.AspNetCore
HTTP endpoints of the workflow engine for an ASP.NET Core host, with standard ASP.NET Core authentication and authorization. Install Installing Stella Ops packagesWorkflow downloads and signaturesnet10.01.0.1-20261118T121708Zdotnet add package StellaOps.
Namespaces
| Namespace | Types |
|---|---|
StellaOps. | 11 |
namespace StellaOps.Workflow.AspNetCore
| Type | Kind | Description |
|---|---|---|
ClaimsWorkflowActorRoleResolver | class | The actor resolver that Add registers in place of the engine’s pass-through NullWorkflowActorRoleResolver. |
WorkflowActorClaimOptions | class | The claims of the authenticated principal that identify the actor of a task operation: the actor ID and the actor’s roles. |
WorkflowAspNetCoreServiceCollectionExtensions | class | Service registration for the Workflow endpoints. |
WorkflowEndpointOperation | class | Endpoint metadata on each state-changing Workflow endpoint: the operation it performs and the kind of resource it changes. |
WorkflowEndpoints | class | The Workflow HTTP surface: every business endpoint under the /api/workflow route group. |
WorkflowErrorResponse | record | The body of a refused Workflow request: the engine’s message id and its message. |
WorkflowHealthResponseWriter | class | Writes the readiness report as JSON: the overall status and, per entry, its status, description and data (a nested string-keyed dictionary as an object). |
WorkflowPolicies | class | Named authorization policy constants and registration for the Workflow endpoints. |
WorkflowScopeRequirement | class | An any-of scope requirement: the user holds at least one of WorkflowScopeRequirement.in a scope or scp claim. |
WorkflowTaskAssignBody | record | The body of POST /api/workflow/tasks/{id}/assign. |
WorkflowTaskCompleteBody | record | The body of POST /api/workflow/tasks/{id}/complete. |
class ClaimsWorkflowActorRoleResolver
public sealed class ClaimsWorkflowActorRoleResolver : IWorkflowActorRoleResolver
The actor resolver that Add registers in place of the engine’s pass-through NullWorkflowActorRoleResolver. Inside an HTTP request the actor ID and the roles come from the authenticated principal only (WorkflowActorClaimOptions); the actor and roles the caller supplied are ignored, and a principal that is not authenticated or carries no actor ID claim has no actor and no roles. Outside an HTTP request (the signal pump, hosted services, other server-side callers) there is no principal, and the values the server-side caller passes are used as they are.
Members
| Member | Kind | Summary |
|---|---|---|
ClaimsWorkflowActorRoleResolver( | constructor | The actor resolver that Add registers in place of the engine’s pass-through NullWorkflowActorRoleResolver. |
ResolveActorId( | method | Returns the actor ID for the current request. |
ResolveActorRolesAsync( | method | Resolves user roles from a trusted source (database, identity provider). |
constructor ClaimsWorkflowActorRoleResolver(IHttpContextAccessor, IOptions<WorkflowActorClaimOptions>) #
ClaimsWorkflowActorRoleResolver(IHttpContextAccessor, IOptions<WorkflowActorClaimOptions>) #public ClaimsWorkflowActorRoleResolver(IHttpContextAccessor httpContextAccessor, IOptions<WorkflowActorClaimOptions> options)
The actor resolver that Add registers in place of the engine’s pass-through NullWorkflowActorRoleResolver. Inside an HTTP request the actor ID and the roles come from the authenticated principal only (WorkflowActorClaimOptions); the actor and roles the caller supplied are ignored, and a principal that is not authenticated or carries no actor ID claim has no actor and no roles. Outside an HTTP request (the signal pump, hosted services, other server-side callers) there is no principal, and the values the server-side caller passes are used as they are.
method ResolveActorId(string) #
ResolveActorId(string) #public string ResolveActorId(string? clientActorId)
Returns the actor ID for the current request. Implementations should prefer server-side identity over client-supplied values.
method ResolveActorRolesAsync(string, IReadOnlyCollection<string>, CancellationToken) #
ResolveActorRolesAsync(string, IReadOnlyCollection<string>, CancellationToken) #public Task<IReadOnlyCollection<string>> ResolveActorRolesAsync(string actorId, IReadOnlyCollection<string>? clientRoles, CancellationToken cancellationToken = default)
Resolves user roles from a trusted source (database, identity provider). Falls back to clientRoles when no server-side context is available (e.g., during signal pump processing).
class WorkflowActorClaimOptions
public sealed class WorkflowActorClaimOptions
The claims of the authenticated principal that identify the actor of a task operation: the actor ID and the actor’s roles. The Workflow endpoints and ClaimsWorkflowActorRoleResolverread them; the actor and roles in a request body or query are not used. Add binds the section WorkflowActorClaimOptions.of the host configuration when one is registered.
Members
| Member | Kind | Summary |
|---|---|---|
WorkflowActorClaimOptions( | constructor | Creates an instance of Workflow. |
SectionName | constant | The configuration section bound by Add. |
ActorIdClaimTypes | property | Claim types read for the actor ID, in order; the first non-blank value wins. |
DefaultActorIdClaimTypes | property | The actor ID claim types used when WorkflowActorClaimOptions.is empty: sub, then the name identifier claim. |
DefaultRoleClaimTypes | property | The role claim types used when WorkflowActorClaimOptions.is empty: the role claim and role. |
RoleClaimTypes | property | Claim types read for the actor’s roles; every non-blank value of every listed type is a role. |
constructor WorkflowActorClaimOptions() #
WorkflowActorClaimOptions() #public WorkflowActorClaimOptions()
Creates an instance of Workflow.
constant SectionName #
SectionName #public const string SectionName = "WorkflowAuthorization"
The configuration section bound by Add.
property ActorIdClaimTypes #
ActorIdClaimTypes #public List<string> ActorIdClaimTypes { get; set; }
Claim types read for the actor ID, in order; the first non-blank value wins. Empty means WorkflowActorClaimOptions.. A non-empty list replaces the defaults.
property DefaultActorIdClaimTypes #
DefaultActorIdClaimTypes #public static IReadOnlyList<string> DefaultActorIdClaimTypes { get; }
The actor ID claim types used when WorkflowActorClaimOptions.is empty: sub, then the name identifier claim.
property DefaultRoleClaimTypes #
DefaultRoleClaimTypes #public static IReadOnlyList<string> DefaultRoleClaimTypes { get; }
The role claim types used when WorkflowActorClaimOptions.is empty: the role claim and role.
property RoleClaimTypes #
RoleClaimTypes #public List<string> RoleClaimTypes { get; set; }
Claim types read for the actor’s roles; every non-blank value of every listed type is a role. Empty means WorkflowActorClaimOptions.. A non-empty list replaces the defaults.
class WorkflowAspNetCoreServiceCollectionExtensions
public static class WorkflowAspNetCoreServiceCollectionExtensions
Service registration for the Workflow endpoints.
Members
| Member | Kind | Summary |
|---|---|---|
AddWorkflowAuthorization( | extension method | Registers the named Workflow policies (WorkflowPolicies) and the handler of WorkflowScopeRequirement. |
AddWorkflowAuthorization( | extension method | WorkflowAspNetCoreServiceCollectionExtensions., then applies configureActorClaims to the claim types that identify the actor. |
extension method AddWorkflowAuthorization(IServiceCollection) #
AddWorkflowAuthorization(IServiceCollection) #public static IServiceCollection AddWorkflowAuthorization(this IServiceCollection services)
Registers the named Workflow policies (WorkflowPolicies) and the handler of WorkflowScopeRequirement. Authentication stays with the host: register any ASP.NET Core scheme that puts the caller’s scopes in scope or scp claims. Also registers ClaimsWorkflowActorRoleResolverin place of the engine’s pass-through resolver (a resolver the host registered itself is kept), and binds WorkflowActorClaimOptionsfrom the WorkflowActorClaimOptions.section of the host configuration. Safe to call more than once, before or after the engine’s registration.
extension method AddWorkflowAuthorization(IServiceCollection, Action<WorkflowActorClaimOptions>) #
AddWorkflowAuthorization(IServiceCollection, Action<WorkflowActorClaimOptions>) #public static IServiceCollection AddWorkflowAuthorization(this IServiceCollection services, Action<WorkflowActorClaimOptions> configureActorClaims)
WorkflowAspNetCoreServiceCollectionExtensions., then applies configureActorClaims to the claim types that identify the actor.
class WorkflowEndpointOperation
public sealed class WorkflowEndpointOperation
Endpoint metadata on each state-changing Workflow endpoint: the operation it performs and the kind of resource it changes. The package emits no audit record itself; a host reads this entry (endpoint.) to attach its own audit, telemetry or rate limits. Read-only endpoints carry none.
Members
| Member | Kind | Summary |
|---|---|---|
WorkflowEndpointOperation( | constructor | Creates the metadata entry. |
ActivateDefinition | constant | POST /api/workflow/definitions/{name}/activate. |
AssignTask | constant | POST /api/workflow/tasks/{id}/assign. |
CompleteTask | constant | POST /api/workflow/tasks/{id}/complete. |
ImportDefinition | constant | POST /api/workflow/definitions/import. |
ImportDefinitionMulti | constant | POST /api/workflow/definitions/import-multi. |
RaiseSignal | constant | POST /api/workflow/signals/raise. |
ReleaseTask | constant | POST /api/workflow/tasks/{id}/release. |
ReplayDeadLetters | constant | POST /api/workflow/signals/dead-letters/replay. |
RunRetention | constant | POST /api/workflow/retention/run. |
StartInstance | constant | POST /api/workflow/start. |
Operation | property | The operation, for example WorkflowEndpointOperation.. |
ResourceType | property | The kind of resource the operation changes. |
constructor WorkflowEndpointOperation(string, string) #
WorkflowEndpointOperation(string, string) #public WorkflowEndpointOperation(string operation, string resourceType)
Creates the metadata entry.
Parameters
operation: One of the operation constants of this class.resourceType: The kind of resource changed, for exampleworkflow_task.
constant ActivateDefinition #
ActivateDefinition #public const string ActivateDefinition = "activate_definition"
POST /api/workflow/definitions/{name}/activate.
constant AssignTask #
AssignTask #public const string AssignTask = "assign_task"
POST /api/workflow/tasks/{id}/assign.
constant CompleteTask #
CompleteTask #public const string CompleteTask = "complete_task"
POST /api/workflow/tasks/{id}/complete.
constant ImportDefinition #
ImportDefinition #public const string ImportDefinition = "import_definition"
POST /api/workflow/definitions/import.
constant ImportDefinitionMulti #
ImportDefinitionMulti #public const string ImportDefinitionMulti = "import_definition_multi"
POST /api/workflow/definitions/import-multi.
constant RaiseSignal #
RaiseSignal #public const string RaiseSignal = "raise_signal"
POST /api/workflow/signals/raise.
constant ReleaseTask #
ReleaseTask #public const string ReleaseTask = "release_task"
POST /api/workflow/tasks/{id}/release.
constant ReplayDeadLetters #
ReplayDeadLetters #public const string ReplayDeadLetters = "replay_dead_letters"
POST /api/workflow/signals/dead-letters/replay.
constant RunRetention #
RunRetention #public const string RunRetention = "run_retention"
POST /api/workflow/retention/run.
constant StartInstance #
StartInstance #public const string StartInstance = "start_instance"
POST /api/workflow/start.
property Operation #
Operation #public string Operation { get; }
The operation, for example WorkflowEndpointOperation..
property ResourceType #
ResourceType #public string ResourceType { get; }
The kind of resource the operation changes.
class WorkflowEndpoints
public static class WorkflowEndpoints
The Workflow HTTP surface: every business endpoint under the /api/workflow route group. Each endpoint requires one of the named policies of WorkflowPolicies(register them with Add); the host chooses the authentication scheme. Each state-changing endpoint carries a WorkflowEndpointOperationmetadata entry that a host can use to attach its own audit or telemetry. Identity comes from the authenticated principal, never from the request: the actor ID and the roles are read from its claims (WorkflowActorClaimOptions). The task and instance endpoints act as that actor, the definition import and activation record it in the definition audit (importedBy, actorId), and a workflow started, continued or signalled over HTTP calls services as it (WorkflowExecutionActorContext.). The actorId, actorRoles and importedBy of a request body or query are not used. A task operation or definition change by a principal without an actor ID claim, and a task operation the task authorization denies, are answered with 403. An expected refusal of the engine or of the definition store is answered with its status and a WorkflowErrorResponsebody: 404 for a definition, instance or task that does not exist, 403 for a denied action, 409 for a conflict (a completed, expired or cancelled task, a lost activation fence, an operation the instance’s runtime provider does not support), 400 for an invalid request.
Remarks
The class name is part of the published API description: minimal-API operations take the declaring type of their handler as their OpenAPI tag (WorkflowEndpoints).
Members
| Member | Kind | Summary |
|---|---|---|
MapWorkflowEndpoints( | extension method | Maps the Workflow business endpoints under /api/workflow and returns the group, so the host can add its own conventions (filters, metadata, rate limits). |
extension method MapWorkflowEndpoints(IEndpointRouteBuilder) #
MapWorkflowEndpoints(IEndpointRouteBuilder) #public static RouteGroupBuilder MapWorkflowEndpoints(this IEndpointRouteBuilder app)
Maps the Workflow business endpoints under /api/workflow and returns the group, so the host can add its own conventions (filters, metadata, rate limits).
record WorkflowErrorResponse
public sealed record WorkflowErrorResponse
The body of a refused Workflow request: the engine’s message id and its message. The endpoints answer an expected refusal with this body and a 4xx status (404 not found, 403 denied, 409 conflict, 400 invalid request), never with 500.
Parameters
Error: The message id, such asWorkflow.Actor Unresolved Message: The message.
Members
| Member | Kind | Summary |
|---|---|---|
WorkflowErrorResponse( | constructor | The body of a refused Workflow request: the engine’s message id and its message. |
Error | property | The message id, such as Workflow. |
Message | property | The message. |
constructor WorkflowErrorResponse(string, string) #
WorkflowErrorResponse(string, string) #public WorkflowErrorResponse(string Error, string Message)
The body of a refused Workflow request: the engine’s message id and its message. The endpoints answer an expected refusal with this body and a 4xx status (404 not found, 403 denied, 409 conflict, 400 invalid request), never with 500.
Parameters
Error: The message id, such asWorkflow.Actor Unresolved Message: The message.
property Error #
Error #public string Error { get; init; }
The message id, such as Workflow.
property Message #
Message #public string Message { get; init; }
The message.
class WorkflowHealthResponseWriter
public static class WorkflowHealthResponseWriter
Writes the readiness report as JSON: the overall status and, per entry, its status, description and data (a nested string-keyed dictionary as an object). The engine’s licence entry shows the licence status and the licence notice here; it always reports Healthy, so it never changes the readiness result. Use it as the Health of the host’s readiness endpoint.
Members
| Member | Kind | Summary |
|---|---|---|
WriteAsync( | method | Writes report as the JSON body of the response. |
method WriteAsync(HttpContext, HealthReport) #
WriteAsync(HttpContext, HealthReport) #public static Task WriteAsync(HttpContext context, HealthReport report)
Writes report as the JSON body of the response.
Parameters
context: The HTTP context.report: The health report.
Returns
A task that completes when the body is written.
class WorkflowPolicies
public static class WorkflowPolicies
Named authorization policy constants and registration for the Workflow endpoints. Every business endpoint uses a named policy from this class via ..
Scope hierarchy (any of these grants access to the corresponding tier): View : workflow:view, workflow:operate, workflow:admin (any one is sufficient) Operate : workflow:operate, workflow:admin (operate implies view) Admin : workflow:admin only
Each policy requires an authenticated user and a WorkflowScopeRequirement, which reads the standard scope claim (space-delimited) and individual scp claims. The requirement exposes its scopes, so a gateway that maps authorization metadata to claim requirements can enforce the same rule.
Members
| Member | Kind | Summary |
|---|---|---|
Admin | constant | Policy for engine-admin operations (definition deploy/activate, retention, dead-letter replay). |
AdminScope | constant | Scope granting permission to deploy/activate definitions, run retention, replay dead letters. |
Operate | constant | Policy for runtime mutations (start/complete/assign/release/signal). |
OperateScope | constant | Scope granting permission to start workflows, complete/assign/release tasks, raise signals. |
ScopeClaimType | constant | The OAuth claim holding space-delimited scopes. |
ScopeItemClaimType | constant | The claim holding one scope per claim. |
View | constant | Policy for read-only access to workflow data. |
ViewScope | constant | Scope granting read-only access to workflow definitions, instances, tasks, signals. |
Configure( | method | Registers the three named policies into the authorization options. |
constant Admin #
Admin #public const string Admin = "workflow.admin"
Policy for engine-admin operations (definition deploy/activate, retention, dead-letter replay).
constant AdminScope #
AdminScope #public const string AdminScope = "workflow:admin"
Scope granting permission to deploy/activate definitions, run retention, replay dead letters.
constant Operate #
Operate #public const string Operate = "workflow.operate"
Policy for runtime mutations (start/complete/assign/release/signal).
constant OperateScope #
OperateScope #public const string OperateScope = "workflow:operate"
Scope granting permission to start workflows, complete/assign/release tasks, raise signals.
constant ScopeClaimType #
ScopeClaimType #public const string ScopeClaimType = "scope"
The OAuth claim holding space-delimited scopes.
constant ScopeItemClaimType #
ScopeItemClaimType #public const string ScopeItemClaimType = "scp"
The claim holding one scope per claim.
constant View #
View #public const string View = "workflow.view"
Policy for read-only access to workflow data.
constant ViewScope #
ViewScope #public const string ViewScope = "workflow:view"
Scope granting read-only access to workflow definitions, instances, tasks, signals.
method Configure(AuthorizationOptions) #
Configure(AuthorizationOptions) #public static void Configure(AuthorizationOptions options)
Registers the three named policies into the authorization options. Hosts normally call services., which also registers the requirement’s handler.
class WorkflowScopeRequirement
public sealed class WorkflowScopeRequirement : IAuthorizationRequirement
An any-of scope requirement: the user holds at least one of WorkflowScopeRequirement.in a scope or scp claim. The scopes are public so that an authorization-metadata mapper (for example a gateway that forwards a service’s policies as claim requirements) can read them; WorkflowScopeRequirement.is false, so such a mapper emits one any-of rule. Evaluated by the handler that Add registers.
Members
| Member | Kind | Summary |
|---|---|---|
WorkflowScopeRequirement( | constructor | Creates the requirement; at least one non-blank scope is required. |
RequireAllScopes | property | Always false: one of the scopes is enough. |
RequiredScopes | property | The scopes, any one of which satisfies the requirement (ordinal order). |
constructor WorkflowScopeRequirement(params string[]) #
WorkflowScopeRequirement(params string[]) #public WorkflowScopeRequirement(params string[] scopes)
Creates the requirement; at least one non-blank scope is required.
property RequireAllScopes #
RequireAllScopes #public bool RequireAllScopes { get; }
Always false: one of the scopes is enough.
property RequiredScopes #
RequiredScopes #public IReadOnlyCollection<string> RequiredScopes { get; }
The scopes, any one of which satisfies the requirement (ordinal order).
record WorkflowTaskAssignBody
public sealed record WorkflowTaskAssignBody
The body of POST /api/workflow/tasks/{id}/assign. The route names the task and the authenticated principal is the actor. Without a target the task is assigned to the principal; the body is optional.
Members
| Member | Kind | Summary |
|---|---|---|
WorkflowTaskAssignBody( | constructor | Creates an instance of Workflow. |
TargetRoles | property | The role groups to assign the task to instead of a user. |
TargetUserId | property | The user to assign the task to; empty assigns it to the principal. |
constructor WorkflowTaskAssignBody() #
WorkflowTaskAssignBody() #public WorkflowTaskAssignBody()
Creates an instance of Workflow.
property TargetRoles #
TargetRoles #public IReadOnlyCollection<string> TargetRoles { get; init; }
The role groups to assign the task to instead of a user.
property TargetUserId #
TargetUserId #public string? TargetUserId { get; init; }
The user to assign the task to; empty assigns it to the principal.
record WorkflowTaskCompleteBody
public sealed record WorkflowTaskCompleteBody
The body of POST /api/workflow/tasks/{id}/complete. The route names the task and the authenticated principal is the actor, so the body carries only the completion payload. The body is optional; a body that also sends workflowTaskId, actorId or actorRoles is accepted and those members are not used.
Members
| Member | Kind | Summary |
|---|---|---|
WorkflowTaskCompleteBody( | constructor | Creates an instance of Workflow. |
Payload | property | The completion payload, which the task’s completion steps read as payload.*. |
constructor WorkflowTaskCompleteBody() #
WorkflowTaskCompleteBody() #public WorkflowTaskCompleteBody()
Creates an instance of Workflow.
property Payload #
Payload #public IDictionary<string, object?> Payload { get; init; }
The completion payload, which the task’s completion steps read as payload.*.