Files
git.stella-ops.org/docs/modules/router/webservice-integration-guide.md
StellaOps Bot 7503c19b8f Add determinism tests for verdict artifact generation and update SHA256 sums script
- Implemented comprehensive tests for verdict artifact generation to ensure deterministic outputs across various scenarios, including identical inputs, parallel execution, and change ordering.
- Created helper methods for generating sample verdict inputs and computing canonical hashes.
- Added tests to validate the stability of canonical hashes, proof spine ordering, and summary statistics.
- Introduced a new PowerShell script to update SHA256 sums for files, ensuring accurate hash generation and file integrity checks.
2025-12-24 02:17:34 +02:00

4.4 KiB

Stella Router ASP.NET WebService Integration Guide

This guide explains how to integrate any ASP.NET Core WebService with the Stella Router for automatic endpoint discovery and dispatch.

Prerequisites

Add a project reference to StellaOps.Router.AspNet:

<ProjectReference Include="../../__Libraries/StellaOps.Router.AspNet/StellaOps.Router.AspNet.csproj" />

Integration Steps

1. Add Router Options to Service Options

In your service's options class (e.g., MyServiceOptions.cs), add:

using StellaOps.Router.AspNet;

public class MyServiceOptions
{
    // ... existing options ...

    /// <summary>
    /// Stella Router integration configuration (disabled by default).
    /// </summary>
    public StellaRouterOptionsBase? Router { get; set; }
}

2. Register Services in Program.cs

Add the using directive:

using StellaOps.Router.AspNet;

After service registration (e.g., after AddControllers()), add:

// Stella Router integration
builder.Services.TryAddStellaRouter(
    serviceName: "my-service-name",
    version: typeof(Program).Assembly.GetName().Version?.ToString() ?? "1.0.0",
    routerOptions: options.Router);

3. Enable Middleware

After UseAuthorization(), add:

app.TryUseStellaRouter(resolvedOptions.Router);

4. Refresh Endpoint Cache

After all endpoints are mapped (before app.RunAsync()), add:

app.TryRefreshStellaRouterEndpoints(resolvedOptions.Router);

Configuration Example (YAML)

myservice:
  router:
    enabled: true
    region: "us-east-1"
    defaultTimeoutSeconds: 30
    heartbeatIntervalSeconds: 10
    gateways:
      - host: "router.stellaops.local"
        port: 9100
        transportType: "Tcp"
        useTls: true
        certificatePath: "/etc/certs/router.pem"

WebServices Requiring Integration

The following WebServices need to be updated with Router integration:

Service Path Status
Scanner.WebService src/Scanner/StellaOps.Scanner.WebService Complete
Concelier.WebService src/Concelier/StellaOps.Concelier.WebService Pending
Excititor.WebService src/Excititor/StellaOps.Excititor.WebService Pending
Gateway.WebService src/Gateway/StellaOps.Gateway.WebService Pending
VexHub.WebService src/VexHub/StellaOps.VexHub.WebService Pending
Attestor.WebService src/Attestor/StellaOps.Attestor/StellaOps.Attestor.WebService Pending
EvidenceLocker.WebService src/EvidenceLocker/StellaOps.EvidenceLocker/StellaOps.EvidenceLocker.WebService Pending
Findings.Ledger.WebService src/Findings/StellaOps.Findings.Ledger.WebService Pending
AdvisoryAI.WebService src/AdvisoryAI/StellaOps.AdvisoryAI.WebService Pending
IssuerDirectory.WebService src/IssuerDirectory/StellaOps.IssuerDirectory/StellaOps.IssuerDirectory.WebService Pending
Notifier.WebService src/Notifier/StellaOps.Notifier/StellaOps.Notifier.WebService Pending
Notify.WebService src/Notify/StellaOps.Notify.WebService Pending
PacksRegistry.WebService src/PacksRegistry/StellaOps.PacksRegistry/StellaOps.PacksRegistry.WebService Pending
RiskEngine.WebService src/RiskEngine/StellaOps.RiskEngine/StellaOps.RiskEngine.WebService Pending
Signer.WebService src/Signer/StellaOps.Signer/StellaOps.Signer.WebService Pending
TaskRunner.WebService src/TaskRunner/StellaOps.TaskRunner/StellaOps.TaskRunner.WebService Pending
TimelineIndexer.WebService src/TimelineIndexer/StellaOps.TimelineIndexer/StellaOps.TimelineIndexer.WebService Pending
Orchestrator.WebService src/Orchestrator/StellaOps.Orchestrator/StellaOps.Orchestrator.WebService Pending
Scheduler.WebService src/Scheduler/StellaOps.Scheduler.WebService Pending
ExportCenter.WebService src/ExportCenter/StellaOps.ExportCenter/StellaOps.ExportCenter.WebService Pending

Files Created

The Router.AspNet library includes the following files:

  • StellaOps.Router.AspNet.csproj - Project file
  • StellaRouterOptions.cs - Unified router options
  • StellaRouterExtensions.cs - DI extensions (AddStellaRouter, UseStellaRouter)
  • CompositeRequestDispatcher.cs - Routes requests to ASP.NET or Stella endpoints
  • StellaRouterOptionsBase.cs - Base options class for embedding in service options
  • StellaRouterIntegrationHelper.cs - Helper methods for conditional integration