Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Findings Ledger CI / build-test (push) Has been cancelled
Findings Ledger CI / migration-validation (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Signals Reachability Scoring & Events / reachability-smoke (push) Has been cancelled
AOC Guard CI / aoc-guard (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
cryptopro-linux-csp / build-and-test (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
sm-remote-ci / build-and-test (push) Has been cancelled
Findings Ledger CI / generate-manifest (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals Reachability Scoring & Events / sign-and-upload (push) Has been cancelled
71 lines
2.6 KiB
C#
71 lines
2.6 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Options;
|
|
using StellaOps.Excititor.Core.Storage;
|
|
using StellaOps.Excititor.WebService.Services;
|
|
|
|
namespace StellaOps.Excititor.WebService.Endpoints;
|
|
|
|
/// <summary>
|
|
/// Attestation API endpoints (temporarily disabled while Mongo is removed and Postgres storage is adopted).
|
|
/// </summary>
|
|
public static class AttestationEndpoints
|
|
{
|
|
public static void MapAttestationEndpoints(this WebApplication app)
|
|
{
|
|
// GET /attestations/vex/list
|
|
app.MapGet("/attestations/vex/list", (
|
|
HttpContext context,
|
|
IOptions<VexStorageOptions> storageOptions) =>
|
|
{
|
|
var scopeResult = ScopeAuthorization.RequireScope(context, "vex.read");
|
|
if (scopeResult is not null)
|
|
{
|
|
return scopeResult;
|
|
}
|
|
|
|
if (!TryResolveTenant(context, storageOptions.Value, requireHeader: false, out _, out var tenantError))
|
|
{
|
|
return tenantError;
|
|
}
|
|
|
|
return Results.Problem(
|
|
detail: "Attestation listing is temporarily unavailable during Postgres migration (Mongo/BSON removed).",
|
|
statusCode: StatusCodes.Status503ServiceUnavailable,
|
|
title: "Service unavailable");
|
|
}).WithName("ListVexAttestations");
|
|
|
|
// GET /attestations/vex/{attestationId}
|
|
app.MapGet("/attestations/vex/{attestationId}", (
|
|
HttpContext context,
|
|
string attestationId,
|
|
IOptions<VexStorageOptions> storageOptions) =>
|
|
{
|
|
var scopeResult = ScopeAuthorization.RequireScope(context, "vex.read");
|
|
if (scopeResult is not null)
|
|
{
|
|
return scopeResult;
|
|
}
|
|
|
|
if (!TryResolveTenant(context, storageOptions.Value, requireHeader: false, out _, out var tenantError))
|
|
{
|
|
return tenantError;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(attestationId))
|
|
{
|
|
return Results.Problem(
|
|
detail: "attestationId is required.",
|
|
statusCode: StatusCodes.Status400BadRequest,
|
|
title: "Validation error");
|
|
}
|
|
|
|
return Results.Problem(
|
|
detail: "Attestation retrieval is temporarily unavailable during Postgres migration (Mongo/BSON removed).",
|
|
statusCode: StatusCodes.Status503ServiceUnavailable,
|
|
title: "Service unavailable");
|
|
}).WithName("GetVexAttestation");
|
|
}
|
|
}
|